mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-30 06:32:43 +00:00
hid_host: in finalize_connection call l2cap_disconnect when needed
This commit is contained in:
parent
2ba92e70de
commit
7379ca3deb
@ -335,6 +335,18 @@ static hid_host_connection_t * hid_host_get_connection_for_bd_addr(bd_addr_t add
|
|||||||
|
|
||||||
|
|
||||||
static void hid_host_finalize_connection(hid_host_connection_t * connection){
|
static void hid_host_finalize_connection(hid_host_connection_t * connection){
|
||||||
|
uint16_t interrupt_cid = connection->interrupt_cid;
|
||||||
|
uint16_t control_cid = connection->control_cid;
|
||||||
|
|
||||||
|
connection->interrupt_cid = 0;
|
||||||
|
connection->control_cid = 0;
|
||||||
|
|
||||||
|
if (interrupt_cid != 0){
|
||||||
|
l2cap_disconnect(interrupt_cid, 0);
|
||||||
|
}
|
||||||
|
if (control_cid != 0){
|
||||||
|
l2cap_disconnect(control_cid, 0);
|
||||||
|
}
|
||||||
btstack_linked_list_remove(&connections, (btstack_linked_item_t*) connection);
|
btstack_linked_list_remove(&connections, (btstack_linked_item_t*) connection);
|
||||||
btstack_memory_hid_host_connection_free(connection);
|
btstack_memory_hid_host_connection_free(connection);
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ void hid_host_register_packet_handler(btstack_packet_handler_t callback);
|
|||||||
* followed by HID_SUBEVENT_DESCRIPTOR_AVAILABLE that informs if the HID Descriptor was found. In the case of incoming
|
* followed by HID_SUBEVENT_DESCRIPTOR_AVAILABLE that informs if the HID Descriptor was found. In the case of incoming
|
||||||
* connection, i.e. HID Device initiating the connection, the HID_SUBEVENT_DESCRIPTOR_AVAILABLE is delayed, and the reports
|
* connection, i.e. HID Device initiating the connection, the HID_SUBEVENT_DESCRIPTOR_AVAILABLE is delayed, and the reports
|
||||||
* may already come via HID_SUBEVENT_REPORT event. It is up to the application code if
|
* may already come via HID_SUBEVENT_REPORT event. It is up to the application code if
|
||||||
* these events should be buffered or ignored until the descriptor is available.
|
* these reports should be buffered or ignored until the descriptor is available.
|
||||||
* @note HID_PROTOCOL_MODE_REPORT_WITH_FALLBACK_TO_BOOT will try ti set up REPORT mode, but fallback to BOOT mode if necessary.
|
* @note HID_PROTOCOL_MODE_REPORT_WITH_FALLBACK_TO_BOOT will try ti set up REPORT mode, but fallback to BOOT mode if necessary.
|
||||||
* @note HID_SUBEVENT_DESCRIPTOR_AVAILABLE possible status values are:
|
* @note HID_SUBEVENT_DESCRIPTOR_AVAILABLE possible status values are:
|
||||||
* - ERROR_CODE_SUCCESS if descriptor available,
|
* - ERROR_CODE_SUCCESS if descriptor available,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user