procd: fix hotplug.json syntax
[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                                                 [ "regex", "DEVNAME", "^snd" ],
21                                                 [ "makedev", "/dev/%DEVNAME%", "0660", "audio" ]
22                                         ],
23                                         [ "if",
24                                                 [ "has", "DEVNAME" ],
25                                                 [ "makedev", "/dev/%DEVNAME%", "0600" ]
26                                         ]
27                                 ]
28                         ],
29                         [ "if",
30                                 [ "has", "FIRMWARE" ],
31                                 [
32                                         [ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ],
33                                         [ "load-firmware", "/lib/firmware" ],
34                                         [ "return" ]
35                                 ]
36                         ]
37                 ],
38                 "remove" : [
39                         [ "if",
40                                 [ "and",
41                                         [ "has", "DEVNAME" ],
42                                         [ "has", "MAJOR" ],
43                                         [ "has", "MINOR" ]
44                                 ],
45                                 [ "rm", "/dev/%DEVNAME%" ]
46                         ]
47                 ]
48         } ],
49         [ "if",
50                 [ "and",
51                         [ "has", "BUTTON" ],
52                         [ "eq", "SUBSYSTEM", "button" ]
53                 ],
54                 [ "button", "/etc/rc.button/%BUTTON%" ]
55         ],
56         [ "if",
57                 [ "and",
58                         [ "eq", "SUBSYSTEM", "usb-serial" ],
59                         [ "regex", "DEVNAME",
60                                 [ "^ttyUSB", "^ttyACM" ]
61                         ]
62                 ],
63                 [ "exec", "/sbin/hotplug-call", "tty" ],
64                 [ "if",
65                         [ "isdir", "/etc/hotplug.d/%SUBSYSTEM%" ],
66                         [ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ]
67                 ]
68         ]
69 ]