From 620d3d14ddd5ee39d256640719b3e10c927139f3 Mon Sep 17 00:00:00 2001 From: Hierophect Date: Thu, 15 Aug 2019 13:41:51 -0400 Subject: [PATCH] Add conditional endpoints to descriptor script --- .../stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk | 1 + supervisor/supervisor.mk | 3 ++- tools/gen_usb_descriptor.py | 7 +++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk b/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk index 747d34ebe4..aa867c96f8 100644 --- a/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk +++ b/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk @@ -2,6 +2,7 @@ USB_VID = 0x239A USB_PID = 0x802A USB_PRODUCT = "STM32F411VE Discovery Board - CPy" USB_MANUFACTURER = "Adafruit Industries LLC" +USB_REDUCED_ENDPOINT = 1 INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index 42a55243e0..1022dd2a34 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -100,7 +100,8 @@ autogen_usb_descriptor.intermediate: ../../tools/gen_usb_descriptor.py Makefile --pid $(USB_PID)\ --serial_number_length $(USB_SERIAL_NUMBER_LENGTH)\ --output_c_file $(BUILD)/autogen_usb_descriptor.c\ - --output_h_file $(BUILD)/genhdr/autogen_usb_descriptor.h + --output_h_file $(BUILD)/genhdr/autogen_usb_descriptor.h\ + --reduced_endpoint_mode $(USB_REDUCED_ENDPOINT) CIRCUITPY_DISPLAY_FONT ?= "../../tools/fonts/ter-u12n.bdf" diff --git a/tools/gen_usb_descriptor.py b/tools/gen_usb_descriptor.py index a5667dd46e..c23b413d25 100644 --- a/tools/gen_usb_descriptor.py +++ b/tools/gen_usb_descriptor.py @@ -21,6 +21,7 @@ parser.add_argument('--serial_number_length', type=int, default=32, help='length needed for the serial number in digits') parser.add_argument('--output_c_file', type=argparse.FileType('w'), required=True) parser.add_argument('--output_h_file', type=argparse.FileType('w'), required=True) +parser.add_argument('--reduced_endpoint_mode', nargs='?',const=0, type=int) args = parser.parse_args() @@ -276,14 +277,16 @@ descriptor_list.extend(cdc_interfaces) descriptor_list.extend(msc_interfaces) # Only add the control interface because other audio interfaces are managed by it to ensure the # correct ordering. -# descriptor_list.append(audio_control_interface) +if not args.reduced_endpoint_mode: + descriptor_list.append(audio_control_interface) # Put the CDC IAD just before the CDC interfaces. # There appears to be a bug in the Windows composite USB driver that requests the # HID report descriptor with the wrong interface number if the HID interface is not given # first. However, it still fetches the descriptor anyway. We could reorder the interfaces but # the Windows 7 Adafruit_usbser.inf file thinks CDC is at Interface 0, so we'll leave it # there for backwards compatibility. -# descriptor_list.extend(hid_interfaces) +if not args.reduced_endpoint_mode: + descriptor_list.extend(hid_interfaces) configuration = standard.ConfigurationDescriptor( description="Composite configuration",