support icon indicating copy to clipboard operation
support copied to clipboard

Web DFU not working in Chromium when installed as snap

Open ChristophGaukel opened this issue 4 years ago • 18 comments

I bought a mindstorms inventor (Set 51515), then I downloaded the Spike Prime App and updated the firmware. Now the hub works well with the Spike Prime App, but no more with the Mindstorms Inventor App (it does not connect anymore).

I followed the instructions in https://dfu.pybricks.com (both in win10 and Linux), but the "Find Device" button does not find my device.

When I use terminal command lsusb (under Linux), then I see the device and it is in DFU mode:

Bus 001 Device 009: ID 0694:0011 Lego Group LEGO Technic Large Hub in DFU Mode

What can I do, to reinstall the mindstorms inventor firmware?

ChristophGaukel avatar Aug 11 '21 13:08 ChristophGaukel

If you never installed Pybricks on this hub, then I would suggest getting in touch with LEGO customer support so that they are aware of the issue.

But you should be able to use our tools to help you get unstuck anyway. To be able to use the hub without root permission on Linux, you need to install udev rules for it, then unplug it and plug it back in.

dlech avatar Aug 11 '21 14:08 dlech

Thanks for your fast reaction!

Using chromium instead of Firefox makes a difference! When I use chromium, then I can see and select my device. But when I try to connect, I get: SecurityError: Access denied. This happens even though I did define the udev rules.

ChristophGaukel avatar Aug 11 '21 17:08 ChristophGaukel

Maybe there was a mistake in copying the rules? Or you didn't unplug/replug so that the rules take effect? I just tried it and it worked for me.

Also, I just published a pbrick-rules Ubuntu package which may help (README has command for non-Ubuntu install too).

dlech avatar Aug 11 '21 17:08 dlech

And if all else fails, try rebooting everything.

dlech avatar Aug 11 '21 17:08 dlech

thanks for your fast reply, but I already did reboot both devices (multiple times).

terminal command: cat /etc/udev/rules.d/99-pybricksdev.rules replies with:

# Pybrickdev rules for LEGO programmable bricks

# MINDSTORMS NXT brick 
SUBSYSTEM=="usb", ATTRS{idVendor}=="0694", ATTRS{idProduct}=="0002", MODE="0666"

# MINDSTORMS NXT brick in firmware update mode (Atmel SAM-BA mode)
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="6124", MODE="0666"

# MINDSTORMS EV3 brick
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="0694", ATTRS{idProduct}=="0005", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0694", ATTRS{idProduct}=="0005", MODE="0666"

# MINDSTORMS EV3 brick in firmware update mode
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="0694", ATTRS{idProduct}=="0006", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0694", ATTRS{idProduct}=="0006", MODE="0666"

# SPIKE Prime hub in firmware update mode (DFU mode)
SUBSYSTEM=="usb", ATTRS{idVendor}=="0694", ATTRS{idProduct}=="0008", MODE="0666"

This is an exact copy of your file! I tested with my EV3 device and the rule works correctly.

Is there a chance to do the firmware update with terminal commands instead of the browser?

ChristophGaukel avatar Aug 11 '21 17:08 ChristophGaukel

Yes.

sudo apt update && sudo apt install dfu-util
dfu-util --alt 0 --dfuse-addr 0x08008000 --download some_firmware.bin

dlech avatar Aug 11 '21 17:08 dlech

Thanks! I did download file: -rw-rw-r-- 1 christoph christoph 622592 Aug 11 18:21 /home/christoph/Downloads/firmware-backup-v1.2.01.0103-d08b6f.bin

terminal command "dfu-util -l" replies:

dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Found DFU: [0694:0011] ver=0100, devnum=10, cfg=1, intf=0, path="1-1.2", alt=3, name="UNKNOWN", serial="3261385C3338"
Found DFU: [0694:0011] ver=0100, devnum=10, cfg=1, intf=0, path="1-1.2", alt=2, name="UNKNOWN", serial="3261385C3338"
Found DFU: [0694:0011] ver=0100, devnum=10, cfg=1, intf=0, path="1-1.2", alt=1, name="UNKNOWN", serial="3261385C3338"
Found DFU: [0694:0011] ver=0100, devnum=10, cfg=1, intf=0, path="1-1.2", alt=0, name="@LEGO LES HUB /0x08000000/02*016Ka,02*016Kg,01*064Kg,07*128Kg/0x10000000/01*1Ma/0x10100000/31*1Ma", serial="3261385C3338"

And I expect the command to load the firmware is: "dfu-util -d 0604:0011 -D /home/christoph/Downloads/firmware-backup-v1.2.01.0103-d08b6f.bin"

ChristophGaukel avatar Aug 11 '21 17:08 ChristophGaukel

See edited command above. There are additional required args.

dlech avatar Aug 11 '21 17:08 dlech

thanks a lot!

command dfu-util did successfully load the firmware and the Mindstorms Inventor App then did recognize the device and update the firmware to the newest version.

Here is the command line of dfu-util:

dfu-util --alt 0 --dfuse-addr 0x08008000 --download ~/Downloads/firmware-backup-v1.2.01.0103-d08b6f.bin

And here its output:

dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0694:0011
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "LEGO LES HUB "
Downloading to address = 0x08008000, size = 622592
Download	[=========================] 100%       622592 bytes

ChristophGaukel avatar Aug 11 '21 18:08 ChristophGaukel

I hope you don’t mind me asking a few more questions even though you’ve found a fix.

Did you install Chromium as a snap package or in another way?

Does it still produce the error if you enable the “enable-experimental-web-platform-features” flag in chrome://flags ?

laurensvalk avatar Aug 11 '21 18:08 laurensvalk

My chromium was installed via snap, terminal command: "which chromium" replies: /snap/bin/chromium

Enabling the “enable-experimental-web-platform-features” flag in chrome://flags does not change the behavior. As before I get: SecurityError: Access denied.

ChristophGaukel avatar Aug 11 '21 20:08 ChristophGaukel

Thanks for your response. This helps us improve those pages.

While it works fine for me on Ubuntu 18.04, I have the same issue on Ubuntu 20.04. On that laptop, it does work when installing Google Chrome.

I think we had something similar with Bluetooth support in the Chromium snap for a while, but that has since been fixed. Not sure if this is related.

laurensvalk avatar Aug 11 '21 20:08 laurensvalk

My computer system is Ubuntu 21.04. I did install Google Chrome and indeed, the browser not only finds the device, it also connects and prints:

Name: LEGO Technic Large Hub in DFU Mode Manufacturer: LEGO System A/S

Once again: thanks for your great support!

ChristophGaukel avatar Aug 12 '21 12:08 ChristophGaukel

Duplicate of #410?

dlech avatar Aug 12 '21 15:08 dlech

This has gotten a bit better. Chromium as a snap now sees the device. But still gives this error:

image

laurensvalk avatar Nov 20 '23 08:11 laurensvalk

https://bugs.launchpad.net/ubuntu/+source/chromium-browser/+bug/1905457

There is a solution to give Chromium access! :rocket:

sudo snap connect chromium:raw-usb

So we need to add that to: https://pybricks.com/projects/tutorials/dev/tools/linux/

And probably improve this error message so that on Linux, this takes you to that doc page.

laurensvalk avatar Nov 20 '23 08:11 laurensvalk

We had to make a formal request to get Bluetooth enabled by default: https://forum.snapcraft.io/t/request-to-autoconnect-chromium-to-bluez/18856

So maybe we can do the same for usb-raw?

dlech avatar Nov 20 '23 16:11 dlech

So we need to add that to: https://pybricks.com/projects/tutorials/dev/tools/linux/

Done as an intermediate solution via https://github.com/pybricks/pybricks-projects/commit/9ccd119331820f4f30eb040e970fb1616c42615d.

laurensvalk avatar Jan 18 '24 13:01 laurensvalk