summaryrefslogtreecommitdiff
path: root/components/drivers/usb/usbdevice/class
diff options
context:
space:
mode:
Diffstat (limited to 'components/drivers/usb/usbdevice/class')
-rw-r--r--components/drivers/usb/usbdevice/class/audio_mic.c12
-rw-r--r--components/drivers/usb/usbdevice/class/audio_speaker.c12
-rw-r--r--components/drivers/usb/usbdevice/class/cdc_vcom.c12
-rw-r--r--components/drivers/usb/usbdevice/class/ecm.c10
-rw-r--r--components/drivers/usb/usbdevice/class/hid.c15
-rw-r--r--components/drivers/usb/usbdevice/class/mstorage.c11
-rw-r--r--components/drivers/usb/usbdevice/class/rndis.c11
-rw-r--r--components/drivers/usb/usbdevice/class/winusb.c10
8 files changed, 77 insertions, 16 deletions
diff --git a/components/drivers/usb/usbdevice/class/audio_mic.c b/components/drivers/usb/usbdevice/class/audio_mic.c
index 23ade2d9b6..793be71728 100644
--- a/components/drivers/usb/usbdevice/class/audio_mic.c
+++ b/components/drivers/usb/usbdevice/class/audio_mic.c
@@ -35,6 +35,7 @@
#define EVENT_RECORD_STOP (1 << 1)
#define EVENT_RECORD_DATA (1 << 2)
+#define MIC_INTF_STR_INDEX 8
/*
* uac mic descriptor define
*/
@@ -128,7 +129,7 @@ const static char *_ustring[] =
{
"Language",
"RT-Thread Team.",
- "Microphone",
+ "RT-Thread Audio Microphone",
"32021919830108",
"Configuration",
"Interface",
@@ -160,7 +161,11 @@ static struct uac_ac_descriptor ac_desc =
USB_CLASS_AUDIO,
USB_SUBCLASS_AUDIOCONTROL,
0x00,
+#ifdef RT_USB_DEVICE_COMPOSITE
+ MIC_INTF_STR_INDEX,
+#else
0x00,
+#endif
},
/* Header Descriptor */
{
@@ -495,9 +500,12 @@ ufunction_t rt_usbd_function_uac_mic_create(udevice_t device)
/* parameter check */
RT_ASSERT(device != RT_NULL);
+#ifdef RT_USB_DEVICE_COMPOSITE
+ rt_usbd_device_set_interface_string(device, MIC_INTF_STR_INDEX, _ustring[2]);
+#else
/* set usb device string description */
rt_usbd_device_set_string(device, _ustring);
-
+#endif
/* create a uac function */
func = rt_usbd_function_new(device, &dev_desc, &ops);
//not support HS
diff --git a/components/drivers/usb/usbdevice/class/audio_speaker.c b/components/drivers/usb/usbdevice/class/audio_speaker.c
index e9a3ffaf40..56e8e5378f 100644
--- a/components/drivers/usb/usbdevice/class/audio_speaker.c
+++ b/components/drivers/usb/usbdevice/class/audio_speaker.c
@@ -35,6 +35,7 @@
#define EVENT_AUDIO_STOP (1 << 1)
#define EVENT_AUDIO_DATA (1 << 2)
+#define SPK_INTF_STR_INDEX 9
/*
* uac speaker descriptor define
*/
@@ -128,7 +129,7 @@ const static char *_ustring[] =
{
"Language",
"RT-Thread Team.",
- "RT-Thread Speaker",
+ "RT-Thread Audio Speaker",
"32021919830108",
"Configuration",
"Interface",
@@ -160,7 +161,11 @@ static struct uac_ac_descriptor ac_desc =
USB_CLASS_AUDIO,
USB_SUBCLASS_AUDIOCONTROL,
0x00,
+#ifdef RT_USB_DEVICE_COMPOSITE
+ SPK_INTF_STR_INDEX,
+#else
0x00,
+#endif
},
/* Header Descriptor */
{
@@ -496,9 +501,12 @@ ufunction_t rt_usbd_function_uac_speaker_create(udevice_t device)
/* parameter check */
RT_ASSERT(device != RT_NULL);
+#ifdef RT_USB_DEVICE_COMPOSITE
+ rt_usbd_device_set_interface_string(device, SPK_INTF_STR_INDEX, _ustring[2]);
+#else
/* set usb device string description */
rt_usbd_device_set_string(device, _ustring);
-
+#endif
/* create a uac function */
func = rt_usbd_function_new(device, &dev_desc, &ops);
//not support HS
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);
diff --git a/components/drivers/usb/usbdevice/class/ecm.c b/components/drivers/usb/usbdevice/class/ecm.c
index 36557dad74..ba9a259d3c 100644
--- a/components/drivers/usb/usbdevice/class/ecm.c
+++ b/components/drivers/usb/usbdevice/class/ecm.c
@@ -24,6 +24,7 @@
#define USB_ETH_MTU 1514
#endif
#define MAX_ADDR_LEN 6
+#define ECM_INTF_STR_INDEX 10
struct rt_ecm_eth
{
@@ -96,7 +97,11 @@ const static struct ucdc_eth_descriptor _comm_desc =
USB_CDC_CLASS_COMM,
USB_CDC_SUBCLASS_ETH,
USB_CDC_PROTOCOL_NONE,
+#ifdef RT_USB_DEVICE_COMPOSITE
+ ECM_INTF_STR_INDEX,
+#else
0x00,
+#endif
},
/* Header Functional Descriptor */
{
@@ -560,8 +565,11 @@ ufunction_t rt_usbd_function_ecm_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, ECM_INTF_STR_INDEX, _ustring[2]);
+#else
rt_usbd_device_set_string(device, _ustring);
-
+#endif
/* create a cdc class */
cdc = rt_usbd_function_new(device, &_dev_desc, &ops);
rt_usbd_device_set_qualifier(device, &dev_qualifier);
diff --git a/components/drivers/usb/usbdevice/class/hid.c b/components/drivers/usb/usbdevice/class/hid.c
index 52e50296a4..7dc344365d 100644
--- a/components/drivers/usb/usbdevice/class/hid.c
+++ b/components/drivers/usb/usbdevice/class/hid.c
@@ -17,7 +17,7 @@
#include "hid.h"
#ifdef RT_USB_DEVICE_HID
-
+#define HID_INTF_STR_INDEX 7
struct hid_s
{
struct rt_device parent;
@@ -318,8 +318,12 @@ const static struct uhid_comm_descriptor _hid_comm_desc =
#else
USB_HID_PROTOCOL_MOUSE, /* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */
#endif
- 0, /* iInterface: Index of string descriptor */
- },
+#ifdef RT_USB_DEVICE_COMPOSITE
+ HID_INTF_STR_INDEX, /* iInterface: Index of string descriptor */
+#else
+ 0,
+#endif
+ },
/* HID Descriptor */
{
@@ -685,8 +689,11 @@ ufunction_t rt_usbd_function_hid_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, HID_INTF_STR_INDEX, _ustring[2]);
+#else
rt_usbd_device_set_string(device, _ustring);
-
+#endif
/* create a cdc function */
func = rt_usbd_function_new(device, &_dev_desc, &ops);
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;
diff --git a/components/drivers/usb/usbdevice/class/rndis.c b/components/drivers/usb/usbdevice/class/rndis.c
index 93e0ba6ae2..98e557f0ff 100644
--- a/components/drivers/usb/usbdevice/class/rndis.c
+++ b/components/drivers/usb/usbdevice/class/rndis.c
@@ -28,7 +28,7 @@
#define DBG_SECTION_NAME "RNDIS"
#include <rtdbg.h>
-
+#define RNDIS_INTF_STR_INDEX 12
/* RT-Thread LWIP ethernet interface */
#include <netif/ethernetif.h>
@@ -123,7 +123,11 @@ const static struct ucdc_comm_descriptor _comm_desc =
USB_CDC_CLASS_COMM,
USB_CDC_SUBCLASS_ACM,
USB_CDC_PROTOCOL_VENDOR,
+#ifdef RT_USB_DEVICE_COMPOSITE
+ RNDIS_INTF_STR_INDEX,
+#else
0x00,
+#endif
},
/* Header Functional Descriptor */
{
@@ -1318,8 +1322,11 @@ ufunction_t rt_usbd_function_rndis_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, RNDIS_INTF_STR_INDEX, _ustring[2]);
+#else
rt_usbd_device_set_string(device, _ustring);
-
+#endif
/* create a cdc class */
cdc = rt_usbd_function_new(device, &_dev_desc, &ops);
rt_usbd_device_set_qualifier(device, &dev_qualifier);
diff --git a/components/drivers/usb/usbdevice/class/winusb.c b/components/drivers/usb/usbdevice/class/winusb.c
index 4af6dba3cf..6a44a3567b 100644
--- a/components/drivers/usb/usbdevice/class/winusb.c
+++ b/components/drivers/usb/usbdevice/class/winusb.c
@@ -19,7 +19,7 @@ struct winusb_device
uep_t ep_out;
uep_t ep_in;
};
-
+#define WINUSB_INTF_STR_INDEX 13
typedef struct winusb_device * winusb_device_t;
ALIGN(4)
@@ -82,7 +82,11 @@ struct winusb_descriptor _winusb_desc =
0xFF, //bInterfaceClass;
0x00, //bInterfaceSubClass;
0x00, //bInterfaceProtocol;
+#ifdef RT_USB_DEVICE_COMPOSITE
+ WINUSB_INTF_STR_INDEX,
+#else
0x00, //iInterface;
+#endif
},
/*endpoint descriptor*/
{
@@ -308,7 +312,11 @@ ufunction_t rt_usbd_function_winusb_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, WINUSB_INTF_STR_INDEX, _ustring[2]);
+#else
rt_usbd_device_set_string(device, _ustring);
+#endif
/* create a cdc function */
func = rt_usbd_function_new(device, &dev_desc, &ops);