summaryrefslogtreecommitdiff
path: root/components/drivers/usb/usbdevice/class/mstorage.c
diff options
context:
space:
mode:
authorDillon Min <[email protected]>2021-03-11 17:29:41 +0800
committerDillon Min <[email protected]>2021-03-11 17:29:41 +0800
commiteffcee25b7cbb2bb42d4134d37dc8a9ec4635130 (patch)
treea9d124ef0ee38641b48f12d33de65ff3c4b3f482 /components/drivers/usb/usbdevice/class/mstorage.c
parent0beaeeef456e5e12dd8c7d76ebd8aea2e83973d3 (diff)
component: driver: usb: Add usb interface string(iInterface) setting
To make compositive usb device string more reansonable, not all devices just show same "RTT Composite Device" on windows device manager. add a interface rt_usbd_device_set_interface_string to set respective interface string. Signed-off-by: Dillon Min <[email protected]> v1 -> v2: remove all tabs to space, to match rt-thread coding style
Diffstat (limited to 'components/drivers/usb/usbdevice/class/mstorage.c')
-rw-r--r--components/drivers/usb/usbdevice/class/mstorage.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/components/drivers/usb/usbdevice/class/mstorage.c b/components/drivers/usb/usbdevice/class/mstorage.c
index 6991d97eae..25735e175e 100644
--- a/components/drivers/usb/usbdevice/class/mstorage.c
+++ b/components/drivers/usb/usbdevice/class/mstorage.c
@@ -18,8 +18,8 @@
#ifdef RT_USING_DFS_MNTTABLE
#include "dfs_fs.h"
#endif
-
#ifdef RT_USB_DEVICE_MSTORAGE
+#define MSTRORAGE_INTF_STR_INDEX 11
enum STAT
{
@@ -131,7 +131,11 @@ const static struct umass_descriptor _mass_desc =
USB_CLASS_MASS_STORAGE, //bInterfaceClass;
0x06, //bInterfaceSubClass;
0x50, //bInterfaceProtocol;
+#ifdef RT_USB_DEVICE_COMPOSITE
+ MSTRORAGE_INTF_STR_INDEX,
+#else
0x00, //iInterface;
+#endif
},
{
@@ -1097,8 +1101,11 @@ ufunction_t rt_usbd_function_mstorage_create(udevice_t device)
RT_ASSERT(device != RT_NULL);
/* set usb device string description */
+#ifdef RT_USB_DEVICE_COMPOSITE
+ rt_usbd_device_set_interface_string(device, MSTRORAGE_INTF_STR_INDEX, _ustring[2]);
+#else
rt_usbd_device_set_string(device, _ustring);
-
+#endif
/* create a mass storage function */
func = rt_usbd_function_new(device, &dev_desc, &ops);
device->dev_qualifier = &dev_qualifier;