|
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('--msc_num_endpoint_pairs', type=int, default=1, |
| 36 | + help='Use 1 or 2 endpoint pairs for MSC (1 bidirectional, or 1 input + 1 output (required by SAMD21))') |
35 | 37 | parser.add_argument('--output_c_file', type=argparse.FileType('w'), required=True) |
36 | 38 | parser.add_argument('--output_h_file', type=argparse.FileType('w'), required=True) |
37 | 39 |
|
|
45 | 47 | if unknown_hid_devices: |
46 | 48 | raise ValueError("Unknown HID devices(s)", unknown_hid_devices) |
47 | 49 |
|
| 50 | +if args.msc_num_endpoint_pairs not in (1, 2): |
| 51 | + raise ValueError("--msc_num_endpoint_pairs must be 1 or 2") |
| 52 | + |
48 | 53 |
|
49 | 54 | class StringIndex: |
50 | 55 | """Assign a monotonically increasing index to each unique string. Start with 0.""" |
@@ -153,7 +158,9 @@ def strings_in_order(cls): |
153 | 158 | bInterval=0), |
154 | 159 | standard.EndpointDescriptor( |
155 | 160 | description="MSC out", |
156 | | - bEndpointAddress=0x1 | standard.EndpointDescriptor.DIRECTION_OUT, |
| 161 | + # SAMD21 needs to use a separate pair of endpoints for MSC. |
| 162 | + bEndpointAddress=((0x1 if args.msc_num_endpoint_pairs == 2 else 0x0) | |
| 163 | + standard.EndpointDescriptor.DIRECTION_OUT), |
157 | 164 | bmAttributes=standard.EndpointDescriptor.TYPE_BULK, |
158 | 165 | bInterval=0) |
159 | 166 | ] |
|
0 commit comments