Add conditional endpoints to descriptor script

This commit is contained in:
Hierophect 2019-08-15 13:41:51 -04:00
parent e0a49532f0
commit 620d3d14dd
3 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -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"

View File

@ -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",