From cd9e6c0d5c38cc5ada46da494a7ef6553078e4a0 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 2 Apr 2025 11:56:08 -0700 Subject: [PATCH 1/2] Temporary USB host fix The close endpoints update broke our ability to open endpoints that the native TinyUSB driver had already opened. We need to add a way to fully detach the native driver. Until then, limit the native HID driver to keyboards only. CircuitPython uses this for the native keyboard support. --- .gitmodules | 4 ++-- lib/tinyusb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index c60def69722e3..6d8dcba72aa1f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -68,8 +68,8 @@ url = https://github.com/adafruit/nrfx.git [submodule "lib/tinyusb"] path = lib/tinyusb - url = https://github.com/hathach/tinyusb.git - branch = master + url = https://github.com/tannewt/tinyusb.git + branch = only_native_keyboard fetchRecurseSubmodules = false [submodule "tools/huffman"] path = tools/huffman diff --git a/lib/tinyusb b/lib/tinyusb index 8c1802e41d37c..e82649d0bf8e2 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 8c1802e41d37c915334a19b859b24cb2a1b48ee5 +Subproject commit e82649d0bf8e2cd93f04a986fc5e64e49eef5b81 From 15620cb40b4058207dfa363f48e13cf25fe487a4 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 2 Apr 2025 12:38:01 -0700 Subject: [PATCH 2/2] Correctly deinit USB devices --- ports/raspberrypi/boards/adafruit_fruit_jam/mpconfigboard.mk | 3 --- shared-bindings/usb/core/__init__.c | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/ports/raspberrypi/boards/adafruit_fruit_jam/mpconfigboard.mk b/ports/raspberrypi/boards/adafruit_fruit_jam/mpconfigboard.mk index 31c4b130d0e2d..21215164706e1 100644 --- a/ports/raspberrypi/boards/adafruit_fruit_jam/mpconfigboard.mk +++ b/ports/raspberrypi/boards/adafruit_fruit_jam/mpconfigboard.mk @@ -8,6 +8,3 @@ CHIP_PACKAGE = B CHIP_FAMILY = rp2 EXTERNAL_FLASH_DEVICES = "W25Q128JVxQ" - -# CIRCUITPY_DISPLAY_FONT = $(TOP)/tools/fonts/unifont-16.0.02-all.bdf -# CIRCUITPY_FONT_EXTRA_CHARACTERS = "🖮🖱️" diff --git a/shared-bindings/usb/core/__init__.c b/shared-bindings/usb/core/__init__.c index 545e182ea99a3..74dce81de44bc 100644 --- a/shared-bindings/usb/core/__init__.c +++ b/shared-bindings/usb/core/__init__.c @@ -89,7 +89,7 @@ static mp_obj_t _next_device(usb_core_devices_obj_t *iter) { // We passed the filters. Now make a properly allocated object to // return to the user. - usb_core_device_obj_t *self = mp_obj_malloc(usb_core_device_obj_t, &usb_core_device_type); + usb_core_device_obj_t *self = mp_obj_malloc_with_finaliser(usb_core_device_obj_t, &usb_core_device_type); common_hal_usb_core_device_construct(self, i); iter->next_index = i + 1;