@@ -80,6 +80,11 @@ PBDRV_USB_TYPE_PUNNING_HELPER(pbdrv_usb_setup_packet)
8080#define DESC_TYPE_DEVICE_QUALIFIER 6
8181#define DESC_TYPE_OTHER_SPEED_CONFIGURATION 7
8282#define DESC_TYPE_INTERFACE_POWER 8
83+ // Binary Object Store, from the Wireless USB / USB 3.0 spec
84+ // These descriptors have been backported and are used for
85+ // WebUSB and Microsoft WinUSB driver installation
86+ #define DESC_TYPE_BOS 15
87+ #define DESC_TYPE_DEVICE_CAPABILITY 16
8388
8489// Device descriptor
8590typedef struct PBDRV_PACKED {
@@ -160,4 +165,121 @@ typedef struct PBDRV_PACKED {
160165} pbdrv_usb_dev_qualifier_desc_t ;
161166PBDRV_USB_TYPE_PUNNING_HELPER (pbdrv_usb_dev_qualifier_desc );
162167
168+ // Binary Object Store
169+ typedef struct PBDRV_PACKED {
170+ uint8_t bLength ;
171+ uint8_t bDescriptorType ;
172+ uint16_t wTotalLength ;
173+ uint8_t bNumDeviceCaps ;
174+ } pbdrv_usb_bos_desc_t ;
175+
176+ typedef struct PBDRV_PACKED {
177+ uint32_t u0 ;
178+ uint16_t u1 ;
179+ uint16_t u2 ;
180+ uint8_t u3 [8 ];
181+ } pbdrv_usb_uuid_t ;
182+
183+ // Platform-specific capabilities
184+ #define USB_DEVICE_CAPABILITY_TYPE_PLATFORM 5
185+
186+ typedef struct PBDRV_PACKED {
187+ uint8_t bLength ;
188+ uint8_t bDescriptorType ;
189+ uint8_t bDevCapabilityType ;
190+ uint8_t bReserved ;
191+ pbdrv_usb_uuid_t uuid ;
192+ } pbdrv_usb_platform_caps_common_t ;
193+
194+ typedef struct PBDRV_PACKED {
195+ pbdrv_usb_platform_caps_common_t hdr ;
196+ uint16_t bcdVersion ;
197+ uint8_t bVendorCode ;
198+ uint8_t iLandingPage ;
199+ } pbdrv_usb_webusb_capability_t ;
200+ #define USB_PLATFORM_CAP_GUID_WEBUSB { \
201+ .u0 = 0x3408b638, \
202+ .u1 = 0x09a9, \
203+ .u2 = 0x47a0, \
204+ .u3 = {0x8b, 0xfd, 0xa0, 0x76, 0x88, 0x15, 0xb6, 0x65}, \
205+ }
206+
207+ typedef struct PBDRV_PACKED {
208+ pbdrv_usb_platform_caps_common_t hdr ;
209+ uint32_t dwWindowsVersion ;
210+ uint16_t wMSOSDescriptorSetTotalLength ;
211+ uint8_t bMS_VendorCode ;
212+ uint8_t bAltEnumCode ;
213+ } pbdrv_usb_microsoft_20_capability_t ;
214+ #define USB_PLATFORM_CAP_GUID_MS_20 { \
215+ .u0 = 0xD8DD60DF, \
216+ .u1 = 0x4589, \
217+ .u2 = 0x4CC7, \
218+ .u3 = {0x9C, 0xD2, 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F}, \
219+ }
220+
221+ // These are not technically part of USB Chapter 9, but
222+ // we need them and they logically fit with the rest of the structs.
223+
224+ #define WEBUSB_REQ_GET_URL 2
225+ #define WEBUSB_DESC_TYPE_URL 3
226+ #define WEBUSB_URL_SCHEME_HTTP 0
227+ #define WEBUSB_URL_SCHEME_HTTPS 1
228+
229+ typedef struct PBDRV_PACKED {
230+ uint8_t bLength ;
231+ uint8_t bDescriptorType ;
232+ uint8_t bScheme ;
233+ uint8_t url [];
234+ } pbdrv_usb_webusb_url_desc_t ;
235+ PBDRV_USB_TYPE_PUNNING_HELPER (pbdrv_usb_webusb_url_desc );
236+
237+ // Microsoft wIndex values
238+ #define MS_OS_20_DESCRIPTOR_INDEX 7
239+ #define MS_OS_20_SET_ALT_ENUMERATION 8
240+
241+ // Microsoft descriptor types
242+ #define MS_OS_20_SET_HEADER_DESCRIPTOR 0
243+ #define MS_OS_20_SUBSET_HEADER_CONFIGURATION 1
244+ #define MS_OS_20_SUBSET_HEADER_FUNCTION 2
245+ #define MS_OS_20_FEATURE_COMPATBLE_ID 3
246+ #define MS_OS_20_FEATURE_REG_PROPERTY 4
247+ #define MS_OS_20_FEATURE_MIN_RESUME_TIME 5
248+ #define MS_OS_20_FEATURE_MODEL_ID 6
249+ #define MS_OS_20_FEATURE_CCGP_DEVICE 7
250+ #define MS_OS_20_FEATURE_VENDOR_REVISION 8
251+
252+ // We only need (and thus define) the following descriptor types
253+
254+ typedef struct PBDRV_PACKED {
255+ uint16_t wLength ;
256+ uint16_t wDescriptorType ;
257+ uint32_t dwWindowsVersion ;
258+ uint16_t wTotalLength ;
259+ } pbdrv_usb_ms_20_desc_set_header_t ;
260+
261+ typedef struct PBDRV_PACKED {
262+ uint16_t wLength ;
263+ uint16_t wDescriptorType ;
264+ uint8_t CompatibleID [8 ];
265+ uint8_t SubCompatibleID [8 ];
266+ } pbdrv_usb_ms_20_compatible_t ;
267+
268+ typedef struct PBDRV_PACKED {
269+ uint16_t wLength ;
270+ uint16_t wDescriptorType ;
271+ uint16_t wPropertyDataType ;
272+ } pbdrv_usb_ms_20_reg_prop_hdr_t ;
273+
274+ #define MS_OS_20_REG_PROP_TYPE_REG_SZ 1
275+ #define MS_OS_20_REG_PROP_TYPE_REG_EXPAND_SZ 2
276+ #define MS_OS_20_REG_PROP_TYPE_REG_BINARY 3
277+ #define MS_OS_20_REG_PROP_TYPE_REG_DWORD_LE 4
278+ #define MS_OS_20_REG_PROP_TYPE_REG_DWORD_BE 5
279+ #define MS_OS_20_REG_PROP_TYPE_REG_LINK 6
280+ #define MS_OS_20_REG_PROP_TYPE_REG_MULTI_SZ 7
281+
282+ // This is the minimum Windows version needed to support these descriptors
283+ #define MS_WINDOWS_VERSION_81 0x06030000
284+
163285#endif // _INTERNAL_PBDRV_USB_CH9_H_
0 commit comments