#1071903 hw-detect: USB wireless adapter r8712u needs physical disconnect and reconnect for firmware to work #1071903
- Package:
- src:hw-detect
- Source:
- src:hw-detect
- Submitter:
- Roland Clobus
- Date:
- 2024-06-01 06:57:03 UTC
- Severity:
- normal
- Tags:
Hello maintainers of hw-detect, I have an USB wireless adapter that uses the r8712u kernel module and that requires firmware from non-free-firmware. When I run the Debian installer, the missing firmware file is correctly identified and installed by 'check-missing-firmware.sh'. However, the kernel module is mis-identified as 'usb'. When I disconnect the adapter and reconnect it, the installer is able to use the adapter properly. Attached is a patch that allows the module to be identified correctly. If desired, I can send the patch instead as a merge request on Salsa. However, using 'modprobe -r r8712u' and 'modprobe r8712u' is not sufficient to enable the adapter, it still needs a physical reconnect. In the attached screenshot from the installer (sid) the result of the patch is shown. Also in the QEMU environment, I need to disconnect and reconnect the USB device from the host. I tried several options, but could not get them to work: bind/unbind [1] authorized, usbreset [2] Do you know a solution (apart from a physical reconnect)? With kind regards, Roland Clobus [1] https://superuser.com/questions/1707773/how-to-turn-usb-connected-device-on-and-off-in-linux [2] https://askubuntu.com/questions/645/how-do-you-reset-a-usb-device-from-the-command-line
Hoi, Roland Clobus <rclobus@rclobus.nl> (2024-05-25): Just to confirm, which linux version was this tested against? As you found out, having 'usb' is rather widespread, hence the existence of the function you patched. What seems weird to my (not at all expert in the kernel area) eyes is the unbound thing that led you to introduce that special case. I see that's a module from staging, maybe it's not behaving like it should? At least differently from other modules… I spotted 1422b526fba994cf05fd288a152106563b875fce that fixed a race condition regarding firmware loading (fix available in v6.6-rc1 and v6.1.52), maybe there are other similar issues? I'd suggest a search in upstream bugzilla and mailing lists. I'm adding the kernel maintainers in copy, in case they have better ideas. Cheers,
This is a more generic issue already reported in #1033679 <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033679> Can you give a try to the attached patches ? They came to late for bookworm, maybe it is time to reconsider them. IMO $address should be included in the search pattern. Else if there is another device reported as "usb" then your patch will wrongly resolve it as r8712u too. Looks like a driver/device issue.
I've used a locally built live image based on sid (live-build) with the patched hw-detect. ... As far as I can see, r8712u entered staging in 2012 and has been there since... In which repo can I find this hash value? ... ...>> Do you know a solution (apart from a physical reconnect)? Thanks. I'll try to look some more. With kind regards, Roland Clobus
Hello Pascal, Your patch series works fine, the firmware is correctly identified and loaded. Unfortunately for me, it still needs a reconnect cycle. See the attached syslog for their effect. (I've used sid) At 19:30:58 the 'no network card is detected' dialog from the installer is shown At 19:32:30 I disconnected the USB device from KVM (which is attached on the host) At 19:32:45 I reconnected the USB device in KVM At 19:34:06 the SSID scan shows the available wireless networks Your patch is better and more generic. It would be a good candidate for at least trixie. Given that within kvm (virt-manager) I can simulate a reconnect, I would expect that it can be simulated otherwise, but haven't found a proper way yet. With kind regards, Roland Clobus
Thank you for testing my patches but I did not expect them to solve the reattachment issue, only to identify the right module. After the r8712u module is first loaded without the firmware then unloaded and reloaded, what is the output of ls -d /sys/bus/usb/drivers/r8712u/1-3* ls -d /sys/bus/usb/devices/1-3/1-3* assuming the wireless adapter is identified as 1-3 ?
* A live-build-based image with the Debian installer, generated for sid with in config/packages the hw-detect.udeb with the patches from #1033679 * Virtual-Manager boots the ISO image (UEFI secure boot) * When the GRUB menu is shown, I attach the USB network adapter from the host * I select the Debian installer * Moment 1: the first d-i screen is shown. The USB device is seen by the kernel, but the module is not yet loaded ls -d /sys/bus/usb/drivers/r8712u/1-3* No such file or directory ls -d /sys/bus/usb/drivers/usb/1-3* /sys/bus/usb/drivers/usb/1-3 ls -d /sys/bus/usb/devices/1-3/1-3* /sys/bus/usb/devices/1-3/1-3:1:0 lsmod | grep r8712u <empty> * Moment 2: the d-i screen 'No Ethernet card was detected' is shown (The firmware has been placed where it can be found, module r8712u has been removed and added) ls -d /sys/bus/usb/drivers/r8712u/1-3* No such file or directory ls -d /sys/bus/usb/drivers/usb/1-3* No such file or directory ls -d /sys/bus/usb/devices/1-3/1-3* No such file or directory lsmod | grep r8712u r8712u 262144 0 cfg80211 1355776 1 r8712u usbcore 409600 5 xhci_hcd,usbhib,r8712u,usb_storage,xhci_pci * Moment 3: I disconnect and reconnect the USB device in virt-manager and select 'Detect network hardware' from the d-i menu. d-i shows a list of SSIDs ls -d /sys/bus/usb/drivers/r8712u/1-3* /sys/bus/usb/drivers/r8712u/1-3:1.0 ls -d /sys/bus/usb/drivers/usb/1-3* /sys/bus/usb/drivers/usb/1-3 ls -d /sys/bus/usb/devices/1-3/1-3* /sys/bus/usb/devices/1-3/1-3:1:0 lsmod | grep r8712u r8712u 262144 0 cfg80211 1355776 1 r8712u usbcore 409600 5 xhci_hcd,usbhib,r8712u,usb_storage,xhci_pci With kind regards, Roland Clobus
As expected, the module is not loaded so /sys/bus/usb/drivers/r8712u does not exist. The device is present. The module is loaded so /sys/bus/usb/drivers/r8712u should exist but is not associated with the device. It looks like the device is not present any more. But there was no disconnect message in the kernel log. All I can see it the reset message, but AFAICS a reset should not remove the device. Maybe it was disabled or powered down. I do not know enough about the kernel and USB subsystem to have any clue about what is wrong. Maybe running "udevadm trigger" during specific moments and recording its output may provide useful information: - when the adapter is connected - when the module is loaded without the firmware - when the adapter is disconnected - when the module is reloaded with the firmware You do not have to run check-missing-firmware for this, you can run modprobe commands in a shell. As expected, the device is associated with the driver.
Sorry, I meant "udevadm monitor".