Skip to content

Improve forced commands for RP2040 and custom vid/pid #263

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 10 commits into
base: develop
Choose a base branch
from

Conversation

will-v-pi
Copy link
Contributor

@will-v-pi will-v-pi commented Jul 22, 2025

Allow forced commands with RP2040 on Windows - they will not deactivate the mass storage device, to ensure Zadig still works

Also fix forced commands with custom vid/pid (as they will change in bootsel mode), by removing vid/pid filters after reboot and just filtering on serial number

Fixes #260 and #261

@will-v-pi will-v-pi added this to the 2.3.0 milestone Jul 22, 2025
@will-v-pi will-v-pi changed the title Remove vid/pid filter when using forced commands Improve forced commands for RP2040 and custom vid/pid Aug 6, 2025
@lurch
Copy link
Contributor

lurch commented Aug 7, 2025

I think the "Use RP2040 workarounds on Windows when using custom vid/pid (ignored on other platforms)" stuff is assuming that if you're running a UF2 on an RP2350 with a custom VID/PID, then you'll have also modified the RP2350's OTP to report the same VID/PID in BOOTSEL mode? But I guess that might not always be the case? 🤔

@will-v-pi
Copy link
Contributor Author

I think the "Use RP2040 workarounds on Windows when using custom vid/pid (ignored on other platforms)" stuff is assuming that if you're running a UF2 on an RP2350 with a custom VID/PID, then you'll have also modified the RP2350's OTP to report the same VID/PID in BOOTSEL mode? But I guess that might not always be the case? 🤔

Nope, the workaround is just to not disable the MSD, nothing to do with the actual vid/pid - if you have RP2040 stdio_usb vid/pid it autodetects that and does it automatically, but if you're using custom vid/pid then you need to tell it you have an RP2040 as it can't detect it from the vid/pid

@lurch
Copy link
Contributor

lurch commented Aug 7, 2025

I think the "Use RP2040 workarounds on Windows when using custom vid/pid (ignored on other platforms)" stuff is assuming that if you're running a UF2 on an RP2350 with a custom VID/PID, then you'll have also modified the RP2350's OTP to report the same VID/PID in BOOTSEL mode? But I guess that might not always be the case? 🤔

Nope, the workaround is just to not disable the MSD, nothing to do with the actual vid/pid - if you have RP2040 stdio_usb vid/pid it autodetects that and does it automatically, but if you're using custom vid/pid then you need to tell it you have an RP2040 as it can't detect it from the vid/pid

Okay, and how is the situation different on RP2350?

@will-v-pi
Copy link
Contributor Author

Okay, and how is the situation different on RP2350?

RP2350 bootrom has the correct MS_OS_20 USB descriptors so works on Windows out of the box - whereas RP2040 doesn’t so requires drivers installed by Zadig, which only work properly when the RP2040 in bootsel mode has the MSD enabled

@lurch
Copy link
Contributor

lurch commented Aug 7, 2025

RP2350 bootrom has the correct MS_OS_20 USB descriptors so works on Windows out of the box - whereas RP2040 doesn’t so requires drivers installed by Zadig, which only work properly when the RP2040 in bootsel mode has the MSD enabled

Ahhhh! I knew it'd probably be something obvious that I'd forgotten 😂 Thanks for the explanation.

The vid/pid will typically change when switching to BOOTSEL mode, so remove those filters and just filter on serial number if present

Fixes #261
Calling GET_INFO when not available sometimes causes issues with forced commands

Also improve libusb error messages when debugging
Also encourage -f/F on Windows, rather than a separate reboot
will-v-pi and others added 4 commits August 14, 2025 11:41
Co-authored-by: Andrew Scheller <[email protected]>
This is cleaner than directing to a document name that must then be searched for the word Zadig
Co-authored-by: Andrew Scheller <[email protected]>
@will-v-pi will-v-pi marked this pull request as ready for review August 14, 2025 12:20
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