[OpenWrt-Devel] [PATCH] procd base-files: For hotplug expose DEVNAME as variable to hotplug scripts
openwrt at daniel.thecshore.com
openwrt at daniel.thecshore.com
Wed Dec 16 17:21:57 EST 2015
From: Daniel Dickinson <openwrt at daniel.thecshore.com>
Without exposing DEVNAME to scripts in /etc/hotplug.d,
they have no means of determining the actual device file
path (in most cases), which is counter-productive for
doing things like settings permissions on a device file
based on things like vendor and product id for usb, or
other manipulations that don't fit the standard json.
Signed-off-by: Daniel Dickinson <openwrt at daniel.thecshore.com>
---
package/base-files/files/sbin/hotplug-call | 1 +
package/system/procd/files/hotplug.json | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/package/base-files/files/sbin/hotplug-call b/package/base-files/files/sbin/hotplug-call
index 743871a..d79ac9f 100755
--- a/package/base-files/files/sbin/hotplug-call
+++ b/package/base-files/files/sbin/hotplug-call
@@ -2,6 +2,7 @@
# Copyright (C) 2006-2010 OpenWrt.org
export HOTPLUG_TYPE="$1"
+export DEVNAME="$2"
. /lib/functions.sh
diff --git a/package/system/procd/files/hotplug.json b/package/system/procd/files/hotplug.json
index 27b4836..0529e39 100644
--- a/package/system/procd/files/hotplug.json
+++ b/package/system/procd/files/hotplug.json
@@ -72,7 +72,7 @@
[ "eq", "SUBSYSTEM",
[ "net", "input", "usb", "usbmisc", "ieee1394", "block", "atm", "zaptel", "tty", "button" ]
],
- [ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ]
+ [ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%", "%DEVNAME%" ]
],
[ "if",
[ "and",
@@ -81,6 +81,6 @@
[ "^ttyUSB", "^ttyACM" ]
],
],
- [ "exec", "/sbin/hotplug-call", "tty" ]
+ [ "exec", "/sbin/hotplug-call", "tty", "%DEVNAME%" ]
],
]
--
2.4.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list