Loading system/btif/co/bta_hh_co.cc +11 −6 Original line number Diff line number Diff line Loading @@ -603,14 +603,19 @@ void bta_hh_co_set_rpt_rsp(uint8_t dev_handle, uint8_t status) { // Send the HID set report reply to the kernel. if (p_dev->fd >= 0) { struct uhid_event ev = {}; uint32_t* set_rpt_id = (uint32_t*)fixed_queue_dequeue(p_dev->set_rpt_id_queue); if (set_rpt_id) { struct uhid_event ev = {}; ev.type = UHID_SET_REPORT_REPLY; ev.u.set_report_reply.id = *set_rpt_id; ev.u.set_report_reply.err = status; osi_free(set_rpt_id); uhid_write(p_dev->fd, &ev); } else { LOG_VERBOSE("No pending UHID_SET_REPORT"); } } #else LOG_ERROR("Error: UHID_SET_REPORT_REPLY not supported"); Loading system/btif/include/btif_hh.h +1 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ typedef struct { bthh_connection_state_t dev_status; uint8_t dev_handle; RawAddress bd_addr; bool le_hid; tBTA_HH_ATTR_MASK attr_mask; uint8_t sub_class; uint8_t app_id; Loading system/btif/src/btif_hh.cc +17 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,11 @@ #include "btif/include/btif_hh.h" #include <base/logging.h> #include <cstdint> #include "bta_hh_co.h" #include "btif/include/btif_common.h" #include "btif/include/btif_storage.h" #include "btif/include/btif_util.h" Loading @@ -43,8 +46,6 @@ #include "stack/include/l2c_api.h" #include "types/raw_address.h" #include <base/logging.h> #define COD_HID_KEYBOARD 0x0540 #define COD_HID_POINTING 0x0580 #define COD_HID_COMBO 0x05C0 Loading Loading @@ -796,6 +797,7 @@ static void btif_hh_upstreams_evt(uint16_t event, char* p_param) { BTIF_TRACE_WARNING( "BTA_HH_OPEN_EVT: Error, failed to find the uhid driver..."); p_dev->bd_addr = p_data->conn.bda; p_dev->le_hid = p_data->conn.le_hid; // remove the connection and then try again to reconnect from the // mouse side to recover btif_hh_cb.status = (BTIF_HH_STATUS)BTIF_HH_DEV_DISCONNECTED; Loading @@ -806,6 +808,7 @@ static void btif_hh_upstreams_evt(uint16_t event, char* p_param) { "... %d", p_data->conn.handle); p_dev->bd_addr = p_data->conn.bda; p_dev->le_hid = p_data->conn.le_hid; btif_hh_cb.status = (BTIF_HH_STATUS)BTIF_HH_DEV_CONNECTED; // Send set_idle if the peer_device is a keyboard if (check_cod(&p_data->conn.bda, COD_HID_KEYBOARD) || Loading Loading @@ -900,6 +903,18 @@ static void btif_hh_upstreams_evt(uint16_t event, char* p_param) { if (p_dev != NULL) { HAL_CBACK(bt_hh_callbacks, handshake_cb, (RawAddress*)&(p_dev->bd_addr), (bthh_status_t)p_data->hs_data.status); #ifdef OS_ANDROID // Host kernel does not support UHID_SET_REPORT if (p_dev->le_hid && p_dev->set_rpt_id_queue) { /* There is no handshake response for HOGP. Conclude the * UHID_SET_REPORT procedure here. */ uint32_t* set_rpt_id = (uint32_t*)fixed_queue_try_peek_first(p_dev->set_rpt_id_queue); if (set_rpt_id) { bta_hh_co_set_rpt_rsp(p_dev->dev_handle, p_data->dev_status.status); } } #endif } break; Loading Loading
system/btif/co/bta_hh_co.cc +11 −6 Original line number Diff line number Diff line Loading @@ -603,14 +603,19 @@ void bta_hh_co_set_rpt_rsp(uint8_t dev_handle, uint8_t status) { // Send the HID set report reply to the kernel. if (p_dev->fd >= 0) { struct uhid_event ev = {}; uint32_t* set_rpt_id = (uint32_t*)fixed_queue_dequeue(p_dev->set_rpt_id_queue); if (set_rpt_id) { struct uhid_event ev = {}; ev.type = UHID_SET_REPORT_REPLY; ev.u.set_report_reply.id = *set_rpt_id; ev.u.set_report_reply.err = status; osi_free(set_rpt_id); uhid_write(p_dev->fd, &ev); } else { LOG_VERBOSE("No pending UHID_SET_REPORT"); } } #else LOG_ERROR("Error: UHID_SET_REPORT_REPLY not supported"); Loading
system/btif/include/btif_hh.h +1 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ typedef struct { bthh_connection_state_t dev_status; uint8_t dev_handle; RawAddress bd_addr; bool le_hid; tBTA_HH_ATTR_MASK attr_mask; uint8_t sub_class; uint8_t app_id; Loading
system/btif/src/btif_hh.cc +17 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,11 @@ #include "btif/include/btif_hh.h" #include <base/logging.h> #include <cstdint> #include "bta_hh_co.h" #include "btif/include/btif_common.h" #include "btif/include/btif_storage.h" #include "btif/include/btif_util.h" Loading @@ -43,8 +46,6 @@ #include "stack/include/l2c_api.h" #include "types/raw_address.h" #include <base/logging.h> #define COD_HID_KEYBOARD 0x0540 #define COD_HID_POINTING 0x0580 #define COD_HID_COMBO 0x05C0 Loading Loading @@ -796,6 +797,7 @@ static void btif_hh_upstreams_evt(uint16_t event, char* p_param) { BTIF_TRACE_WARNING( "BTA_HH_OPEN_EVT: Error, failed to find the uhid driver..."); p_dev->bd_addr = p_data->conn.bda; p_dev->le_hid = p_data->conn.le_hid; // remove the connection and then try again to reconnect from the // mouse side to recover btif_hh_cb.status = (BTIF_HH_STATUS)BTIF_HH_DEV_DISCONNECTED; Loading @@ -806,6 +808,7 @@ static void btif_hh_upstreams_evt(uint16_t event, char* p_param) { "... %d", p_data->conn.handle); p_dev->bd_addr = p_data->conn.bda; p_dev->le_hid = p_data->conn.le_hid; btif_hh_cb.status = (BTIF_HH_STATUS)BTIF_HH_DEV_CONNECTED; // Send set_idle if the peer_device is a keyboard if (check_cod(&p_data->conn.bda, COD_HID_KEYBOARD) || Loading Loading @@ -900,6 +903,18 @@ static void btif_hh_upstreams_evt(uint16_t event, char* p_param) { if (p_dev != NULL) { HAL_CBACK(bt_hh_callbacks, handshake_cb, (RawAddress*)&(p_dev->bd_addr), (bthh_status_t)p_data->hs_data.status); #ifdef OS_ANDROID // Host kernel does not support UHID_SET_REPORT if (p_dev->le_hid && p_dev->set_rpt_id_queue) { /* There is no handshake response for HOGP. Conclude the * UHID_SET_REPORT procedure here. */ uint32_t* set_rpt_id = (uint32_t*)fixed_queue_try_peek_first(p_dev->set_rpt_id_queue); if (set_rpt_id) { bta_hh_co_set_rpt_rsp(p_dev->dev_handle, p_data->dev_status.status); } } #endif } break; Loading