[OpenWrt-Devel] [PATCH] procd base-files: For hotplug expose DEVNAME as variable to hotplug scripts

Yousong Zhou yszhou4tech at gmail.com
Wed Dec 16 21:34:52 EST 2015


On 17 December 2015 at 06:21,  <openwrt at daniel.thecshore.com> wrote:
> 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"

DEVNAME should already be available as an environment variable.

                yousong

>
>  . /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
_______________________________________________
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