@@ -78,6 +78,7 @@ report_mouse_t mouse_report_sent = {0};
7878#if defined(FWUPD_CAP )
7979static uint8_t fwupd_descriptor_set [] __attribute__((aligned (4 ))) = {
8080 // Generated with `~/clone/fwupd/contrib/generate-ds20.py fwup.quirk`
81+ // 0x59 bytes
8182 0x50 , 0x6c , 0x75 , 0x67 , 0x69 , 0x6e , 0x3d , 0x72 , 0x70 , 0x5f , 0x70 , 0x69 ,
8283 0x63 , 0x6f , 0x0a , 0x46 , 0x6c , 0x61 , 0x67 , 0x73 , 0x3d , 0x69 , 0x6e , 0x74 ,
8384 0x65 , 0x72 , 0x6e , 0x61 , 0x6c , 0x0a , 0x49 , 0x63 , 0x6f , 0x6e , 0x3d , 0x69 ,
@@ -87,7 +88,82 @@ static uint8_t fwupd_descriptor_set[] __attribute__((aligned(4))) = {
8788 0x56 , 0x45 , 0x4e , 0x5f , 0x32 , 0x45 , 0x38 , 0x41 , 0x26 , 0x44 , 0x45 , 0x56 ,
8889 0x5f , 0x30 , 0x30 , 0x30 , 0x33
8990};
90- #endif
91+ #endif // FWUPD_CAP
92+
93+ #if defined(PICOBOOT_CAP )
94+ static uint8_t picoboot_descriptor_set [] __attribute__((aligned (4 ))) = {
95+ // Mirror this to associate WinUSB with the picoboot interface
96+ // Otherwise Windows complains that no driver is loaded for that interface/device
97+ // https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/pico_stdio_usb/reset_interface.c#L46
98+ // 0xA6/166 bytes
99+ //
100+ // Microsoft OS 2.0 Descriptor Set Header
101+ //
102+ 0x0A , 0x00 , // wLength - 10 bytes
103+ 0x00 , 0x00 , // wDescriptorType - MSOS20_SET_HEADER_DESCRIPTOR
104+ 0x00 , 0x00 , 0x03 , 0x06 , // dwWindowsVersion – 0x06030000 for Windows Blue
105+ 0xA6 , 0x00 , // wTotalLength – 166 bytes
106+
107+ //
108+ // Microsoft OS 2.0 Function Subset Header
109+ //
110+ 0x08 , 0x00 , // wLength - 8 bytes
111+ 0x02 , 0x00 , // wDescriptorType - MS_OS_20_SUBSET_HEADER_FUNCTION
112+ RP2040_RESET_INTERFACE , // bFirstInterface
113+ 0x00 , // bReserved
114+ 0x9C , 0x00 , // wSubsetLength – 156 bytes
115+
116+
117+ //
118+ // Microsoft OS 2.0 Compatible ID Header
119+ //
120+ 0x14 , 0x00 , // wLength - 20 bytes
121+ 0x03 , 0x00 , // wDescriptorType - MS_OS_20_FEATURE_COMPATBLE_ID
122+ 'W' , 'I' , 'N' , 'U' , // CompatibleID
123+ 'S' , 'B' , 0x00 , 0x00 , //
124+ 0x00 , 0x00 , 0x00 , 0x00 , // SubCompatibleID
125+ 0x00 , 0x00 , 0x00 , 0x00 , //
126+
127+ //
128+ // Microsoft OS 2.0 Registry Value Feature Descriptor
129+ //
130+ 0x80 , 0x00 , // wLength - 128 bytes
131+ 0x04 , 0x00 , // wDescriptorType – 4 MS_OS_20_FEATURE_REG_PROPERTY
132+ 0x01 , 0x00 , // wPropertyDataType - 1 for A NULL-terminated Unicode String (REG_SZ)
133+ 0x28 , 0x00 , // wPropertyNameLength – 40 bytes
134+ 'D' , 0x00 , 'e' , 0x00 , // Property Name - "DeviceInterfaceGUID"
135+ 'v' , 0x00 , 'i' , 0x00 ,
136+ 'c' , 0x00 , 'e' , 0x00 ,
137+ 'I' , 0x00 , 'n' , 0x00 ,
138+ 't' , 0x00 , 'e' , 0x00 ,
139+ 'r' , 0x00 , 'f' , 0x00 ,
140+ 'a' , 0x00 , 'c' , 0x00 ,
141+ 'e' , 0x00 , 'G' , 0x00 ,
142+ 'U' , 0x00 , 'I' , 0x00 ,
143+ 'D' , 0x00 , 0x00 , 0x00 ,
144+ 0x4E , 0x00 , // wPropertyDataLength – 78 bytes
145+ '{' , 0x00 , 'b' , 0x00 , // PropertyData - "{bc7398c1-73cd-4cb7-98b8-913a8fca7bf6}"
146+ 'c' , 0x00 , '7' , 0x00 ,
147+ '3' , 0x00 , '9' , 0x00 ,
148+ '8' , 0x00 , 'c' , 0x00 ,
149+ '1' , 0x00 , '-' , 0x00 ,
150+ '7' , 0x00 , '3' , 0x00 ,
151+ 'c' , 0x00 , 'd' , 0x00 ,
152+ '-' , 0x00 , '4' , 0x00 ,
153+ 'c' , 0x00 , 'b' , 0x00 ,
154+ '7' , 0x00 , '-' , 0x00 ,
155+ '9' , 0x00 , '8' , 0x00 ,
156+ 'b' , 0x00 , '8' , 0x00 ,
157+ '-' , 0x00 , '9' , 0x00 ,
158+ '1' , 0x00 , '3' , 0x00 ,
159+ 'a' , 0x00 , '8' , 0x00 ,
160+ 'f' , 0x00 , 'c' , 0x00 ,
161+ 'a' , 0x00 , '7' , 0x00 ,
162+ 'b' , 0x00 , 'f' , 0x00 ,
163+ '6' , 0x00 , '}' , 0x00 ,
164+ 0x00 , 0x00
165+ };
166+ #endif // PICOBOOT_CAP
91167
92168#if defined(MSOS2_CAP )
93169static uint8_t msos_descriptor_set [] __attribute__((aligned (4 ))) = {
@@ -826,6 +902,33 @@ static bool usb_request_hook_cb(USBDriver *usbp) {
826902 }
827903#endif
828904
905+ #if defined(PICOBOOT_CAP )
906+ // if (usbp->setup[0] == 0xC0) {
907+ // dprintf("zoid. Vendor request\n");
908+ // dprintf("zoid:\n bmRequestType: %d\n bRequest: %d\n wValue: %d %d\n wIndex: %d %d\n wLength: %d %d\n",
909+ // usbp->setup[0], usbp->setup[1], usbp->setup[2], usbp->setup[3], usbp->setup[4], usbp->setup[5], usbp->setup[6], usbp->setup[7]);
910+ // }
911+ /* Handle Vendor Specific Request */
912+ if (
913+ //usbp->setup[0] == (USB_RTYPE_TYPE_VENDOR | USB_RTYPE_DIR_HOST2DEV | USB_RTYPE_RECIPIENT_DEVICE)
914+ usbp -> setup [0 ] == 0xC0
915+ // Microsoft vendor code = 0x01
916+ // FWUPD vendor code = 0x2a
917+ // wRequest
918+ && usbp -> setup [1 ] == 0x01
919+ // wValue
920+ && usbp -> setup [2 ] == 0x00 && usbp -> setup [3 ] == 0x00
921+ // wIndex: MS_OS_20_DESCRIPTOR_INDEX
922+ && usbp -> setup [4 ] == 0x07 && usbp -> setup [5 ] == 0x00
923+ // wLength: 0x00A6
924+ && usbp -> setup [6 ] == 0xA6 && usbp -> setup [7 ] == 0x00
925+ ) {
926+ //dprint("zoid: Detected MS OS 2.0 descriptor request\n");
927+ usbSetupTransfer (usbp , & picoboot_descriptor_set [0 ], 0xA6 , NULL );
928+ return TRUE;
929+ }
930+ #endif
931+
829932#if defined(MSOS2_CAP )
830933 /* Handle Vendor Specific Request */
831934 //if (((usbp->setup[0] & USB_RTYPE_TYPE_MASK) == USB_RTYPE_TYPE_VENDOR) && ((usbp->setup[0] & USB_RTYPE_RECIPIENT_MASK) == USB_RTYPE_RECIPIENT_DEVICE)) {
0 commit comments