Skip to content

Add an alternative way to number the USB endpoints #2189

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

Merged
merged 8 commits into from
Oct 8, 2019

Conversation

kamtom480
Copy link

Two options available:

  • relative numbering (USB_RELATIVE_EP_NUM = 1) - default
  • absolute numbering (USB_RELATIVE_EP_NUM = 0) - new!

It needs: adafruit/usb_descriptor#8

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good! I like how it can simplify SAMD21 MSC too. One naming suggestion and a couple of other suggestions on the other PR.

@kamtom480
Copy link
Author

Thank you for your feedback! I have added changes according to your suggestions.

Two options available:
- relative numbering (USB_RELATIVE_EP_NUM = 1) - default
- absolute numbering (USB_RELATIVE_EP_NUM = 0) - new!
@kamtom480 kamtom480 force-pushed the circuitpython-number-endpoint branch from 1dc00f9 to 1205d3e Compare October 7, 2019 11:36
@kamtom480 kamtom480 requested review from tannewt and dhalbert October 7, 2019 19:12
tannewt
tannewt previously approved these changes Oct 7, 2019
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you!

@tannewt
Copy link
Member

tannewt commented Oct 7, 2019

@dhalbert please re-review and merge if it looks ok. Thanks!

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just minor style stuff.

Comment on lines 69 to 84
if 'CDC' in args.devices:
if (args.cdc_ep_num_notification == 0 or args.cdc_ep_num_data_out == 0 or
args.cdc_ep_num_data_in == 0):
raise ValueError("Endpoint address must not be 0")

if 'MSC' in args.devices:
if args.msc_ep_num_out == 0 or args.msc_ep_num_in == 0:
raise ValueError("Endpoint address must not be 0")

if 'HID' in args.devices:
if args.args.hid_ep_num_out == 0 or args.hid_ep_num_in == 0:
raise ValueError("Endpoint address must not be 0")

if 'AUDIO' in args.devices:
if args.midi_ep_num_out == 0 or args.midi_ep_num_in == 0:
raise ValueError("Endpoint address must not be 0")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the specific endpoint names here? We don't need to save space. E.g. "CDC Endpoint address must not be 0".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

parser.add_argument('--msc_num_endpoint_pairs', type=int, default=1,
help='Use 1 or 2 endpoint pairs for MSC (1 bidirectional, or 1 input + 1 output (required by SAMD21))')
parser.add_argument('--renumber_endpoints', type=int, default=1,
help='use relative(1) or absolute(0) endpoint number')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not too important, but a nice style for boolean argparse arguments is given here: https://stackoverflow.com/a/15008806/142996

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@kamtom480
Copy link
Author

The way to disable and enable endpoint renumbering has been changed. Now instead of using '--renumber-endpoint 1' or '--renumber-endpoint 0' we can use the '--no-renumber_endpoint' argument to disable renumbering. By default, endpoints are renumbered without providing this argument.

@kamtom480 kamtom480 requested a review from dhalbert October 8, 2019 08:14
Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you!

@dhalbert dhalbert merged commit cc3e0a0 into adafruit:master Oct 8, 2019
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.

3 participants