From a03b6a99e60c8c428d95bc78b1ee6948607f69c6 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 27 Aug 2020 15:10:52 -0500 Subject: [PATCH 1/2] gen_usb_descriptor: Fix off-by-1 error in endpoint counting --- tools/gen_usb_descriptor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/gen_usb_descriptor.py b/tools/gen_usb_descriptor.py index baee8cad7b..adf0d8270d 100644 --- a/tools/gen_usb_descriptor.py +++ b/tools/gen_usb_descriptor.py @@ -382,8 +382,9 @@ if args.max_ep != 0: for interface in interfaces: for subdescriptor in interface.subdescriptors: endpoint_address = getattr(subdescriptor, 'bEndpointAddress', 0) & 0x7f - if endpoint_address > args.max_ep: - raise ValueError("Endpoint address %d of %s may not exceed %d" % (endpoint_address & 0x7f, interface.description, args.max_ep)) + print("Endpoint %d - vs max_ep %d" % (endpoint_address, args.max_ep)) + if endpoint_address >= args.max_ep: + raise ValueError("Endpoint address %d of %s must be less than %d" % (endpoint_address & 0x7f, interface.description, args.max_ep)) else: print("Unable to check whether maximum number of endpoints is respected", file=sys.stderr) From 563e038c0d210dd0d17f6dc65f2c9eb5bbff1892 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 27 Aug 2020 15:11:17 -0500 Subject: [PATCH 2/2] stm: Specify max endpoints for stm32f405xx .. which is why we can't have HID or MIDI on the stm32f405 feather --- ports/stm/mpconfigport.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/stm/mpconfigport.mk b/ports/stm/mpconfigport.mk index 19f9ffa44c..b827aa48b9 100644 --- a/ports/stm/mpconfigport.mk +++ b/ports/stm/mpconfigport.mk @@ -7,6 +7,7 @@ ifeq ($(MCU_VARIANT),STM32F405xx) CIRCUITPY_FRAMEBUFFERIO ?= 1 CIRCUITPY_RGBMATRIX ?= 1 CIRCUITPY_SDIOIO ?= 1 + USB_NUM_EP = 4 endif ifeq ($(MCU_SERIES),F4)