@@ -155,14 +155,14 @@ class USBCDC::AsyncWait: public AsyncOp {
155155 USBCDC *serial;
156156};
157157
158- USBCDC::USBCDC (bool connect_blocking, uint16_t vendor_id, uint16_t product_id, uint16_t product_release)
159- : internal::PluggableUSBModule(2 )
158+ USBCDC::USBCDC (bool connect_blocking, const char * name, uint16_t vendor_id, uint16_t product_id, uint16_t product_release)
159+ : internal::PluggableUSBModule(2 ), extraDescriptor(name)
160160{
161161 PluggableUSBD ().plug (this );
162162}
163163
164- USBCDC::USBCDC (USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint16_t product_release)
165- : internal::PluggableUSBModule(2 )
164+ USBCDC::USBCDC (USBPhy *phy, const char * name, uint16_t vendor_id, uint16_t product_id, uint16_t product_release)
165+ : internal::PluggableUSBModule(2 ), extraDescriptor(name)
166166{
167167 PluggableUSBD ().plug (this );
168168}
@@ -492,12 +492,7 @@ void USBCDC::_receive_isr()
492492
493493const uint8_t *USBCDC::string_iinterface_desc ()
494494{
495- static const uint8_t stringIinterfaceDescriptor[] = {
496- 0x08 ,
497- STRING_DESCRIPTOR,
498- ' C' , 0 , ' D' , 0 , ' C' , 0 ,
499- };
500- return stringIinterfaceDescriptor;
495+ return (const uint8_t *)extraDescriptor;
501496}
502497
503498const uint8_t *USBCDC::string_iproduct_desc ()
@@ -546,7 +541,7 @@ const uint8_t *USBCDC::configuration_desc(uint8_t index)
546541 0x02 , // bInterfaceClass
547542 0x02 , // bInterfaceSubClass
548543 0x01 , // bInterfaceProtocol
549- 0 , // iInterface
544+ (extraDescriptor != NULL ) ? 0x5 : 0x0 , // iInterface
550545
551546 // CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
552547 5 , // bFunctionLength
0 commit comments