diff mbox

[OpenWrt-Devel,v2] procd: hotplug.json: allow passing hotplug events from all subsystems

Message ID 1455358402-18633-1-git-send-email-yszhou4tech@gmail.com
State Changes Requested
Headers show

Commit Message

Yousong Zhou Feb. 13, 2016, 10:13 a.m. UTC
There are time that programs need to be notified of events from
subsystems that are not enumerated in the .json definition, e.g. QEMU
guest agent by default requires /dev/virtio-ports/org.qemu.guest_agent.0
which is a symlink to /dev/vportMpN from virtio-ports subsystem.

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
Changes from v1, now we depend on "isdir" support from libubox/json_script to
selectively hotplug-call only those subsystems we have handlers ready

For the record, the PR about qemu-ga is at
https://github.com/openwrt/packages/pull/2041

 package/system/procd/files/hotplug.json | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/package/system/procd/files/hotplug.json b/package/system/procd/files/hotplug.json
index 516a122..f9db402 100644
--- a/package/system/procd/files/hotplug.json
+++ b/package/system/procd/files/hotplug.json
@@ -69,18 +69,16 @@ 
 		[ "button", "/etc/rc.button/%BUTTON%" ]
 	],
 	[ "if",
-		[ "eq", "SUBSYSTEM",
-			[ "net", "input", "usb", "usbmisc", "ieee1394", "block", "atm", "zaptel", "tty", "button", "sound" ]
-		],
-		[ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ]
-	],
-	[ "if",
 		[ "and",
 			[ "eq", "SUBSYSTEM", "usb-serial" ],
 			[ "regex", "DEVNAME",
 				[ "^ttyUSB", "^ttyACM" ]
-			],
+			]
 		],
-		[ "exec", "/sbin/hotplug-call", "tty" ]
+		[ "exec", "/sbin/hotplug-call", "tty" ],
+		[ "if",
+			[ "isdir", "/etc/hotplug.d/%SUBSYSTEM%" ],
+			[ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ]
+		]
 	],
 ]