procd: handle hotplug events for the usbmisc subsystem
[openwrt/openwrt.git] / package / system / procd / files / hotplug.json
1 [
2 [ "case", "ACTION", {
3 "add": [
4 [ "if",
5 [ "and",
6 [ "has", "MAJOR" ],
7 [ "has", "MINOR" ],
8 ],
9 [
10 [ "if",
11 [ "or",
12 [ "eq", "DEVNAME",
13 [ "null", "full", "ptmx", "zero" ],
14 ],
15 [ "regex", "DEVNAME",
16 [ "^gpio", "^hvc" ],
17 ],
18 ],
19 [
20 [ "makedev", "/dev/%DEVNAME%", "0666" ],
21 [ "return" ],
22 ]
23 ],
24 [ "if",
25 [ "or",
26 [ "eq", "DEVNAME", "mapper/control" ],
27 [ "regex", "DEVPATH", "^ppp" ],
28 ],
29 [
30 [ "makedev", "/dev/%DEVNAME%", "0600" ],
31 [ "return" ],
32 ],
33 ],
34 [ "if",
35 [ "has", "DEVNAME" ],
36 [ "makedev", "/dev/%DEVNAME%", "0644" ],
37 ],
38 ],
39 ],
40 [ "if",
41 [ "has", "FIRMWARE" ],
42 [
43 [ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ],
44 [ "load-firmware", "/lib/firmware" ],
45 [ "return" ]
46 ]
47 ],
48 ],
49 "remove" : [
50 [ "if",
51 [ "and",
52 [ "has", "DEVNAME" ],
53 [ "has", "MAJOR" ],
54 [ "has", "MINOR" ],
55 ],
56 [ "rm", "/dev/%DEVNAME%" ]
57 ]
58 ]
59 } ],
60 [ "if",
61 [ "eq", "SUBSYSTEM", "platform" ],
62 [ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ]
63 ],
64 [ "if",
65 [ "and",
66 [ "has", "BUTTON" ],
67 [ "eq", "SUBSYSTEM", "button" ],
68 ],
69 [ "exec", "/etc/rc.button/%BUTTON%" ]
70 ],
71 [ "if",
72 [ "eq", "SUBSYSTEM",
73 [ "net", "input", "usb", "usbmisc", "ieee1394", "block", "atm", "zaptel", "tty", "button" ]
74 ],
75 [ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ]
76 ],
77 [ "if",
78 [ "and",
79 [ "eq", "SUBSYSTEM", "usb-serial" ],
80 [ "regex", "DEVNAME",
81 [ "^ttyUSB", "^ttyACM" ]
82 ],
83 ],
84 [ "exec", "/sbin/hotplug-call", "tty" ]
85 ],
86 ]