Skip to content

50-snagboot.rules: add support for "Toradex USB download gadget" #61

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

michaelopdenacker
Copy link

Tested on Toradex Verdin iMX8MM Mini V1.1D in Dahlia V1.1D carrier board

Tested on Toradex Verdin iMX8MM Mini V1.1D in Dahlia V1.1D carrier board

Signed-off-by: Michael Opdenacker <[email protected]>
@michaelopdenacker
Copy link
Author

For your information, the "snagrecover" command executes correctly (which was not the case before applying the proposed changes), but there are still errors during execution:

snagrecover -s imx8mm -f imx8-verdin-mx8m-mini.yaml
2025-05-23 11:34:00,304 [INFO] Starting recovery of imx8mm board
2025-05-23 11:34:00,362 [INFO] HID device 1-2 has hidraw dev /dev/hidraw0
2025-05-23 11:34:00,362 [INFO] Finished initializing HID device {pretty_addr}
2025-05-23 11:34:00,363 [INFO] Installing firmware flash-bin
2025-05-23 11:34:00,364 [INFO] Subfirmware: spl
2025-05-23 11:34:00,366 [INFO] Downloading firmware flash-bin...
2025-05-23 11:34:00,366 [INFO] Downloading file...
2025-05-23 11:34:00,424 [INFO] write_blob finished with complete status b'\x88\x88\x88\x88'
2025-05-23 11:34:00,424 [INFO] Done
2025-05-23 11:34:00,424 [INFO] Skipping DCD header...
2025-05-23 11:34:00,424 [INFO] Skipping DCD...
2025-05-23 11:34:00,424 [INFO] Sending SKIP_DCD_HEADER command
2025-05-23 11:34:00,427 [INFO] Done skipping DCD
2025-05-23 11:34:00,427 [INFO] Done
2025-05-23 11:34:00,427 [INFO] Jumping to firmware flash-bin
2025-05-23 11:34:00,427 [INFO] Jumping to flash-bin...
2025-05-23 11:34:00,854 [WARNING] Caught (USB/HID)Error [Errno 5] Input/output error
2025-05-23 11:34:00,854 [INFO] Done installing firmware flash-bin
2025-05-23 11:34:00,854 [INFO] SDP command sequence done, closing hid device...
2025-05-23 11:34:00,855 [INFO] Waiting for SPL device...
2025-05-23 11:34:00,868 [WARNING] Failed to get configuration descriptor for device at 1-2!
2025-05-23 11:34:00,868 [INFO] USB retry 1/9
2025-05-23 11:34:01,868 [INFO] Found USB device at 1-2 for SPL stage!
2025-05-23 11:34:01,922 [INFO] HID device 1-2 has hidraw dev /dev/hidraw0
2025-05-23 11:34:01,922 [INFO] Finished initializing HID device {pretty_addr}
2025-05-23 11:34:01,923 [INFO] Installing firmware flash-bin
2025-05-23 11:34:01,923 [INFO] Subfirmware: u-boot
2025-05-23 11:34:01,923 [INFO] Downloading firmware flash-bin...
2025-05-23 11:34:01,923 [INFO] Downloading file...
2025-05-23 11:34:03,420 [INFO] write_blob finished with complete status b'\x88\x88\x88\x88'
2025-05-23 11:34:03,420 [INFO] Done
Jumping to firmware...
2025-05-23 11:34:03,510 [WARNING] Caught (USB/HID)Error [Errno 5] Input/output error
2025-05-23 11:34:03,510 [INFO] Done installing firmware flash-bin
2025-05-23 11:34:03,511 [INFO] DONE
2025-05-23 11:34:03,511 [INFO] Done recovering imx8mm board
2025-05-23 11:34:03,511 [INFO] Done recovering imx8mm board

There could be issues with my flashing image too (work in progress).
At least the proposed improvement should be valid and would help people trying to use Snagboot on Toradex i.MX8 boards.

@rgantois
Copy link
Collaborator

Hello Michael, thanks for the PR.

Could you please elaborate on what kind of issues you've encountered before applying this udev rule? Snagrecover only needs a udev rule for the ROM code stage of the recovery process. There is already a rule in place for i.MX8MM ROM code gadgets, so I'm a bit confused as to why you'd need an additional rule. Some logs of your previous errors would help.

On the other hand, if this USB gadget is only used in the flashing stage, then it's out of scope for snagrecover, and shouldn't be included in these udev rules. We voluntarily avoid writing udev rules for flashing gadgets because their VID:PID pairs can be customized at will by vendors, so we can't reasonably write rules for all of them.

@michaelopdenacker
Copy link
Author

Hi Romain
Thanks for having a look and for these details...
Here are the errors I'm getting without the rules I proposed, which seemed to help..

snagrecover -s imx8mm -f imx8-verdin-mx8m-mini.yaml
2025-05-27 11:11:23,527 [INFO] Starting recovery of imx8mm board
2025-05-27 11:11:23,594 [INFO] HID device 1-2 has hidraw dev /dev/hidraw0
2025-05-27 11:11:23,594 [INFO] Finished initializing HID device {pretty_addr}
2025-05-27 11:11:23,599 [INFO] Installing firmware flash-bin
2025-05-27 11:11:23,599 [INFO] Subfirmware: spl
2025-05-27 11:11:23,601 [INFO] Downloading firmware flash-bin...
2025-05-27 11:11:23,601 [INFO] Downloading file...
2025-05-27 11:11:23,661 [INFO] write_blob finished with complete status b'\x88\x88\x88\x88'
2025-05-27 11:11:23,661 [INFO] Done
2025-05-27 11:11:23,661 [INFO] Skipping DCD header...
2025-05-27 11:11:23,662 [INFO] Skipping DCD...
2025-05-27 11:11:23,662 [INFO] Sending SKIP_DCD_HEADER command
2025-05-27 11:11:23,665 [INFO] Done skipping DCD
2025-05-27 11:11:23,665 [INFO] Done
2025-05-27 11:11:23,666 [INFO] Jumping to firmware flash-bin
2025-05-27 11:11:23,666 [INFO] Jumping to flash-bin...
2025-05-27 11:11:24,093 [WARNING] Caught (USB/HID)Error [Errno 5] Input/output error
2025-05-27 11:11:24,094 [INFO] Done installing firmware flash-bin
2025-05-27 11:11:24,094 [INFO] SDP command sequence done, closing hid device...
2025-05-27 11:11:24,098 [INFO] Waiting for SPL device...
2025-05-27 11:11:24,113 [WARNING] Failed to get configuration descriptor for device at 1-2!
2025-05-27 11:11:24,113 [INFO] USB retry 1/9
2025-05-27 11:11:25,114 [WARNING] Failed to get configuration descriptor for device at 1-2!
2025-05-27 11:11:25,115 [INFO] USB retry 2/9
2025-05-27 11:11:26,116 [WARNING] Failed to get configuration descriptor for device at 1-2!
2025-05-27 11:11:26,116 [INFO] USB retry 3/9
2025-05-27 11:11:27,118 [WARNING] Failed to get configuration descriptor for device at 1-2!
2025-05-27 11:11:27,118 [INFO] USB retry 4/9
2025-05-27 11:11:28,119 [WARNING] Failed to get configuration descriptor for device at 1-2!
2025-05-27 11:11:28,120 [INFO] USB retry 5/9
2025-05-27 11:11:29,121 [WARNING] Failed to get configuration descriptor for device at 1-2!
2025-05-27 11:11:29,121 [INFO] USB retry 6/9
2025-05-27 11:11:30,123 [WARNING] Failed to get configuration descriptor for device at 1-2!
2025-05-27 11:11:30,123 [INFO] USB retry 7/9
2025-05-27 11:11:31,125 [WARNING] Failed to get configuration descriptor for device at 1-2!
2025-05-27 11:11:31,125 [INFO] USB retry 8/9
2025-05-27 11:11:32,126 [WARNING] Failed to get configuration descriptor for device at 1-2!
2025-05-27 11:11:32,127 [INFO] USB retry 9/9
2025-05-27 11:11:33,128 [WARNING] Failed to get configuration descriptor for device at 1-2!
2025-05-27 11:11:33,128 [INFO] USB retry 10/9
2025-05-27 11:11:35,129 [ERROR] Device access error: failed to access SPL USB HID device 1-2, please check its presence and access rights

Happy to run as many tests as needed and to contribute to Snagboot if I can.

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.

2 participants