Skip to content

Conversation

@dlech
Copy link
Member

@dlech dlech commented Jul 26, 2025

Fixing pybricks/support#2295 plus bumping the firmware version so that the WebUSB descriptors point to labs.pybricks.com instead of code.pybricks.com.

dlech added 3 commits July 25, 2025 21:09
We plan on calling the next release v4. The main purpose of changing
this now is so that the WebUSB BOS descriptors will point to
labs.pybricks.com instead of code.pybricks.com.

Also fix missing include in usb_common_desc.c to make this actually
take effect.
Use the correct register when calling USBReset().

Also replace some hard-coded values with macros in the related TI library.
Fix the USB being in a bad state after a firmware update.

The firmware updater uses the USB to transfer the new firmware and then
jumps to the new firmware without resetting the USB controller. Calling
USBReset() was not enough to reset the USB controller. Even after this
we would never get any interrupts, so requests from a host would time
out. This is fixed by using the PSC to reset the USB controller instead
of USBReset().

Also, before we reset things, we need to tell the host to disconnect
from the firmware update USB device. When we reconfigure things the EV3
will appear as a completely different USB device.

Fixes: pybricks/support#2295
@coveralls
Copy link

Coverage Status

coverage: 56.982% (+0.02%) from 56.967%
when pulling 5f7f3a4 on dlech:pybricks-v4a0
into 85b7340 on pybricks:master.

@BertLindeman
Copy link
Contributor

YES, Milestone 4.0

flashed the EV3 on the USB-2 of mammoet

Linux Mint

Flash no longer waits 30 seconds after EV3 restart.

After a few reboots of the EV3, the EV3 is recognized:

dmesg output

[Sat Jul 26 19:18:39 2025] usb 1-1.2: new full-speed USB device number 104 using ehci-pci
[Sat Jul 26 19:18:39 2025] usb 1-1.2: New USB device found, idVendor=0694, idProduct=0002, bcdDevice= 2.00
[Sat Jul 26 19:18:39 2025] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[Sat Jul 26 19:18:39 2025] usb 1-1.2: Product: NXT + Pybricks
[Sat Jul 26 19:18:39 2025] usb 1-1.2: Manufacturer: LEGO System A/S
[Sat Jul 26 19:18:54 2025] usb 1-1.2: USB disconnect, device number 104
[Sat Jul 26 19:19:56 2025] usb 1-1.2: new high-speed USB device number 105 using ehci-pci
[Sat Jul 26 19:19:56 2025] usb 1-1.2: New USB device found, idVendor=0694, idProduct=0006, bcdDevice= 0.00
[Sat Jul 26 19:19:56 2025] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Sat Jul 26 19:19:56 2025] usb 1-1.2: Product: EV3 Firmware Update
[Sat Jul 26 19:19:56 2025] usb 1-1.2: Manufacturer: LEGO
[Sat Jul 26 19:19:56 2025] usb 1-1.2: SerialNumber: 12345sejs
[Sat Jul 26 19:19:56 2025] hid-generic 0003:0694:0006.004F: hiddev0,hidraw4: USB HID v1.10 Device [LEGO EV3 Firmware Update] on usb-0000:00:1a.0-1.2/input0
[Sat Jul 26 19:20:18 2025] usbhid 1-1.2:1.0: can't add hid device: -71
[Sat Jul 26 19:20:18 2025] usbhid: probe of 1-1.2:1.0 failed with error -71
[Sat Jul 26 19:20:18 2025] usb 1-1.2: USB disconnect, device number 105
[Sat Jul 26 19:20:18 2025] usb 1-1.2: new high-speed USB device number 106 using ehci-pci
[Sat Jul 26 19:20:18 2025] usb 1-1.2: device descriptor read/all, error -71
[Sat Jul 26 19:20:18 2025] usb 1-1.2: new high-speed USB device number 107 using ehci-pci
[Sat Jul 26 19:20:18 2025] usb 1-1.2: device descriptor read/all, error -71
[Sat Jul 26 19:20:18 2025] usb 1-1-port2: attempt power cycle
[Sat Jul 26 19:20:19 2025] usb 1-1.2: new high-speed USB device number 108 using ehci-pci
[Sat Jul 26 19:20:19 2025] usb 1-1.2: device descriptor read/8, error -71
[Sat Jul 26 19:20:19 2025] usb 1-1.2: device descriptor read/8, error -71
[Sat Jul 26 19:20:19 2025] usb 1-1.2: new high-speed USB device number 109 using ehci-pci
[Sat Jul 26 19:20:19 2025] usb 1-1.2: device descriptor read/8, error -71
[Sat Jul 26 19:20:19 2025] usb 1-1.2: device descriptor read/8, error -71
[Sat Jul 26 19:20:20 2025] usb 1-1-port2: unable to enumerate USB device
[Sat Jul 26 19:20:38 2025] usb 1-1.2: new high-speed USB device number 110 using ehci-pci
[Sat Jul 26 19:20:38 2025] usb 1-1.2: device descriptor read/all, error -71
[Sat Jul 26 19:20:38 2025] usb 1-1.2: new high-speed USB device number 111 using ehci-pci
[Sat Jul 26 19:20:38 2025] usb 1-1.2: device descriptor read/all, error -71
[Sat Jul 26 19:20:38 2025] usb 1-1-port2: attempt power cycle
[Sat Jul 26 19:20:38 2025] usb 1-1.2: new high-speed USB device number 112 using ehci-pci
[Sat Jul 26 19:20:44 2025] usb 1-1.2: device descriptor read/8, error -110
[Sat Jul 26 19:20:59 2025] usb 1-1.2: device descriptor read/8, error -110
[Sat Jul 26 19:21:00 2025] usb 1-1.2: new high-speed USB device number 113 using ehci-pci
[Sat Jul 26 19:21:00 2025] usb 1-1.2: device descriptor read/8, error -71
[Sat Jul 26 19:21:00 2025] usb 1-1.2: device descriptor read/8, error -71
[Sat Jul 26 19:21:00 2025] usb 1-1-port2: unable to enumerate USB device
[Sat Jul 26 19:21:06 2025] usb 1-1.2: new high-speed USB device number 114 using ehci-pci
[Sat Jul 26 19:21:06 2025] usb 1-1.2: device descriptor read/all, error -71
[Sat Jul 26 19:21:06 2025] usb 1-1.2: new high-speed USB device number 115 using ehci-pci
[Sat Jul 26 19:21:06 2025] usb 1-1.2: New USB device found, idVendor=0694, idProduct=0005, bcdDevice= 2.00
[Sat Jul 26 19:21:06 2025] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Sat Jul 26 19:21:06 2025] usb 1-1.2: Product: LEGO MINDSTORMS EV3 + Pybricks
[Sat Jul 26 19:21:06 2025] usb 1-1.2: Manufacturer: LEGO System A/S
[Sat Jul 26 19:21:06 2025] usb 1-1.2: SerialNumber: 0016535166E2
[Sat Jul 26 19:21:21 2025] usb 1-1.2: USB disconnect, device number 115

Windows
Click on the 'usb device detected' pop-up message (as expected):

permission to access this page.
403 Error. Forbidden.

I have no feeling that the REPL works more stable.
Maybe for typed input a bit, but edit mode paste hangs after 2 or 5 lines.
Or recall of a previous record and edit of such a line makes the EV3 hang.

Should pybricksdev run -n COM6 meminfo.py already work?
Now I get on windows usb.core.NoBackendError: No backend available

@dlech
Copy link
Member Author

dlech commented Jul 26, 2025

Flash no longer waits 30 seconds after EV3 restart.

Yup, that is the only thing being fixed here.

After a few reboots of the EV3, the EV3 is recognized:

Still looking into this one. I can reproduce it on my Chromebook.

permission to access this page.
403 Error. Forbidden.

Perhaps @laurensvalk can help with that (labs.pybricks.com).

I have no feeling that the REPL works more stable.

That isn't related to USB. See #357 (comment)

Should pybricksdev run -n COM6 meminfo.py already work?

Using pybricksdev from the master branch (no PyPI) with SPIKE and pybricksdev run usb meminfo.py should work. Not implemented yet for EV3 or NXT.

@dlech dlech merged commit 2b2ae66 into pybricks:master Jul 26, 2025
17 checks passed
@dlech dlech deleted the pybricks-v4a0 branch July 26, 2025 18:32
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

Successfully merging this pull request may close these issues.

3 participants