mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-01 19:20:35 +00:00
bth: Update driver to interface association changes
Two interfaces that are required by Bluetooth Primary Controller do not have IAD according to Bluetooth specification. Those two interfaces were opened separately in process_set_config(). Later interface association was inferred for BTH (along with other drivers), since then only one call to open() is place for BTH driver that should prepare both interfaces at once. To make it work again btd_open() parses two interfaces at once.
This commit is contained in:
parent
c04006bc13
commit
ec8ece2c9d
@ -112,9 +112,8 @@ uint16_t btd_open(uint8_t rhport, tusb_desc_interface_t const *itf_desc, uint16_
|
||||
TUD_BT_APP_SUBCLASS == itf_desc->bInterfaceSubClass &&
|
||||
TUD_BT_PROTOCOL_PRIMARY_CONTROLLER == itf_desc->bInterfaceProtocol, 0);
|
||||
|
||||
// Distinguish interface by number of endpoints, as both interface have same class, subclass and protocol
|
||||
if (itf_desc->bNumEndpoints == 3 && max_len >= hci_itf_size)
|
||||
{
|
||||
TU_ASSERT(itf_desc->bNumEndpoints == 3 && max_len >= hci_itf_size);
|
||||
|
||||
_btd_itf.itf_num = itf_desc->bInterfaceNumber;
|
||||
|
||||
desc_ep = (tusb_desc_endpoint_t const *) tu_desc_next(itf_desc);
|
||||
@ -127,13 +126,19 @@ uint16_t btd_open(uint8_t rhport, tusb_desc_interface_t const *itf_desc, uint16_
|
||||
TU_ASSERT(usbd_open_edpt_pair(rhport, tu_desc_next(desc_ep), 2, TUSB_XFER_BULK, &_btd_itf.ep_acl_out,
|
||||
&_btd_itf.ep_acl_in), 0);
|
||||
|
||||
itf_desc = (tusb_desc_interface_t const *)tu_desc_next(tu_desc_next(tu_desc_next(desc_ep)));
|
||||
|
||||
// Prepare for incoming data from host
|
||||
TU_ASSERT(usbd_edpt_xfer(rhport, _btd_itf.ep_acl_out, _btd_itf.epout_buf, CFG_TUD_BTH_DATA_EPSIZE), 0);
|
||||
|
||||
drv_len = hci_itf_size;
|
||||
}
|
||||
else if (itf_desc->bNumEndpoints == 2 && max_len >= iso_alt_itf_size)
|
||||
{
|
||||
|
||||
// Ensure this is still BT Primary Controller
|
||||
TU_ASSERT(TUSB_CLASS_WIRELESS_CONTROLLER == itf_desc->bInterfaceClass &&
|
||||
TUD_BT_APP_SUBCLASS == itf_desc->bInterfaceSubClass &&
|
||||
TUD_BT_PROTOCOL_PRIMARY_CONTROLLER == itf_desc->bInterfaceProtocol, 0);
|
||||
TU_ASSERT(itf_desc->bNumEndpoints == 2 && max_len >= iso_alt_itf_size + drv_len);
|
||||
|
||||
uint8_t dir;
|
||||
|
||||
desc_ep = (tusb_desc_endpoint_t const *)tu_desc_next(itf_desc);
|
||||
@ -180,7 +185,6 @@ uint16_t btd_open(uint8_t rhport, tusb_desc_interface_t const *itf_desc, uint16_
|
||||
_btd_itf.ep_voice_size[dir][itf_desc->bAlternateSetting] = (uint8_t) tu_edpt_packet_size(desc_ep);
|
||||
drv_len += iso_alt_itf_size;
|
||||
}
|
||||
}
|
||||
|
||||
return drv_len;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user