@@ -49,20 +49,17 @@ uint8_t const* tud_descriptor_device_cb(void) {
4949
5050// --- Configuration Descriptor ---
5151
52- enum {
53- INTF_CDC_COMM = 0 ,
54- INTF_CDC_DATA ,
55- INTF_LOOPBACK ,
56- INTF_NUM_TOTAL
57- };
58-
59- #define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN + 9 + 7 + 7)
52+ #define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN + 8 + 9 + 9 + 7 + 7)
6053
6154uint8_t const desc_configuration [] = {
6255 // Config number, interface count, string index, total length, attribute, power in mA
6356 TUD_CONFIG_DESCRIPTOR (1 , INTF_NUM_TOTAL , 0 , CONFIG_TOTAL_LEN , 0x00 , 500 ),
6457 // CDC interfaces
6558 TUD_CDC_DESCRIPTOR (INTF_CDC_COMM , 0 , EP_CDC_COMM , 8 , EP_CDC_DATA_RX , EP_CDC_DATA_TX , BULK_MAX_PACKET_SIZE ),
59+ // Interface association descriptor (IAD)
60+ CUSTOM_VENDOR_INTERFACE_ASSOCIATION (INTF_LOOPBACK_CTRL , 2 , 0x04 ),
61+ // Echo interface (no endpoint, just control messages)
62+ CUSTOM_VENDOR_INTERFACE (INTF_LOOPBACK_CTRL , 0 ),
6663 // Loopback interface
6764 CUSTOM_VENDOR_INTERFACE (INTF_LOOPBACK , 2 ),
6865 // Loopback endpoint OUT
@@ -82,6 +79,8 @@ uint8_t const* tud_descriptor_configuration_cb(uint8_t configuration_index) {
8279
8380// --- BOS Descriptor ---
8481
82+ #if CFG_WINUSB == OPT_WINUSB_MSOS20
83+
8584#define BOS_TOTAL_LEN (TUD_BOS_DESC_LEN + TUD_BOS_MICROSOFT_OS_DESC_LEN)
8685
8786#define MS_OS_20_DESC_LEN 0xB2
@@ -108,7 +107,7 @@ uint8_t const desc_ms_os_20[] = {
108107 U16_TO_U8S_LE (0x0008 ), U16_TO_U8S_LE (MS_OS_20_SUBSET_HEADER_CONFIGURATION ), 0 , 0 , U16_TO_U8S_LE (MS_OS_20_DESC_LEN - 0x0A ),
109108
110109 // Function Subset header: length, type, first interface, reserved, subset length
111- U16_TO_U8S_LE (0x0008 ), U16_TO_U8S_LE (MS_OS_20_SUBSET_HEADER_FUNCTION ), INTF_LOOPBACK , 0 , U16_TO_U8S_LE (MS_OS_20_DESC_LEN - 0x0A - 0x08 ),
110+ U16_TO_U8S_LE (0x0008 ), U16_TO_U8S_LE (MS_OS_20_SUBSET_HEADER_FUNCTION ), INTF_LOOPBACK_CTRL , 0 , U16_TO_U8S_LE (MS_OS_20_DESC_LEN - 0x0A - 0x08 ),
112111
113112 // MS OS 2.0 Compatible ID descriptor: length, type, compatible ID, sub compatible ID
114113 U16_TO_U8S_LE (0x0014 ), U16_TO_U8S_LE (MS_OS_20_FEATURE_COMPATBLE_ID ), 'W' , 'I' , 'N' , 'U' , 'S' , 'B' , 0x00 , 0x00 ,
@@ -129,6 +128,7 @@ uint8_t const desc_ms_os_20[] = {
129128
130129TU_VERIFY_STATIC (sizeof (desc_ms_os_20 ) == MS_OS_20_DESC_LEN , "Incorrect size" );
131130
131+ #endif
132132
133133
134134// --- String Descriptors ---
@@ -138,7 +138,8 @@ const char* const string_table[] = {
138138 0 , // 0 - supported languages (see below)
139139 "JavaDoesUSB" , // 1 - manufacturer
140140 "Composite" , // 2 - product
141- board_serial_num // 3 - serial number
141+ board_serial_num , // 3 - serial number
142+ "Loopback IAD" // 4 - interface association descriptor
142143};
143144
144145
0 commit comments