Skip to content

Commit 0493c8d

Browse files
committed
USB more fixes (rusefi#9689)
* Revert "USB: add IAD Descriptor for MSD interface" This reverts commit 626e4c3. * USB: separate string descriptor for CDC interface "RusEFI Virtual COM Port"
1 parent 1662a21 commit 0493c8d

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

  • firmware/hw_layer/ports/stm32/serial_over_usb

firmware/hw_layer/ports/stm32/serial_over_usb/usbcfg.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ SerialUSBDriver SDU1;
3434

3535
#if HAL_USE_USB_MSD
3636
// Descriptor that includes MSD is larger and has an extra interface
37-
#define DESCRIPTOR_SIZE (98 + 8)
37+
#define DESCRIPTOR_SIZE 98
3838
#define NUM_INTERFACES 3
3939
#define USB_MSD_EP_SIZE 64
4040

@@ -88,21 +88,14 @@ static const uint8_t vcom_configuration_descriptor_data[DESCRIPTOR_SIZE] = {
8888
200), /* bMaxPower (400mA). */
8989
#if HAL_USE_USB_MSD
9090
// MSD
91-
/* IAD Descriptor - describes that EP0+1 belong to MSD */
92-
USB_DESC_INTERFACE_ASSOCIATION(MSD_IF, /* bFirstInterface. */
93-
0x01, /* bInterfaceCount. */
94-
0x08, /* bFunctionClass (Mass Storage). */
95-
0x06, /* bFunctionSubClass. (SCSI) */
96-
0x50, /* bFunctionProtocol (Bulk-Only) */
97-
4), /* iInterface. */
9891
USB_DESC_INTERFACE (MSD_IF, /* bInterfaceNumber. */
9992
0x00, /* bAlternateSetting. */
10093
0x02, /* bNumEndpoints. */
10194
0x08, /* bInterfaceClass (mass storage) */
10295
0x06, /* bInterfaceSubClass (SCSI
10396
transparent storage class). */
10497
0x50, /* bInterfaceProtocol (Bulk Only). */
105-
0), /* iInterface. */
98+
4), /* iInterface. */
10699
/* Mass Storage Data In Endpoint Descriptor.*/
107100
USB_DESC_ENDPOINT (USB_MSD_DATA_EP | 0x80,
108101
0x02, /* bmAttributes (Bulk). */
@@ -121,7 +114,7 @@ static const uint8_t vcom_configuration_descriptor_data[DESCRIPTOR_SIZE] = {
121114
0x02, /* bFunctionClass (CDC). */
122115
0x02, /* bFunctionSubClass. (2) */
123116
0x01, /* bFunctionProtocol (1) */
124-
2), /* iInterface. */
117+
5), /* iInterface. */
125118
/* Interface Descriptor.*/
126119
USB_DESC_INTERFACE (CDC_INT_IF, /* bInterfaceNumber. */
127120
0x00, /* bAlternateSetting. */
@@ -273,6 +266,15 @@ static const uint8_t msd_string4[] = {
273266
'S', 0, 'D', 0
274267
};
275268

269+
/* "RusEFI Virtual COM Port" */
270+
static const uint8_t vcom_string5[] = {
271+
USB_DESC_BYTE(23 * 2 + 2), /* bLength. */
272+
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */
273+
'r', 0, 'u', 0, 's', 0, 'E', 0, 'F', 0, 'I', 0, ' ', 0, 'V', 0,
274+
'i', 0, 'r', 0, 't', 0, 'u', 0, 'a', 0, 'l', 0, ' ', 0, 'C', 0,
275+
'O', 0, 'M', 0, ' ', 0, 'P', 0, 'o', 0, 'r', 0, 't', 0
276+
};
277+
276278
/*
277279
* Strings wrappers array.
278280
*/
@@ -281,7 +283,8 @@ static const USBDescriptor vcom_strings[] = {
281283
{ sizeof(vcom_string1), vcom_string1 },
282284
{ sizeof(vcom_string2), vcom_string2 },
283285
{ sizeof(vcom_string3), vcom_string3 },
284-
{ sizeof(msd_string4), msd_string4 }
286+
{ sizeof(msd_string4), msd_string4 },
287+
{ sizeof(vcom_string5), vcom_string5 }
285288
};
286289

287290
#ifndef BOARD_SERIAL

0 commit comments

Comments
 (0)