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

Yousong Zhou yszhou4tech at gmail.com
Wed Feb 17 00:26:09 EST 2016


On 17 February 2016 at 11:26, Yousong Zhou <yszhou4tech at gmail.com> wrote:
> 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 at gmail.com>
> ---
> Changes from v2, fix hotplug-call platform twice
>
> 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 | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/package/system/procd/files/hotplug.json b/package/system/procd/files/hotplug.json
> index 516a122..e2f1604 100644
> --- a/package/system/procd/files/hotplug.json
> +++ b/package/system/procd/files/hotplug.json
> @@ -58,10 +58,6 @@
>                 ]
>         } ],
>         [ "if",
> -               [ "eq", "SUBSYSTEM", "platform" ],
> -               [ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ]
> -       ],
> -       [ "if",

Is it required that we should hotplug-call platform first before doing
button handling?

                yousong

>                 [ "and",
>                         [ "has", "BUTTON" ],
>                         [ "eq", "SUBSYSTEM", "button" ],
> @@ -69,18 +65,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%" ]
> +               ]
>         ],
>  ]
> --
> 2.6.4
>
_______________________________________________
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