summaryrefslogtreecommitdiff
path: root/components/drivers/usb/usbdevice/class/cdc_vcom.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/cdc_vcom.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/cdc_vcom.c')
-rw-r--r--components/drivers/usb/usbdevice/class/cdc_vcom.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/components/drivers/usb/usbdevice/class/cdc_vcom.c b/components/drivers/usb/usbdevice/class/cdc_vcom.c
index f9ea466bd5..5cd4a676a1 100644
--- a/components/drivers/usb/usbdevice/class/cdc_vcom.c
+++ b/components/drivers/usb/usbdevice/class/cdc_vcom.c
@@ -20,6 +20,7 @@
#ifdef RT_USB_DEVICE_CDC
+#define VCOM_INTF_STR_INDEX 5
#ifdef RT_VCOM_TX_TIMEOUT
#define VCOM_TX_TIMEOUT RT_VCOM_TX_TIMEOUT
#else /*!RT_VCOM_TX_TIMEOUT*/
@@ -151,7 +152,11 @@ const static struct ucdc_comm_descriptor _comm_desc =
USB_CDC_CLASS_COMM,
USB_CDC_SUBCLASS_ACM,
USB_CDC_PROTOCOL_V25TER,
- 0x00,
+#ifdef RT_USB_DEVICE_COMPOSITE
+ VCOM_INTF_STR_INDEX,
+#else
+ 0,
+#endif
},
/* Header Functional Descriptor */
{
@@ -582,9 +587,12 @@ ufunction_t rt_usbd_function_cdc_create(udevice_t device)
rt_memset(serno, 0, _SER_NO_LEN + 1);
rt_memcpy(serno, _SER_NO, rt_strlen(_SER_NO));
}
+#ifdef RT_USB_DEVICE_COMPOSITE
+ rt_usbd_device_set_interface_string(device, VCOM_INTF_STR_INDEX, _ustring[2]);
+#else
/* set usb device string description */
rt_usbd_device_set_string(device, _ustring);
-
+#endif
/* create a cdc function */
func = rt_usbd_function_new(device, &dev_desc, &ops);