@@ -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
37+ #define DESCRIPTOR_SIZE ( 98 + 8 )
3838 #define NUM_INTERFACES 3
3939 #define USB_MSD_EP_SIZE 64
4040
@@ -87,6 +87,14 @@ static const uint8_t vcom_configuration_descriptor_data[DESCRIPTOR_SIZE] = {
8787 0x80 , /* bmAttributes (bus powered). */
8888 200 ), /* bMaxPower (400mA). */
8989#if HAL_USE_USB_MSD
90+ // 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. */
9098 USB_DESC_INTERFACE (MSD_IF , /* bInterfaceNumber. */
9199 0x00 , /* bAlternateSetting. */
92100 0x02 , /* bNumEndpoints. */
@@ -210,6 +218,7 @@ static const uint8_t vcom_string1[] = {
210218};
211219
212220#ifndef USB_DESCRIPTOR_STRING_CONTENT
221+ /* "rusEFI Engine Management ECU" */
213222#define USB_DESCRIPTOR_STRING_CONTENT ' r' , 0 , ' u' , 0 , ' s' , 0 , ' E' , 0 , ' F' , 0 , ' I' , 0 , ' ' , 0 , ' E' , 0 , \
214223 ' n' , 0 , ' g' , 0 , ' i' , 0 , ' n' , 0 , ' e' , 0 , ' ' , 0 , ' M' , 0 , ' a' , 0 , \
215224 ' n' , 0 , ' a' , 0 , ' g' , 0 , ' e' , 0 , ' m' , 0 , ' e' , 0 , ' n' , 0 , ' t' , 0 , \
@@ -257,14 +266,24 @@ static uint8_t vcom_string3[] = {
257266};
258267#endif
259268
269+ /* "RusEFI MSD" */
270+ static uint8_t msd_string4[] = {
271+ USB_DESC_BYTE (10 * 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 , ' M' , 0 ,
274+ ' S' , 0 , ' D' , 0 ,
275+ 0
276+ };
277+
260278/*
261279 * Strings wrappers array.
262280 */
263281static const USBDescriptor vcom_strings[] = {
264282 {sizeof vcom_string0, vcom_string0},
265283 {sizeof vcom_string1, vcom_string1},
266284 {sizeof vcom_string2, vcom_string2},
267- {sizeof vcom_string3, vcom_string3}
285+ {sizeof vcom_string3, vcom_string3},
286+ {sizeof msd_string4, msd_string4}
268287};
269288
270289#ifndef BOARD_SERIAL
@@ -314,7 +333,7 @@ static const USBDescriptor *get_descriptor(USBDriver *usbp,
314333 case USB_DESCRIPTOR_CONFIGURATION :
315334 return &vcom_configuration_descriptor;
316335 case USB_DESCRIPTOR_STRING :
317- if (dindex < 4 )
336+ if (dindex < efi::size (vcom_strings) )
318337 return &vcom_strings[dindex];
319338 }
320339 return NULL ;
0 commit comments