Skip to content

micropython/usb/usb-device/usb/device/core.py: adding alternate setting support plus a few fixes and improvements. #1030

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

Closed
wants to merge 2 commits into from

Conversation

HLammers
Copy link

@HLammers HLammers commented Jul 5, 2025

micropython/usb/usb-device/usb/device/core: adding alternate setting support plus a few fixes and improvements:

  • Removed import time (not used)
  • Removed unused/duplicate _Device.config argument config_str
  • Fixed the loop reserving other string indexes used by built-in drivers while len(strs) < builtin_driver.str_max: to while len(strs) < builtin\_driver.str\_max - 1: (row 169) because str_max equals to one more than the highest string descriptor index value used by any built-in descriptor according to the docs and added a comment that this loop is probably unnecessary or even wrong
  • Added bAlternateSetting as argument to Descriptor.interface, because it is used for USB MIDI 2.0
  • Some code optimisations

HLammers added 2 commits July 5, 2025 11:49
⦁	Removed `import time` (not used)
⦁	Removed unused/duplicate `_Device.config` argument `config_str`
⦁	Fixed the loop reserving other string indexes used by built-in drivers `while len(strs) < builtin_driver.str_max:` to `while len(strs) < builtin\_driver.str\_max - 1:` (row 169)because str_max equals to one more than the highest string descriptor index value used by any built-in descriptor according to the [docs](https://docs.micropython.org/en/latest/library/machine.USBDevice.html) and added a comment that this loop is probably unnecessary or even wrong
⦁	Added `bAlternateSetting` as argument to `Descriptor.interface`, because it is used for USB MIDI 2.0
⦁	Some code optimisations
Update fromatting
@HLammers HLammers changed the title Update micropython/usb/usb-device/usb/device/core.py micropython/usb/usb-device/usb/device/core.py: adding alternate setting support plus a few fixes and improvements Jul 5, 2025
@HLammers HLammers changed the title micropython/usb/usb-device/usb/device/core.py: adding alternate setting support plus a few fixes and improvements micropython/usb/usb-device/usb/device/core.py: adding alternate setting support plus a few fixes and improvements. Jul 5, 2025
@HLammers HLammers closed this Jul 5, 2025
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.

1 participant