diff options
| author | hathach <[email protected]> | 2019-07-30 00:34:25 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-07-30 00:34:25 +0700 |
| commit | af3c301ea5152ea4926e005159f4daa894b5df53 (patch) | |
| tree | d3fde63c86a845c0cdd62384e036b180bccc2d07 /src | |
| parent | d79a209aefe498f78350ee3e08b96b8e17fda6b1 (diff) | |
added BOS MS OS 2.0 descriptor to webusb example, it work with windows
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/tusb_types.h | 14 | ||||
| -rw-r--r-- | src/device/usbd.h | 25 |
2 files changed, 35 insertions, 4 deletions
diff --git a/src/common/tusb_types.h b/src/common/tusb_types.h index 2776eaa87..8358d7e66 100644 --- a/src/common/tusb_types.h +++ b/src/common/tusb_types.h @@ -227,6 +227,20 @@ enum INTERFACE_INVALID_NUMBER = 0xff
};
+
+enum
+{
+ MS_OS_20_SET_HEADER_DESCRIPTOR = 0x00,
+ MS_OS_20_SUBSET_HEADER_CONFIGURATION = 0x01,
+ MS_OS_20_SUBSET_HEADER_FUNCTION = 0x02,
+ MS_OS_20_FEATURE_COMPATBLE_ID = 0x03,
+ MS_OS_20_FEATURE_REG_PROPERTY = 0x04,
+ MS_OS_20_FEATURE_MIN_RESUME_TIME = 0x05,
+ MS_OS_20_FEATURE_MODEL_ID = 0x06,
+ MS_OS_20_FEATURE_CCGP_DEVICE = 0x07,
+ MS_OS_20_FEATURE_VENDOR_REVISION = 0x08
+}microsoft_os_20_type_t;
+
//--------------------------------------------------------------------+
// USB Descriptors
//--------------------------------------------------------------------+
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)
|
