@@ -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. */
@@ -215,6 +223,7 @@ static const uint8_t vcom_string1[] = {
215223#endif
216224
217225#ifndef USB_DESCRIPTOR_STRING_CONTENT
226+ /* "rusEFI Engine Management ECU" */
218227#define USB_DESCRIPTOR_STRING_CONTENT ' r' , 0 , ' u' , 0 , ' s' , 0 , ' E' , 0 , ' F' , 0 , ' I' , 0 , ' ' , 0 , ' E' , 0 , \
219228 ' n' , 0 , ' g' , 0 , ' i' , 0 , ' n' , 0 , ' e' , 0 , ' ' , 0 , ' M' , 0 , ' a' , 0 , \
220229 ' n' , 0 , ' a' , 0 , ' g' , 0 , ' e' , 0 , ' m' , 0 , ' e' , 0 , ' n' , 0 , ' t' , 0 , \
@@ -258,14 +267,24 @@ static uint8_t vcom_string3[] = {
258267};
259268#endif
260269
270+ /* "RusEFI MSD" */
271+ static uint8_t msd_string4[] = {
272+ USB_DESC_BYTE (10 * 2 + 2 ), /* bLength. */
273+ USB_DESC_BYTE (USB_DESCRIPTOR_STRING ), /* bDescriptorType. */
274+ ' r' , 0 , ' u' , 0 , ' s' , 0 , ' E' , 0 , ' F' , 0 , ' I' , 0 , ' ' , 0 , ' M' , 0 ,
275+ ' S' , 0 , ' D' , 0 ,
276+ 0
277+ };
278+
261279/*
262280 * Strings wrappers array.
263281 */
264282static const USBDescriptor vcom_strings[] = {
265283 {sizeof vcom_string0, vcom_string0},
266284 {sizeof vcom_string1, vcom_string1},
267285 {sizeof vcom_string2, vcom_string2},
268- {sizeof vcom_string3, vcom_string3}
286+ {sizeof vcom_string3, vcom_string3},
287+ {sizeof msd_string4, msd_string4}
269288};
270289
271290#ifndef BOARD_SERIAL
@@ -315,7 +334,7 @@ static const USBDescriptor *get_descriptor(USBDriver *usbp,
315334 case USB_DESCRIPTOR_CONFIGURATION :
316335 return &vcom_configuration_descriptor;
317336 case USB_DESCRIPTOR_STRING :
318- if (dindex < 4 )
337+ if (dindex < efi::size (vcom_strings) )
319338 return &vcom_strings[dindex];
320339 }
321340 return NULL ;
0 commit comments