1
0
Fork 0

wireless_reprobe.sh: fix Phase 2 glob — remove trailing slash that broke symlink detection

The glob pattern '$drvdir/*/' appended a trailing '/' to each
entry, which caused the shell to dereference symlinks before
the '[ -L ]' test could run.  Since the only symlinks in a USB
driver directory ARE the bound device entries (e.g. 4-1:1.0),
'[ -L path/ ]' always returned false and the unbind+rebind
never fired for any driver.

Drop the trailing '/', iterate over all entries, and filter
with '[ -L ]' on the raw name.  The module/uevent/new_id
name-skips still work correctly.
This commit is contained in:
Brendan Szymanski 2026-07-14 14:42:35 -04:00
parent cac2f751ac
commit 66b45a54a7

View file

@ -53,10 +53,9 @@ reprobe_usb
for drv in $WIFI_USB_DRIVERS; do
drvdir="/sys/bus/usb/drivers/$drv"
[ -d "$drvdir" ] || continue
for dev_path in "$drvdir"/*/; do
for dev_path in "$drvdir"/*; do
[ -L "$dev_path" ] || continue
name="${dev_path%/}"
name="${name##*/}"
name="${dev_path##*/}"
# Skip the driver's own 'module' symlink and similar metadata
[ "$name" = "module" ] || [ "$name" = "uevent" ] || [ "$name" = "new_id" ] && continue
echo "$name" > "$drvdir/unbind" 2>/dev/null