@@ -86,10 +86,11 @@ typedef struct {
86
86
};
87
87
88
88
//------------- device descriptor -------------//
89
+ uint8_t ep0_size ;
90
+
89
91
uint16_t vid ;
90
92
uint16_t pid ;
91
93
92
- uint8_t ep0_size ;
93
94
uint8_t i_manufacturer ;
94
95
uint8_t i_product ;
95
96
uint8_t i_serial ;
@@ -248,7 +249,6 @@ bool tuh_vid_pid_get(uint8_t dev_addr, uint16_t* vid, uint16_t* pid)
248
249
* vid = * pid = 0 ;
249
250
250
251
TU_VERIFY (tuh_mounted (dev_addr ));
251
-
252
252
usbh_device_t const * dev = get_device (dev_addr );
253
253
254
254
* vid = dev -> vid ;
@@ -308,7 +308,7 @@ bool tuh_descriptor_configuration_get(uint8_t daddr, uint8_t index, void* buffer
308
308
}
309
309
310
310
bool tuh_descriptor_string_get (uint8_t daddr , uint16_t language_id , uint8_t index ,
311
- void * buf , uint16_t len , tuh_control_complete_cb_t complete_cb )
311
+ void * buffer , uint16_t len , tuh_control_complete_cb_t complete_cb )
312
312
{
313
313
tusb_control_request_t const request =
314
314
{
@@ -324,29 +324,32 @@ bool tuh_descriptor_string_get(uint8_t daddr, uint16_t language_id, uint8_t inde
324
324
.wLength = tu_htole16 (len )
325
325
};
326
326
327
- TU_ASSERT ( tuh_control_xfer (daddr , & request , buf , complete_cb ) );
327
+ TU_ASSERT ( tuh_control_xfer (daddr , & request , buffer , complete_cb ) );
328
328
return true;
329
329
}
330
330
331
- uint8_t tuh_i_manufacturer_get (uint8_t dev_addr ) {
332
- TU_VERIFY (tuh_mounted (dev_addr ));
333
- usbh_device_t const * dev = get_device (dev_addr );
334
-
335
- return dev -> i_manufacturer ;
331
+ // Get manufacturer string descriptor
332
+ bool tuh_descriptor_string_manufacturer_get (uint8_t daddr , uint16_t language_id , void * buffer , uint16_t len , tuh_control_complete_cb_t complete_cb )
333
+ {
334
+ TU_VERIFY (tuh_mounted (daddr ));
335
+ usbh_device_t const * dev = get_device (daddr );
336
+ return tuh_descriptor_string_get (daddr , language_id , dev -> i_manufacturer , buffer , len , complete_cb );
336
337
}
337
338
338
- uint8_t tuh_i_serial_get (uint8_t dev_addr ) {
339
- TU_VERIFY (tuh_mounted (dev_addr ));
340
- usbh_device_t const * dev = get_device (dev_addr );
341
-
342
- return dev -> i_serial ;
339
+ // Get product string descriptor
340
+ bool tuh_descriptor_string_product_get (uint8_t daddr , uint16_t language_id , void * buffer , uint16_t len , tuh_control_complete_cb_t complete_cb )
341
+ {
342
+ TU_VERIFY (tuh_mounted (daddr ));
343
+ usbh_device_t const * dev = get_device (daddr );
344
+ return tuh_descriptor_string_get (daddr , language_id , dev -> i_product , buffer , len , complete_cb );
343
345
}
344
346
345
- uint8_t tuh_i_product_get (uint8_t dev_addr ) {
346
- TU_VERIFY (tuh_mounted (dev_addr ));
347
- usbh_device_t const * dev = get_device (dev_addr );
348
-
349
- return dev -> i_product ;
347
+ // Get serial string descriptor
348
+ bool tuh_descriptor_string_serial_get (uint8_t daddr , uint16_t language_id , void * buffer , uint16_t len , tuh_control_complete_cb_t complete_cb )
349
+ {
350
+ TU_VERIFY (tuh_mounted (daddr ));
351
+ usbh_device_t const * dev = get_device (daddr );
352
+ return tuh_descriptor_string_get (daddr , language_id , dev -> i_serial , buffer , len , complete_cb );
350
353
}
351
354
352
355
bool tuh_configuration_set (uint8_t daddr , uint8_t config_num , tuh_control_complete_cb_t complete_cb )
@@ -957,9 +960,9 @@ static bool enum_get_device_desc_complete(uint8_t dev_addr, tusb_control_request
957
960
958
961
dev -> vid = desc_device -> idVendor ;
959
962
dev -> pid = desc_device -> idProduct ;
960
- dev -> i_manufacturer = desc_device -> iManufacturer ;
961
- dev -> i_product = desc_device -> iProduct ;
962
- dev -> i_serial = desc_device -> iSerialNumber ;
963
+ // dev->i_manufacturer = desc_device->iManufacturer;
964
+ // dev->i_product = desc_device->iProduct;
965
+ // dev->i_serial = desc_device->iSerialNumber;
963
966
964
967
// if (tuh_attach_cb) tuh_attach_cb((tusb_desc_device_t*) _usbh_ctrl_buf);
965
968
0 commit comments