summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHierophect <hierophect@gmail.com>2019-08-15 13:41:51 -0400
committerHierophect <hierophect@gmail.com>2019-08-15 13:41:51 -0400
commit620d3d14ddd5ee39d256640719b3e10c927139f3 (patch)
treea26724818d3908618850214910571d6e17789a3c
parente0a49532f02c1142dd9f37ee9d632b1467d56247 (diff)
Add conditional endpoints to descriptor script
-rw-r--r--ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk1
-rw-r--r--supervisor/supervisor.mk3
-rw-r--r--tools/gen_usb_descriptor.py7
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 747d34ebe..aa867c96f 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 42a55243e..1022dd2a3 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 a5667dd46..c23b413d2 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",