Skip to content

Commit 6063828

Browse files
committed
replace USB_MSC_MAX_PACKET_SIZE with USB_HIGHSPEED in descriptor gen tool
1 parent debbf10 commit 6063828

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

ports/cxd56/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
USB_SERIAL_NUMBER_LENGTH = 10
2-
USB_MSC_MAX_PACKET_SIZE = 512
2+
USB_HIGHSPEED = 1
33
USB_RENUMBER_ENDPOINTS = 0
44
USB_CDC_EP_NUM_NOTIFICATION = 3
55
USB_CDC_EP_NUM_DATA_OUT = 2

ports/mimxrt10xx/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ endif
1515
INTERNAL_LIBM = 1
1616

1717
USB_SERIAL_NUMBER_LENGTH = 32
18-
USB_MSC_MAX_PACKET_SIZE = 512
18+
USB_HIGHSPEED = 1
1919

2020
INTERNAL_FLASH_FILESYSTEM = 1
2121

supervisor/supervisor.mk

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ ifndef USB_HID_DEVICES
129129
USB_HID_DEVICES = "KEYBOARD,MOUSE,CONSUMER,GAMEPAD"
130130
endif
131131

132-
ifndef USB_MSC_MAX_PACKET_SIZE
133-
USB_MSC_MAX_PACKET_SIZE = 64
132+
ifndef USB_HIGHSPEED
133+
USB_HIGHSPEED = 0
134134
endif
135135

136136
ifndef USB_CDC_EP_NUM_NOTIFICATION
@@ -178,7 +178,6 @@ USB_DESCRIPTOR_ARGS = \
178178
--interface_name $(USB_INTERFACE_NAME)\
179179
--devices $(USB_DEVICES)\
180180
--hid_devices $(USB_HID_DEVICES)\
181-
--msc_max_packet_size $(USB_MSC_MAX_PACKET_SIZE)\
182181
--cdc_ep_num_notification $(USB_CDC_EP_NUM_NOTIFICATION)\
183182
--cdc_ep_num_data_out $(USB_CDC_EP_NUM_DATA_OUT)\
184183
--cdc_ep_num_data_in $(USB_CDC_EP_NUM_DATA_IN)\
@@ -195,6 +194,10 @@ ifeq ($(USB_RENUMBER_ENDPOINTS), 0)
195194
USB_DESCRIPTOR_ARGS += --no-renumber_endpoints
196195
endif
197196

197+
ifeq ($(USB_HIGHSPEED), 1)
198+
USB_DESCRIPTOR_ARGS += --highspeed
199+
endif
200+
198201
$(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h
199202

200203
$(BUILD)/autogen_usb_descriptor.c $(BUILD)/genhdr/autogen_usb_descriptor.h: autogen_usb_descriptor.intermediate

tools/gen_usb_descriptor.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
DEFAULT_HID_DEVICES='KEYBOARD,MOUSE,CONSUMER,GAMEPAD'
2424

2525
parser = argparse.ArgumentParser(description='Generate USB descriptors.')
26+
parser.add_argument('--highspeed', default=False, action='store_true',
27+
help='descriptor for highspeed device')
2628
parser.add_argument('--manufacturer', type=str,
2729
help='manufacturer of the device')
2830
parser.add_argument('--product', type=str,
@@ -40,8 +42,6 @@
4042
parser.add_argument('--interface_name', type=str,
4143
help='The name/prefix to use in the interface descriptions',
4244
default=DEFAULT_INTERFACE_NAME)
43-
parser.add_argument('--msc_max_packet_size', type=int, default=64,
44-
help='Max packet size for MSC')
4545
parser.add_argument('--no-renumber_endpoints', dest='renumber_endpoints', action='store_false',
4646
help='use to not renumber endpoint')
4747
parser.add_argument('--cdc_ep_num_notification', type=int, default=0,
@@ -185,11 +185,15 @@ def strings_in_order(cls):
185185
standard.EndpointDescriptor(
186186
description="CDC data out",
187187
bEndpointAddress=args.cdc_ep_num_data_out | standard.EndpointDescriptor.DIRECTION_OUT,
188-
bmAttributes=standard.EndpointDescriptor.TYPE_BULK),
188+
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
189+
bInterval=0,
190+
wMaxPacketSize=512 if args.highspeed else 64),
189191
standard.EndpointDescriptor(
190192
description="CDC data in",
191193
bEndpointAddress=args.cdc_ep_num_data_in | standard.EndpointDescriptor.DIRECTION_IN,
192-
bmAttributes=standard.EndpointDescriptor.TYPE_BULK),
194+
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
195+
bInterval=0,
196+
wMaxPacketSize=512 if args.highspeed else 64),
193197
])
194198

195199
cdc_interfaces = [cdc_comm_interface, cdc_data_interface]
@@ -207,13 +211,13 @@ def strings_in_order(cls):
207211
bEndpointAddress=args.msc_ep_num_in | standard.EndpointDescriptor.DIRECTION_IN,
208212
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
209213
bInterval=0,
210-
wMaxPacketSize=args.msc_max_packet_size),
214+
wMaxPacketSize=512 if args.highspeed else 64),
211215
standard.EndpointDescriptor(
212216
description="MSC out",
213217
bEndpointAddress=(args.msc_ep_num_out | standard.EndpointDescriptor.DIRECTION_OUT),
214218
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
215219
bInterval=0,
216-
wMaxPacketSize=args.msc_max_packet_size)
220+
wMaxPacketSize=512 if args.highspeed else 64),
217221
]
218222
)
219223
]

0 commit comments

Comments
 (0)