forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Description
The current implementation of usb.core.Device.detach_kernel_driver() looks like this:
void common_hal_usb_core_device_detach_kernel_driver(usb_core_device_obj_t *self, mp_int_t interface) {
#if CIRCUITPY_USB_KEYBOARD_WORKFLOW
usb_keyboard_detach(self->device_address, interface);
#endif
}So, it's only aware of the possibility of the CircuitPython core having claimed keyboards.
For better compatibility with desktop PyUSB, the detach implementation could be extended to unbind TinyUSB class drivers. For more about TinyUSB class driver binding, check out the enum_parse_configuration_desc() implementation in tinyusb/src/host/usbh.c.
It's not clear to me at the moment whether TinyUSB provides a way to unbind drivers independently of removing a device. See process_removed_device() implementation in usbh.c for how undbinding works during device removal.