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

Downloading firmware to usb device fails #1022

Open
shuffle2 opened this issue Aug 24, 2024 · 4 comments
Open

Downloading firmware to usb device fails #1022

shuffle2 opened this issue Aug 24, 2024 · 4 comments

Comments

@shuffle2
Copy link

shuffle2 commented Aug 24, 2024

Windows version: Microsoft Windows [Version 10.0.22631.4037]

I'm using local build of wsl2 kernel 6.6:

Linux goliath 6.6.36.3-microsoft-standard-WSL2 #4 SMP PREEMPT_DYNAMIC Fri Aug 23 23:29:30 PDT 2024 x86_64 x86_64 x86_64 GNU/Linux

Using the config in Microsoft/config-wsl , with added support for mediatek wifi devices, and embedding firmware files in kernel image (to get around the issue of wsl2 kernel not looking in distro's /lib/firmware for fw files).

the wsl2 kernel dmesg looks like

[ 1471.630234] vhci_hcd vhci_hcd.0: pdev(0) rhport(0) sockfd(3)
[ 1471.630240] vhci_hcd vhci_hcd.0: devid(327689) speed(5) speed_str(super-speed)
[ 1471.630284] vhci_hcd vhci_hcd.0: Device attached
[ 1471.916378] usb 2-1: SetAddress Request (4) to port 0
[ 1471.916385] usb 2-1: new SuperSpeed USB device number 4 using vhci_hcd
[ 1472.082195] usb 2-1: SetAddress Request (4) to port 0
[ 1472.082200] usb 2-1: reset SuperSpeed USB device number 4 using vhci_hcd
[ 1472.109940] mt76x2u 2-1:1.0: ASIC revision: 76120044
[ 1472.215920] mt76x2u 2-1:1.0: ROM patch build: 20141115060606a
[ 1472.632598] vhci_hcd: unlink->seqnum 8050
[ 1472.632620] vhci_hcd: urb->status -104
[ 1472.981550] vhci_hcd: unlink->seqnum 8052
[ 1472.981575] vhci_hcd: urb->status -104
[ 1473.330762] vhci_hcd: unlink->seqnum 8054
[ 1473.330785] vhci_hcd: urb->status -104
[ 1473.679688] vhci_hcd: unlink->seqnum 8056
[ 1473.679712] vhci_hcd: urb->status -104
[ 1474.028800] vhci_hcd: unlink->seqnum 8058
[ 1474.028823] vhci_hcd: urb->status -104
[ 1474.377947] vhci_hcd: unlink->seqnum 8060
[ 1474.377969] vhci_hcd: urb->status -104
[ 1474.727158] vhci_hcd: unlink->seqnum 8062
[ 1474.727182] vhci_hcd: urb->status -104
[ 1475.076170] vhci_hcd: unlink->seqnum 8064
[ 1475.076194] vhci_hcd: urb->status -104
[ 1475.425368] vhci_hcd: unlink->seqnum 8066
[ 1475.425394] vhci_hcd: urb->status -104
[ 1475.774289] vhci_hcd: unlink->seqnum 8068
[ 1475.774312] vhci_hcd: urb->status -104
[ 1475.784754] mt76x2u 2-1:1.0: vendor request req:07 off:09a8 failed:-110
...
[ 1568.817048] mt76x2u 2-1:1.0: vendor request req:42 off:0232 failed:-110
[ 1569.155675] vhci_hcd: unlink->seqnum 8614
[ 1569.155693] vhci_hcd: urb->status -104
[ 1569.504688] vhci_hcd: unlink->seqnum 8616
[ 1569.504693] vhci_hcd: urb->status -104
[ 1569.853891] vhci_hcd: unlink->seqnum 8618
[ 1569.853912] vhci_hcd: urb->status -104
[ 1570.202937] vhci_hcd: unlink->seqnum 8620
[ 1570.202962] vhci_hcd: urb->status -104
[ 1570.552166] vhci_hcd: unlink->seqnum 8622
[ 1570.552191] vhci_hcd: urb->status -104
[ 1570.901204] vhci_hcd: unlink->seqnum 8624
[ 1570.901222] vhci_hcd: urb->status -104
[ 1571.250242] vhci_hcd: unlink->seqnum 8626
[ 1571.250248] vhci_hcd: urb->status -104
[ 1571.599273] vhci_hcd: unlink->seqnum 8628
[ 1571.599296] vhci_hcd: urb->status -104
[ 1571.948336] vhci_hcd: unlink->seqnum 8630
[ 1571.948352] vhci_hcd: urb->status -104
[ 1572.297596] vhci_hcd: unlink->seqnum 8632
[ 1572.297604] vhci_hcd: urb->status -104
[ 1572.307981] mt76x2u 2-1:1.0: vendor request req:42 off:0234 failed:-110
[ 1572.646650] vhci_hcd: unlink->seqnum 8634
[ 1572.646674] vhci_hcd: urb->status -104
[ 1572.995726] vhci_hcd: unlink->seqnum 8636
[ 1572.995750] vhci_hcd: urb->status -104
[ 1573.344755] vhci_hcd: unlink->seqnum 8638
[ 1573.344777] vhci_hcd: urb->status -104
[ 1573.693898] vhci_hcd: unlink->seqnum 8640
[ 1573.693919] vhci_hcd: urb->status -104
[ 1574.042912] vhci_hcd: unlink->seqnum 8642
[ 1574.042930] vhci_hcd: urb->status -104
[ 1574.392106] vhci_hcd: unlink->seqnum 8644
[ 1574.392128] vhci_hcd: urb->status -104
[ 1574.741126] vhci_hcd: unlink->seqnum 8646
[ 1574.741144] vhci_hcd: urb->status -104
[ 1575.090353] vhci_hcd: unlink->seqnum 8648
[ 1575.090375] vhci_hcd: urb->status -104
[ 1575.439352] vhci_hcd: unlink->seqnum 8650
[ 1575.439376] vhci_hcd: urb->status -104
[ 1575.788372] vhci_hcd: unlink->seqnum 8652
[ 1575.788393] vhci_hcd: urb->status -104
[ 1575.798794] mt76x2u 2-1:1.0: vendor request req:42 off:0236 failed:-110
[ 1576.905613] vhci_hcd: unlink->seqnum 8654
[ 1576.905636] vhci_hcd: urb->status -104
[ 1576.905689] mt76x2u 2-1:1.0: firmware upload failed: -110

usbipd output + pcap is here:
usbipd_issue.zip

the same issue occurs whether the device is plugged into superspeed port or not.

the linux-side code that's failing is here: https://github.com/microsoft/WSL2-Linux-Kernel/blob/149cbd13f7c04e5a9343532590866f31b5844c70/drivers/net/wireless/mediatek/mt76/mt76x2/usb_mcu.c#L119

...notably, this code in wsl2 kernel isn't up to date with mainline:
wsl2: https://github.com/microsoft/WSL2-Linux-Kernel/commits/linux-msft-wsl-6.6.y/drivers/net/wireless/mediatek/mt76/mt76x2
linux: https://github.com/torvalds/linux/commits/master/drivers/net/wireless/mediatek/mt76/mt76x2

although, not sure if I should try current mainline kernel, or try to backport the driver to wsl2 kernel v6.6 (or if i'm hitting some issue in usbipd)

the adapter works OK with windows. (and on other native linux hosts, although it's been some years since I've used it on such machine)

@dorssel
Copy link
Owner

dorssel commented Aug 24, 2024

From the PCap, it looks to be a timing issue (maybe too much latency due to the USBIP protocol). Everything works fine up to line 639 of the capture, but then (after > 0.3 s of "nothing") Linux starts aborting all transfers, even though there were no errors up to this point.

@shuffle2
Copy link
Author

Thanks for taking a look. I tried increasing the timeouts in the linux driver, as well as reducing the transfer sizes (down to only 64 payload bytes). Neither has changed the behavior, unfortunately.

@shuffle2
Copy link
Author

shuffle2 commented Aug 24, 2024

Another thing is that if I detach the device from wsl after the transfers start failing, windows gives me the "usb device has malfunctioned" popup (and it must be physically replugged). This somewhat seems to make sense, but surprising that usb bus reset doesn't actually reset the device.

@dorssel
Copy link
Owner

dorssel commented Aug 24, 2024

That sounds like a "partial firmware upload". I guess the device is stuck at that point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants