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/ecm.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/ecm.c')
| -rw-r--r-- | components/drivers/usb/usbdevice/class/ecm.c | 10 |
1 files changed, 9 insertions, 1 deletions
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); |
