diff options
| author | Dillon Min <[email protected]> | 2021-03-11 17:29:41 +0800 |
|---|---|---|
| committer | Dillon Min <[email protected]> | 2021-03-11 17:29:41 +0800 |
| commit | effcee25b7cbb2bb42d4134d37dc8a9ec4635130 (patch) | |
| tree | a9d124ef0ee38641b48f12d33de65ff3c4b3f482 /components/drivers/usb/usbdevice/class/winusb.c | |
| parent | 0beaeeef456e5e12dd8c7d76ebd8aea2e83973d3 (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/winusb.c')
| -rw-r--r-- | components/drivers/usb/usbdevice/class/winusb.c | 10 |
1 files changed, 9 insertions, 1 deletions
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); |
