Auto-detect a wider range of RP2040 devices #257
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At the moment, the device-path detection for Raspberry Pi USB devices only recognises one specific id:
2E8A:0005
, the vanilla Raspberry Pi Pico running MicroPython firmware:Plethora of RP2040 devices...
However, there are many devices using the RP2040 that are similar to the Raspberry Pi Pico and run MicroPython in the same way (Adafruit Feather RP2040, Pimoroni Badger 2040, Raspberry Breadstick, etc) - these all use the same vendor id as the Pico (
2E8A
), but have different product ids from the large0x1000
-0x1fff
range which Raspberry Pi sub-license.Not all of the devices in the
0x1000
-0x1fff
range actually run MicroPython (eg0x1069
, the Zoid Technology Matrix, runs QMK firmware and quite possibly doesn't have a MicroPython build), but if it's plugged into a developers machine and they're trying to access MicroPython on it, it probably does.Changes made in this PR
findusb.py
Python script is now much shorter, and no longer takes target usb ids as an argument - it just outputs the full list of attached usb devices (the list is unlikely to be very long - say, fewer than 100 devices) and allows the Kotlin code to do the filteringMicroPythonDeviceProvider
, the fixed list ofusbIds
is replaced with replaced with acheckUsbId()
method - this is used to filter the list of usb ids returned byfindusb.py
. This lets us accept much wider ranges of usb ids without having to define 100s of 'known'MicroPythonUsbId
s.See https://github.com/raspberrypi/usb-pid#assignment - Raspberry Pi have allocated the productId range 0x1000 - 0x1fff for Commercial RP2040 devices, of which they have allocated over 100 ids as of 2023.