Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#1903 - Hotplug event triggered too early #8451

Open
openwrt-bot opened this issue Oct 20, 2018 · 4 comments
Open

FS#1903 - Hotplug event triggered too early #8451

openwrt-bot opened this issue Oct 20, 2018 · 4 comments
Labels
flyspray release/19.07 pull request/issue targeted (also) for OpenWrt 19.07 release

Comments

@openwrt-bot
Copy link

Greek64:

DEVICE: TP-Link Archer C7 v2
SYSTEM: OpenWRT 18.06.1
PACKAGES: base + luci, ca-certificates, ddns-scripts_no-ip_com, luci-app-ddns, wget, ip, ppp, ppp-mod-pppoe, vim, nano, usbutils, usb-modeswitch, kmod-usb-core,
kmod-usb-serial, kmod-usb-serial-option, kmod-usb-net-cdc-ncm, kmod-usb-net-huawei-cdc-ncm, picocom, sqm-scripts, luci-app-sqm, kmod-ledtrig-heartbeat, htop

If the USB Device (HUAWEI E3372 LTE Stick) is left connected to the router during a reboot/boot, the hotplug event is triggered too early and the device has not yet all interfaces mapped in the /dev directory.
More specifically, my hotplug script wants to find the name of the interface (which is "ttyUSB0" in my case) by looking at the $DEVPATH directory, but during the hotplug script execution the link does not yet exist. Adding a "sleep" inside the script does not help, but executing a subscript via "exec script &" shows that after 3 seconds the link is created.
Attached is a file showing the directory listing of $DEVPATH during the hotplug event, and 3 seconds after the hotplug event.

Note that the hotplug script works as intended during actual hotplugging. This bug only presents itself during boot/reboot.
Also note that this was working on OpenWRT 15.05.1 (same Router, Stick and hotplug script)

@openwrt-bot
Copy link
Author

Greek64:

Still present in OpenWRT 19.07.0 and ath79

@openwrt-bot
Copy link
Author

luizluca:

hotplug "coldplug" happens on early stage of booting, before modules are loaded.
Maybe you need to get another hotplug event after the needed module was loaded.

@openwrt-bot
Copy link
Author

Greek64:

Still present in OpenWRT 19.07.04 (auth79)

Maybe you need to get another hotplug event after the needed module was loaded.

You mean manually triggering "udevtrigger" at a later time?
Isn't it still a bug?

@openwrt-bot
Copy link
Author

luizluca:

Could plug might be required for loading modules (extroot?) as well as loaded modules are might be needed to correctly process cold plug events. If udevtrigger can be executed twice without a bad side effect, I would call it again after all modules are loaded and call it a day. OpenWrt used to do that in the past.

Normally a plug event emits a bunch of udev events (usb, usbmisc, ...). Some of them happen after/if a module is loaded, even if that happens seconds after the first events for that device. If the sequence of udev events is the same for a hot and could plug, it is working as expected no matter the delay between them. If not, it is a bug.

In this specific case, the created symlink might be trigged by another udev event when the module was loaded. Maybe your hotplug script might need to be trigged by that event and not the usb event you are using. The same would happen if the module package was installed with the usb device plugged and hotplug script was already in place (after an upgrade, for example)

@aparcar aparcar added the release/19.07 pull request/issue targeted (also) for OpenWrt 19.07 release label Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray release/19.07 pull request/issue targeted (also) for OpenWrt 19.07 release
Projects
None yet
Development

No branches or pull requests

2 participants