85fbb144cc3342c98485320e57572adbb893337f
[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 [ "eq", "DEVNAME",
12 [ "null", "full", "ptmx", "zero", "tty", "net", "random", "urandom" ],
13 ],
14 [
15 [ "makedev", "/dev/%DEVNAME%", "0666" ],
16 [ "return" ],
17 ]
18 ],
19 [ "if",
20 [ "eq", "DEVNAME", "kmsg" ],
21 [ "makedev", "/dev/%DEVNAME%", "0644" ],
22 ],
23 [ "if",
24 [ "regex", "DEVNAME", "^snd" ],
25 [ "makedev", "/dev/%DEVNAME%", "0660", "audio" ],
26 ],
27 [ "if",
28 [ "has", "DEVNAME" ],
29 [ "makedev", "/dev/%DEVNAME%", "0600" ],
30 ],
31 ],
32 ],
33 [ "if",
34 [ "has", "FIRMWARE" ],
35 [
36 [ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ],
37 [ "load-firmware", "/lib/firmware" ],
38 [ "return" ]
39 ]
40 ],
41 ],
42 "remove" : [
43 [ "if",
44 [ "and",
45 [ "has", "DEVNAME" ],
46 [ "has", "MAJOR" ],
47 [ "has", "MINOR" ],
48 ],
49 [ "rm", "/dev/%DEVNAME%" ]
50 ]
51 ]
52 } ],
53 [ "if",
54 [ "and",
55 [ "has", "BUTTON" ],
56 [ "eq", "SUBSYSTEM", "button" ],
57 ],
58 [ "button", "/etc/rc.button/%BUTTON%" ]
59 ],
60 [ "if",
61 [ "and",
62 [ "eq", "SUBSYSTEM", "usb-serial" ],
63 [ "regex", "DEVNAME",
64 [ "^ttyUSB", "^ttyACM" ]
65 ]
66 ],
67 [ "exec", "/sbin/hotplug-call", "tty" ],
68 [ "if",
69 [ "isdir", "/etc/hotplug.d/%SUBSYSTEM%" ],
70 [ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ]
71 ]
72 ],
73 ]