|
32 | 32 | help='devices to include in descriptor (AUDIO includes MIDI support)') |
33 | 33 | parser.add_argument('--hid_devices', type=lambda l: tuple(l.split(',')), default=DEFAULT_HID_DEVICES, |
34 | 34 | help='HID devices to include in HID report descriptor') |
35 | | -parser.add_argument('--relative_ep_num', type=int, default=1, |
| 35 | +parser.add_argument('--renumber_endpoints', type=int, default=1, |
36 | 36 | help='use relative(1) or absolute(0) endpoint number') |
37 | 37 | parser.add_argument('--cdc_ep_num_notification', type=int, default=0, |
38 | 38 | help='endpoint number of CDC NOTIFICATION') |
|
63 | 63 | if unknown_hid_devices: |
64 | 64 | raise ValueError("Unknown HID devices(s)", unknown_hid_devices) |
65 | 65 |
|
| 66 | +if not args.renumber_endpoints: |
| 67 | + if 'CDC' in args.devices: |
| 68 | + if (args.cdc_ep_num_notification == 0 or args.cdc_ep_num_data_out == 0 or |
| 69 | + args.cdc_ep_num_data_in == 0): |
| 70 | + raise ValueError("Endpoint address must not be 0") |
| 71 | + |
| 72 | + if 'MSC' in args.devices: |
| 73 | + if args.msc_ep_num_out == 0 or args.msc_ep_num_in == 0: |
| 74 | + raise ValueError("Endpoint address must not be 0") |
| 75 | + |
| 76 | + if 'HID' in args.devices: |
| 77 | + if args.hid_ep_num_in == 0: |
| 78 | + raise ValueError("Endpoint address must not be 0") |
| 79 | + |
| 80 | + if 'AUDIO' in args.devices: |
| 81 | + if args.midi_ep_num_out == 0 or args.midi_ep_num_in == 0: |
| 82 | + raise ValueError("Endpoint address must not be 0") |
| 83 | + |
66 | 84 | class StringIndex: |
67 | 85 | """Assign a monotonically increasing index to each unique string. Start with 0.""" |
68 | 86 | string_to_index = {} |
@@ -323,15 +341,10 @@ def strings_in_order(cls): |
323 | 341 | if 'AUDIO' in args.devices: |
324 | 342 | interfaces_to_join.append(audio_interfaces) |
325 | 343 |
|
326 | | -if args.relative_ep_num: |
327 | | - # util.join_interfaces() will renumber the endpoints to make them unique across descriptors, |
328 | | - # and renumber the interfaces in order. But we still need to fix up certain |
329 | | - # interface cross-references. |
330 | | - interfaces = util.join_interfaces(*interfaces_to_join) |
331 | | -else: |
332 | | - # util.renumbers_interfaces() will renumber the interfaces in order. But we still need to |
333 | | - # fix up certain interface cross-references. |
334 | | - interfaces = util.renumbers_interfaces(*interfaces_to_join) |
| 344 | +# util.join_interfaces() will renumber the endpoints to make them unique across descriptors, |
| 345 | +# and renumber the interfaces in order. But we still need to fix up certain |
| 346 | +# interface cross-references. |
| 347 | +interfaces = util.join_interfaces(interfaces_to_join, renumber_endpoints=args.renumber_endpoints) |
335 | 348 |
|
336 | 349 | # Now adjust the CDC interface cross-references. |
337 | 350 |
|
|
0 commit comments