mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 18:19:02 +00:00
2249780fb7
Now that 'start-console' procd command has reached the main repo, we can add a rule to start consoles on serial devices which are created when USB gadget driver reports creation with hotplugging. Signed-off-by: Michael Heimpold <mhei@heimpold.de>
78 lines
1.5 KiB
JSON
78 lines
1.5 KiB
JSON
[
|
|
[ "case", "ACTION", {
|
|
"add": [
|
|
[ "if",
|
|
[ "and",
|
|
[ "has", "MAJOR" ],
|
|
[ "has", "MINOR" ]
|
|
],
|
|
[
|
|
[ "if",
|
|
[ "eq", "DEVNAME",
|
|
[ "null", "full", "ptmx", "zero", "tty", "net", "random", "urandom" ]
|
|
],
|
|
[
|
|
[ "makedev", "/dev/%DEVNAME%", "0666" ],
|
|
[ "return" ]
|
|
]
|
|
],
|
|
[ "if",
|
|
[ "regex", "DEVNAME", "^snd" ],
|
|
[ "makedev", "/dev/%DEVNAME%", "0660", "audio" ]
|
|
],
|
|
[ "if",
|
|
[ "regex", "DEVNAME", "^tty" ],
|
|
[ "makedev", "/dev/%DEVNAME%", "0660", "dialout" ]
|
|
],
|
|
[ "if",
|
|
[ "has", "DEVNAME" ],
|
|
[ "makedev", "/dev/%DEVNAME%", "0600" ]
|
|
]
|
|
]
|
|
],
|
|
[ "if",
|
|
[ "has", "FIRMWARE" ],
|
|
[
|
|
[ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ],
|
|
[ "load-firmware", "/lib/firmware" ],
|
|
[ "return" ]
|
|
]
|
|
],
|
|
[ "if",
|
|
[ "regex", "DEVNAME", "^ttyGS" ],
|
|
[ "start-console", "%DEVNAME%" ]
|
|
]
|
|
],
|
|
"remove" : [
|
|
[ "if",
|
|
[ "and",
|
|
[ "has", "DEVNAME" ],
|
|
[ "has", "MAJOR" ],
|
|
[ "has", "MINOR" ]
|
|
],
|
|
[ "rm", "/dev/%DEVNAME%" ]
|
|
]
|
|
]
|
|
} ],
|
|
[ "if",
|
|
[ "and",
|
|
[ "has", "BUTTON" ],
|
|
[ "eq", "SUBSYSTEM", "button" ]
|
|
],
|
|
[ "button", "/etc/rc.button/%BUTTON%" ]
|
|
],
|
|
[ "if",
|
|
[ "and",
|
|
[ "eq", "SUBSYSTEM", "usb-serial" ],
|
|
[ "regex", "DEVNAME",
|
|
[ "^ttyUSB", "^ttyACM" ]
|
|
]
|
|
],
|
|
[ "exec", "/sbin/hotplug-call", "tty" ],
|
|
[ "if",
|
|
[ "isdir", "/etc/hotplug.d/%SUBSYSTEM%" ],
|
|
[ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ]
|
|
]
|
|
]
|
|
]
|