circuitpython/shared/tinyusb
Angus Gratton 5d8878b582 shared/tinyusb: Only run TinyUSB on the main thread if GIL is disabled.
If GIL is disabled then there's threat of a race condition if some other
code specifically requests USB processing (i.e. to unblock stdio), while
a scheduled TinyUSB callback is already running on another thread.

Relies on the change in the parent commit, where scheduler is restricted
to main thread if GIL is disabled.

Fixes #15390 - "TinyUSB callback can't recurse" exceptions on rp2 when
using _thread module and USB serial I/O.

Adds a unit test for stdin functioning correctly in threads (fails on rp2
port without this fix).

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-09-19 13:17:01 +10:00
..
mp_usbd.c extmod/machine_usb_device: Add support for Python USB devices. 2024-03-15 14:22:11 +11:00
mp_usbd.h shared/tinyusb/mp_usbd_cdc: Skip writing to an uninitialized USB device. 2024-07-20 00:27:58 +10:00
mp_usbd_cdc.c shared/tinyusb/mp_usbd_cdc: Skip writing to an uninitialized USB device. 2024-07-20 00:27:58 +10:00
mp_usbd_cdc.h shared/tinyusb: Allow ports to use 1200bps-touch without other CDC code. 2024-06-02 23:27:33 +10:00
mp_usbd_descriptor.c extmod/machine_usb_device: Add support for Python USB devices. 2024-03-15 14:22:11 +11:00
mp_usbd_runtime.c shared/tinyusb: Only run TinyUSB on the main thread if GIL is disabled. 2024-09-19 13:17:01 +10:00
tusb_config.h shared/tinyusb: Allow ports to define CDC TX/RX buffer sizes. 2024-08-26 12:42:09 +10:00