From af3c301ea5152ea4926e005159f4daa894b5df53 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 30 Jul 2019 00:34:25 +0700 Subject: added BOS MS OS 2.0 descriptor to webusb example, it work with windows --- src/device/usbd.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src/device') diff --git a/src/device/usbd.h b/src/device/usbd.h index 525fced8e..6e781f18d 100644 --- a/src/device/usbd.h +++ b/src/device/usbd.h @@ -104,11 +104,11 @@ TU_ATTR_WEAK void tud_resume_cb(void); TU_ATTR_WEAK bool tud_vendor_control_request_cb(uint8_t rhport, tusb_control_request_t const * request); TU_ATTR_WEAK bool tud_vendor_control_complete_cb(uint8_t rhport, tusb_control_request_t const * request); + //--------------------------------------------------------------------+ -// Descriptor Templates +// Binary Device Object Store (BOS) Descriptor Templates //--------------------------------------------------------------------+ -//------------- Binary Device Object Store (BOS) -------------// #define TUD_BOS_DESC_LEN 5 // total length, number of device caps @@ -119,10 +119,10 @@ TU_ATTR_WEAK bool tud_vendor_control_complete_cb(uint8_t rhport, tusb_control_re #define TUD_BOS_PLATFORM_DESCRIPTOR(...) \ 4+TU_ARGS_NUM(__VA_ARGS__), TUSB_DESC_DEVICE_CAPABILITY, DEVICE_CAPABILITY_PLATFORM, 0x00, __VA_ARGS__ -//------------- WebUSB BOS -------------// +//------------- WebUSB BOS Platform -------------// // Descriptor Length -#define TUD_BOS_WEBUSB_DESC_LEN 24 +#define TUD_BOS_WEBUSB_DESC_LEN 24 // Vendor Code, iLandingPage #define TUD_BOS_WEBUSB_DESCRIPTOR(_vendor_code, _ipage) \ @@ -132,6 +132,23 @@ TU_ATTR_WEAK bool tud_vendor_control_complete_cb(uint8_t rhport, tusb_control_re 0x38, 0xB6, 0x08, 0x34, 0xA9, 0x09, 0xA0, 0x47, \ 0x8B, 0xFD, 0xA0, 0x76, 0x88, 0x15, 0xB6, 0x65 +//------------- Microsoft OS 2.0 Platform -------------// + +#define TUD_BOS_MICROSOFT_OS_DESC_LEN 28 + +// Total Length of descriptor set, vendor code +#define TUD_BOS_MS_OS_20_DESCRIPTOR(_desc_set_len, _vendor_code) \ + TUD_BOS_PLATFORM_DESCRIPTOR(TUD_BOS_MS_OS_20_UUID, U32_TO_U8S_LE(0x06030000), U16_TO_U8S_LE(_desc_set_len), _vendor_code, 0) + +#define TUD_BOS_MS_OS_20_UUID \ + 0xDF, 0x60, 0xDD, 0xD8, 0x89, 0x45, 0xC7, 0x4C, \ + 0x9C, 0xD2, 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F + + +//--------------------------------------------------------------------+ +// Configuration & Interface Descriptor Templates +//--------------------------------------------------------------------+ + //------------- Configuration -------------// #define TUD_CONFIG_DESC_LEN (9) -- cgit v1.3.1