From a46addba7b740123d2de2d1c48d39212b0914d49 Mon Sep 17 00:00:00 2001 From: will-v-pi <108662275+will-v-pi@users.noreply.github.com> Date: Sat, 24 Aug 2024 20:54:44 +0100 Subject: [PATCH] Fix stdio_usb with reset interface disabled on Windows (#1857) * Only use bcdUSB = 0x0200 with MS_OS_20 descriptor enabled * Add comment --- src/rp2_common/pico_stdio_usb/stdio_usb_descriptors.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/rp2_common/pico_stdio_usb/stdio_usb_descriptors.c b/src/rp2_common/pico_stdio_usb/stdio_usb_descriptors.c index 7ecfdffe7..2f6e75877 100644 --- a/src/rp2_common/pico_stdio_usb/stdio_usb_descriptors.c +++ b/src/rp2_common/pico_stdio_usb/stdio_usb_descriptors.c @@ -92,7 +92,15 @@ static const tusb_desc_device_t usbd_desc_device = { .bLength = sizeof(tusb_desc_device_t), .bDescriptorType = TUSB_DESC_DEVICE, +// On Windows, if bcdUSB = 0x210 then a Microsoft OS 2.0 descriptor is required, else the device won't be detected +// This is only needed for driverless access to the reset interface - the CDC interface doesn't require these descriptors +// for driverless access, but will still not work if bcdUSB = 0x210 and no descriptor is provided. Therefore always +// use bcdUSB = 0x200 if the Microsoft OS 2.0 descriptor isn't enabled +#if PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE && PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_MS_OS_20_DESCRIPTOR .bcdUSB = 0x0210, +#else + .bcdUSB = 0x0200, +#endif .bDeviceClass = TUSB_CLASS_MISC, .bDeviceSubClass = MISC_SUBCLASS_COMMON, .bDeviceProtocol = MISC_PROTOCOL_IAD,