Skip to content
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

Auto-detect a wider range of RP2040 devices #257

Merged

Conversation

rtyley
Copy link
Contributor

@rtyley rtyley commented Nov 11, 2023

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:

image

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 large 0x1000 - 0x1fff range which Raspberry Pi sub-license.

Not all of the devices in the 0x1000 - 0x1fff range actually run MicroPython (eg 0x1069, 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

  • The 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 filtering
  • In MicroPythonDeviceProvider, the fixed list of usbIds is replaced with replaced with a checkUsbId() method - this is used to filter the list of usb ids returned by findusb.py. This lets us accept much wider ranges of usb ids without having to define 100s of 'known' MicroPythonUsbIds.

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.

@rtyley rtyley force-pushed the auto-detect-a-wider-range-of-rp2040-devices branch 2 times, most recently from 7ffad7b to e141e93 Compare November 11, 2023 10:53
@rtyley rtyley force-pushed the auto-detect-a-wider-range-of-rp2040-devices branch from e141e93 to 8151af4 Compare November 11, 2023 14:00
@rtyley rtyley marked this pull request as ready for review November 11, 2023 18:21
@rtyley
Copy link
Contributor Author

rtyley commented Nov 11, 2023

Thanks for the thumbs up @lancelote - I've now signed the JetBrains Contributor License Agreement (CLA) - if the change looks good to you that's great, please merge!

I've tested the changes locally with a Pimoroni Pico LiPo, and they work as intended.

@lancelote lancelote merged commit c17598d into JetBrains:master Nov 15, 2023
@lancelote
Copy link
Member

@rtyley Thank you for the excellent contribution 👍

@rtyley
Copy link
Contributor Author

rtyley commented Nov 15, 2023

Ah wonderful, thank you!

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.

None yet

3 participants