summaryrefslogtreecommitdiff
path: root/components/drivers/usb/usbdevice/class/audio_speaker.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/audio_speaker.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/audio_speaker.c')
-rw-r--r--components/drivers/usb/usbdevice/class/audio_speaker.c12
1 files changed, 10 insertions, 2 deletions
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