Skip to content

Commit 4eb11fb

Browse files
authored
Merge pull request #2198 from kamtom480/circuitpython-msc-max-packet-size
Add a way to change max packet size for MSC
2 parents 45c57db + ef42abb commit 4eb11fb

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

supervisor/supervisor.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ ifndef USB_MSC_NUM_ENDPOINT_PAIRS
9999
USB_MSC_NUM_ENDPOINT_PAIRS = 1
100100
endif
101101

102+
ifndef USB_MSC_MAX_PACKET_SIZE
103+
USB_MSC_MAX_PACKET_SIZE = 64
104+
endif
105+
102106
SUPERVISOR_O = $(addprefix $(BUILD)/, $(SRC_SUPERVISOR:.c=.o)) $(BUILD)/autogen_display_resources.o
103107

104108
$(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h
@@ -119,6 +123,7 @@ autogen_usb_descriptor.intermediate: ../../tools/gen_usb_descriptor.py Makefile
119123
--devices $(USB_DEVICES)\
120124
--hid_devices $(USB_HID_DEVICES)\
121125
--msc_num_endpoint_pairs $(USB_MSC_NUM_ENDPOINT_PAIRS)\
126+
--msc_max_packet_size $(USB_MSC_MAX_PACKET_SIZE)\
122127
--output_c_file $(BUILD)/autogen_usb_descriptor.c\
123128
--output_h_file $(BUILD)/genhdr/autogen_usb_descriptor.h
124129

tools/gen_usb_descriptor.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
help='HID devices to include in HID report descriptor')
3535
parser.add_argument('--msc_num_endpoint_pairs', type=int, default=1,
3636
help='Use 1 or 2 endpoint pairs for MSC (1 bidirectional, or 1 input + 1 output (required by SAMD21))')
37+
parser.add_argument('--msc_max_packet_size', type=int, default=64,
38+
help='Max packet size for MSC')
3739
parser.add_argument('--output_c_file', type=argparse.FileType('w'), required=True)
3840
parser.add_argument('--output_h_file', type=argparse.FileType('w'), required=True)
3941

@@ -155,14 +157,16 @@ def strings_in_order(cls):
155157
description="MSC in",
156158
bEndpointAddress=0x0 | standard.EndpointDescriptor.DIRECTION_IN,
157159
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
158-
bInterval=0),
160+
bInterval=0,
161+
wMaxPacketSize=args.msc_max_packet_size),
159162
standard.EndpointDescriptor(
160163
description="MSC out",
161164
# SAMD21 needs to use a separate pair of endpoints for MSC.
162165
bEndpointAddress=((0x1 if args.msc_num_endpoint_pairs == 2 else 0x0) |
163166
standard.EndpointDescriptor.DIRECTION_OUT),
164167
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
165-
bInterval=0)
168+
bInterval=0,
169+
wMaxPacketSize=args.msc_max_packet_size)
166170
]
167171
)
168172
]

0 commit comments

Comments
 (0)