-
Notifications
You must be signed in to change notification settings - Fork 143
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
base: develop
Are you sure you want to change the base?
Conversation
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
61e3fdd
to
ed78403
Compare
…with no vid/pid filtering
Also encourage -f/F on Windows, rather than a separate reboot
// also skip vid/pid filtering, as that should change in BOOTSEL mode, and could be white-labelled on RP2350 | ||
settings.pid = -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems slightly confusing that the comment-line talks about "vid/pid filtering", but the code-line only mentions settings.pid
?
// also skip vid/pid filtering, as that should change in BOOTSEL mode, and could be white-labelled on RP2350 | ||
settings.pid = -1; | ||
// still filter for rpi vid/pid if we don't have a serial number, as that is an RP2040 running a no_flash binary, so will | ||
// have a standard rpi vid/pid in BOOTSEL mode | ||
settings.vid = settings.ser.empty() ? -1 : 0; // 0 means skip vid/pid filtering entirely, -1 means filter for rpi vid/pid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps something like this is slightly less confusing? 🤷♂️
// also skip vid/pid filtering, as that should change in BOOTSEL mode, and could be white-labelled on RP2350 | |
settings.pid = -1; | |
// still filter for rpi vid/pid if we don't have a serial number, as that is an RP2040 running a no_flash binary, so will | |
// have a standard rpi vid/pid in BOOTSEL mode | |
settings.vid = settings.ser.empty() ? -1 : 0; // 0 means skip vid/pid filtering entirely, -1 means filter for rpi vid/pid | |
if (settings.ser.empty()) { | |
// still filter for rpi vid/pid if we don't have a serial number, as that is an RP2040 running a no_flash binary, so will | |
// have a standard rpi vid/pid in BOOTSEL mode | |
settings.vid = -1; // -1 means filter for rpi vid/pid | |
settings.pid = -1; | |
} else { | |
// also skip vid/pid filtering, as that should change in BOOTSEL mode, and could be white-labelled on RP2350 | |
settings.vid = 0; // 0 means skip vid/pid filtering entirely | |
settings.pid = -1; | |
} |
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? |
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. |
@@ -593,6 +594,7 @@ auto device_selection = | |||
(option("--vid") & integer("vid").set(settings.vid).if_missing([] { return "missing vid"; })) % "Filter by vendor id" + | |||
(option("--pid") & integer("pid").set(settings.pid)) % "Filter by product id" + | |||
(option("--ser") & value("ser").set(settings.ser)) % "Filter by serial number" | |||
+ option("--rp2040").set(settings.force_rp2040) % "Use RP2040 workarounds on Windows when using custom vid/pid (ignored on other platforms)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+ option("--rp2040").set(settings.force_rp2040) % "Use RP2040 workarounds on Windows when using custom vid/pid (ignored on other platforms)" | |
+ option("--rp2040").set(settings.force_rp2040) % "Use RP2040-specific workarounds when using a custom vid/pid on Windows (ignored on other platforms)" |
? (it niggled me slightly that "on other platforms" was so far away from "Windows", that it wasn't entirely clear what "other platforms" was referring to 😉 )
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