Loading system/btif/include/btif_dm.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -35,6 +35,7 @@ #define COD_HID_POINTING 0x0580 #define COD_HID_POINTING 0x0580 #define COD_HID_COMBO 0x05C0 #define COD_HID_COMBO 0x05C0 #define COD_HID_MAJOR 0x0500 #define COD_HID_MAJOR 0x0500 #define COD_HID_SUB_MAJOR 0x00C0 #define COD_HID_MASK 0x0700 #define COD_HID_MASK 0x0700 #define COD_AV_HEADSETS 0x0404 #define COD_AV_HEADSETS 0x0404 #define COD_AV_HANDSFREE 0x0408 #define COD_AV_HANDSFREE 0x0408 Loading Loading @@ -143,5 +144,6 @@ void btif_dm_update_ble_remote_properties(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type); tBT_DEVICE_TYPE dev_type); bool check_cod_hid(const RawAddress& bd_addr); bool check_cod_hid(const RawAddress& bd_addr); bool check_cod_hid_major(const RawAddress& bd_addr, uint32_t cod); bool is_device_le_audio_capable(const RawAddress bd_addr); bool is_device_le_audio_capable(const RawAddress bd_addr); #endif #endif system/btif/src/btif_dm.cc +12 −6 Original line number Original line Diff line number Diff line Loading @@ -504,6 +504,12 @@ bool check_cod_hid(const RawAddress& bd_addr) { return (get_cod(&bd_addr) & COD_HID_MASK) == COD_HID_MAJOR; return (get_cod(&bd_addr) & COD_HID_MASK) == COD_HID_MAJOR; } } bool check_cod_hid_major(const RawAddress& bd_addr, uint32_t cod) { uint32_t remote_cod = get_cod(&bd_addr); return (remote_cod & COD_HID_MASK) == COD_HID_MAJOR && (remote_cod & COD_HID_SUB_MAJOR) == (cod & COD_HID_SUB_MAJOR); } bool check_cod_le_audio(const RawAddress& bd_addr) { bool check_cod_le_audio(const RawAddress& bd_addr) { return (get_cod(&bd_addr) & COD_CLASS_LE_AUDIO) == COD_CLASS_LE_AUDIO; return (get_cod(&bd_addr) & COD_CLASS_LE_AUDIO) == COD_CLASS_LE_AUDIO; } } Loading Loading @@ -790,7 +796,7 @@ bool is_le_audio_capable_during_service_discovery(const RawAddress& bd_addr) { ******************************************************************************/ ******************************************************************************/ static void btif_dm_cb_create_bond(const RawAddress bd_addr, static void btif_dm_cb_create_bond(const RawAddress bd_addr, tBT_TRANSPORT transport) { tBT_TRANSPORT transport) { bool is_hid = check_cod(&bd_addr, COD_HID_POINTING); bool is_hid = check_cod_hid_major(bd_addr, COD_HID_POINTING); bond_state_changed(BT_STATUS_SUCCESS, bd_addr, BT_BOND_STATE_BONDING); bond_state_changed(BT_STATUS_SUCCESS, bd_addr, BT_BOND_STATE_BONDING); if (transport == BT_TRANSPORT_AUTO && is_device_le_audio_capable(bd_addr)) { if (transport == BT_TRANSPORT_AUTO && is_device_le_audio_capable(bd_addr)) { Loading Loading @@ -946,7 +952,7 @@ static void btif_dm_pin_req_evt(tBTA_DM_PIN_REQ* p_pin_req) { check_cod(&bd_addr, COD_AV_HEADPHONES) || check_cod(&bd_addr, COD_AV_HEADPHONES) || check_cod(&bd_addr, COD_AV_PORTABLE_AUDIO) || check_cod(&bd_addr, COD_AV_PORTABLE_AUDIO) || check_cod(&bd_addr, COD_AV_HIFI_AUDIO) || check_cod(&bd_addr, COD_AV_HIFI_AUDIO) || check_cod(&bd_addr, COD_HID_POINTING)) { check_cod_hid_major(bd_addr, COD_HID_POINTING)) { /* Check if this device can be auto paired */ /* Check if this device can be auto paired */ if (!interop_match_addr(INTEROP_DISABLE_AUTO_PAIRING, &bd_addr) && if (!interop_match_addr(INTEROP_DISABLE_AUTO_PAIRING, &bd_addr) && !interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, !interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, Loading @@ -962,8 +968,8 @@ static void btif_dm_pin_req_evt(tBTA_DM_PIN_REQ* p_pin_req) { BTA_DmPinReply(bd_addr, true, 4, pin_code.pin); BTA_DmPinReply(bd_addr, true, 4, pin_code.pin); return; return; } } } else if (check_cod(&bd_addr, COD_HID_KEYBOARD) || } else if (check_cod_hid_major(bd_addr, COD_HID_KEYBOARD) || check_cod(&bd_addr, COD_HID_COMBO)) { check_cod_hid_major(bd_addr, COD_HID_COMBO)) { if ((interop_match_addr(INTEROP_KEYBOARD_REQUIRES_FIXED_PIN, &bd_addr) == if ((interop_match_addr(INTEROP_KEYBOARD_REQUIRES_FIXED_PIN, &bd_addr) == true) && true) && (pairing_cb.autopair_attempts == 0)) { (pairing_cb.autopair_attempts == 0)) { Loading Loading @@ -1039,7 +1045,7 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ* p_ssp_cfm_req) { if (p_ssp_cfm_req->just_works && if (p_ssp_cfm_req->just_works && !(p_ssp_cfm_req->loc_auth_req & BTM_AUTH_BONDS) && !(p_ssp_cfm_req->loc_auth_req & BTM_AUTH_BONDS) && !(p_ssp_cfm_req->rmt_auth_req & BTM_AUTH_BONDS) && !(p_ssp_cfm_req->rmt_auth_req & BTM_AUTH_BONDS) && !(check_cod((RawAddress*)&p_ssp_cfm_req->bd_addr, COD_HID_POINTING))) !(check_cod_hid_major(p_ssp_cfm_req->bd_addr, COD_HID_POINTING))) pairing_cb.bond_type = tBTM_SEC_DEV_REC::BOND_TYPE_TEMPORARY; pairing_cb.bond_type = tBTM_SEC_DEV_REC::BOND_TYPE_TEMPORARY; else else pairing_cb.bond_type = tBTM_SEC_DEV_REC::BOND_TYPE_PERSISTENT; pairing_cb.bond_type = tBTM_SEC_DEV_REC::BOND_TYPE_PERSISTENT; Loading Loading @@ -1340,7 +1346,7 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) { status = BT_STATUS_FAIL; status = BT_STATUS_FAIL; } } /* Special Handling for HID Devices */ /* Special Handling for HID Devices */ if (check_cod(&bd_addr, COD_HID_POINTING)) { if (check_cod_hid_major(bd_addr, COD_HID_POINTING)) { /* Remove Device as bonded in nvram as authentication failed */ /* Remove Device as bonded in nvram as authentication failed */ BTIF_TRACE_DEBUG("%s(): removing hid pointing device from nvram", BTIF_TRACE_DEBUG("%s(): removing hid pointing device from nvram", __func__); __func__); Loading system/btif/src/btif_hh.cc +3 −2 Original line number Original line Diff line number Diff line Loading @@ -119,6 +119,7 @@ static tHID_KB_LIST hid_kb_numlock_on_list[] = {{LOGITECH_KB_MX5500_PRODUCT_ID, ******************************************************************************/ ******************************************************************************/ bool check_cod(const RawAddress* remote_bdaddr, uint32_t cod); bool check_cod(const RawAddress* remote_bdaddr, uint32_t cod); bool check_cod_hid(const RawAddress* remote_bdaddr); bool check_cod_hid(const RawAddress* remote_bdaddr); bool check_cod_hid_major(const RawAddress& bd_addr, uint32_t cod); void bta_hh_co_close(btif_hh_device_t* p_dev); void bta_hh_co_close(btif_hh_device_t* p_dev); void bta_hh_co_send_hid_info(btif_hh_device_t* p_dev, const char* dev_name, void bta_hh_co_send_hid_info(btif_hh_device_t* p_dev, const char* dev_name, uint16_t vendor_id, uint16_t product_id, uint16_t vendor_id, uint16_t product_id, Loading Loading @@ -439,8 +440,8 @@ static void hh_open_handler(tBTA_HH_CONN& conn) { p_dev->dev_status = BTHH_CONN_STATE_CONNECTED; p_dev->dev_status = BTHH_CONN_STATE_CONNECTED; hh_connect_complete(conn.handle, conn.bda, BTIF_HH_DEV_CONNECTED); hh_connect_complete(conn.handle, conn.bda, BTIF_HH_DEV_CONNECTED); // Send set_idle if the peer_device is a keyboard // Send set_idle if the peer_device is a keyboard if (check_cod(&conn.bda, COD_HID_KEYBOARD) || if (check_cod_hid_major(conn.bda, COD_HID_KEYBOARD) || check_cod(&conn.bda, COD_HID_COMBO)) { check_cod_hid_major(conn.bda, COD_HID_COMBO)) { BTA_HhSetIdle(conn.handle, 0); BTA_HhSetIdle(conn.handle, 0); } } BTA_HhGetDscpInfo(conn.handle); BTA_HhGetDscpInfo(conn.handle); Loading Loading
system/btif/include/btif_dm.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -35,6 +35,7 @@ #define COD_HID_POINTING 0x0580 #define COD_HID_POINTING 0x0580 #define COD_HID_COMBO 0x05C0 #define COD_HID_COMBO 0x05C0 #define COD_HID_MAJOR 0x0500 #define COD_HID_MAJOR 0x0500 #define COD_HID_SUB_MAJOR 0x00C0 #define COD_HID_MASK 0x0700 #define COD_HID_MASK 0x0700 #define COD_AV_HEADSETS 0x0404 #define COD_AV_HEADSETS 0x0404 #define COD_AV_HANDSFREE 0x0408 #define COD_AV_HANDSFREE 0x0408 Loading Loading @@ -143,5 +144,6 @@ void btif_dm_update_ble_remote_properties(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type); tBT_DEVICE_TYPE dev_type); bool check_cod_hid(const RawAddress& bd_addr); bool check_cod_hid(const RawAddress& bd_addr); bool check_cod_hid_major(const RawAddress& bd_addr, uint32_t cod); bool is_device_le_audio_capable(const RawAddress bd_addr); bool is_device_le_audio_capable(const RawAddress bd_addr); #endif #endif
system/btif/src/btif_dm.cc +12 −6 Original line number Original line Diff line number Diff line Loading @@ -504,6 +504,12 @@ bool check_cod_hid(const RawAddress& bd_addr) { return (get_cod(&bd_addr) & COD_HID_MASK) == COD_HID_MAJOR; return (get_cod(&bd_addr) & COD_HID_MASK) == COD_HID_MAJOR; } } bool check_cod_hid_major(const RawAddress& bd_addr, uint32_t cod) { uint32_t remote_cod = get_cod(&bd_addr); return (remote_cod & COD_HID_MASK) == COD_HID_MAJOR && (remote_cod & COD_HID_SUB_MAJOR) == (cod & COD_HID_SUB_MAJOR); } bool check_cod_le_audio(const RawAddress& bd_addr) { bool check_cod_le_audio(const RawAddress& bd_addr) { return (get_cod(&bd_addr) & COD_CLASS_LE_AUDIO) == COD_CLASS_LE_AUDIO; return (get_cod(&bd_addr) & COD_CLASS_LE_AUDIO) == COD_CLASS_LE_AUDIO; } } Loading Loading @@ -790,7 +796,7 @@ bool is_le_audio_capable_during_service_discovery(const RawAddress& bd_addr) { ******************************************************************************/ ******************************************************************************/ static void btif_dm_cb_create_bond(const RawAddress bd_addr, static void btif_dm_cb_create_bond(const RawAddress bd_addr, tBT_TRANSPORT transport) { tBT_TRANSPORT transport) { bool is_hid = check_cod(&bd_addr, COD_HID_POINTING); bool is_hid = check_cod_hid_major(bd_addr, COD_HID_POINTING); bond_state_changed(BT_STATUS_SUCCESS, bd_addr, BT_BOND_STATE_BONDING); bond_state_changed(BT_STATUS_SUCCESS, bd_addr, BT_BOND_STATE_BONDING); if (transport == BT_TRANSPORT_AUTO && is_device_le_audio_capable(bd_addr)) { if (transport == BT_TRANSPORT_AUTO && is_device_le_audio_capable(bd_addr)) { Loading Loading @@ -946,7 +952,7 @@ static void btif_dm_pin_req_evt(tBTA_DM_PIN_REQ* p_pin_req) { check_cod(&bd_addr, COD_AV_HEADPHONES) || check_cod(&bd_addr, COD_AV_HEADPHONES) || check_cod(&bd_addr, COD_AV_PORTABLE_AUDIO) || check_cod(&bd_addr, COD_AV_PORTABLE_AUDIO) || check_cod(&bd_addr, COD_AV_HIFI_AUDIO) || check_cod(&bd_addr, COD_AV_HIFI_AUDIO) || check_cod(&bd_addr, COD_HID_POINTING)) { check_cod_hid_major(bd_addr, COD_HID_POINTING)) { /* Check if this device can be auto paired */ /* Check if this device can be auto paired */ if (!interop_match_addr(INTEROP_DISABLE_AUTO_PAIRING, &bd_addr) && if (!interop_match_addr(INTEROP_DISABLE_AUTO_PAIRING, &bd_addr) && !interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, !interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, Loading @@ -962,8 +968,8 @@ static void btif_dm_pin_req_evt(tBTA_DM_PIN_REQ* p_pin_req) { BTA_DmPinReply(bd_addr, true, 4, pin_code.pin); BTA_DmPinReply(bd_addr, true, 4, pin_code.pin); return; return; } } } else if (check_cod(&bd_addr, COD_HID_KEYBOARD) || } else if (check_cod_hid_major(bd_addr, COD_HID_KEYBOARD) || check_cod(&bd_addr, COD_HID_COMBO)) { check_cod_hid_major(bd_addr, COD_HID_COMBO)) { if ((interop_match_addr(INTEROP_KEYBOARD_REQUIRES_FIXED_PIN, &bd_addr) == if ((interop_match_addr(INTEROP_KEYBOARD_REQUIRES_FIXED_PIN, &bd_addr) == true) && true) && (pairing_cb.autopair_attempts == 0)) { (pairing_cb.autopair_attempts == 0)) { Loading Loading @@ -1039,7 +1045,7 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ* p_ssp_cfm_req) { if (p_ssp_cfm_req->just_works && if (p_ssp_cfm_req->just_works && !(p_ssp_cfm_req->loc_auth_req & BTM_AUTH_BONDS) && !(p_ssp_cfm_req->loc_auth_req & BTM_AUTH_BONDS) && !(p_ssp_cfm_req->rmt_auth_req & BTM_AUTH_BONDS) && !(p_ssp_cfm_req->rmt_auth_req & BTM_AUTH_BONDS) && !(check_cod((RawAddress*)&p_ssp_cfm_req->bd_addr, COD_HID_POINTING))) !(check_cod_hid_major(p_ssp_cfm_req->bd_addr, COD_HID_POINTING))) pairing_cb.bond_type = tBTM_SEC_DEV_REC::BOND_TYPE_TEMPORARY; pairing_cb.bond_type = tBTM_SEC_DEV_REC::BOND_TYPE_TEMPORARY; else else pairing_cb.bond_type = tBTM_SEC_DEV_REC::BOND_TYPE_PERSISTENT; pairing_cb.bond_type = tBTM_SEC_DEV_REC::BOND_TYPE_PERSISTENT; Loading Loading @@ -1340,7 +1346,7 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) { status = BT_STATUS_FAIL; status = BT_STATUS_FAIL; } } /* Special Handling for HID Devices */ /* Special Handling for HID Devices */ if (check_cod(&bd_addr, COD_HID_POINTING)) { if (check_cod_hid_major(bd_addr, COD_HID_POINTING)) { /* Remove Device as bonded in nvram as authentication failed */ /* Remove Device as bonded in nvram as authentication failed */ BTIF_TRACE_DEBUG("%s(): removing hid pointing device from nvram", BTIF_TRACE_DEBUG("%s(): removing hid pointing device from nvram", __func__); __func__); Loading
system/btif/src/btif_hh.cc +3 −2 Original line number Original line Diff line number Diff line Loading @@ -119,6 +119,7 @@ static tHID_KB_LIST hid_kb_numlock_on_list[] = {{LOGITECH_KB_MX5500_PRODUCT_ID, ******************************************************************************/ ******************************************************************************/ bool check_cod(const RawAddress* remote_bdaddr, uint32_t cod); bool check_cod(const RawAddress* remote_bdaddr, uint32_t cod); bool check_cod_hid(const RawAddress* remote_bdaddr); bool check_cod_hid(const RawAddress* remote_bdaddr); bool check_cod_hid_major(const RawAddress& bd_addr, uint32_t cod); void bta_hh_co_close(btif_hh_device_t* p_dev); void bta_hh_co_close(btif_hh_device_t* p_dev); void bta_hh_co_send_hid_info(btif_hh_device_t* p_dev, const char* dev_name, void bta_hh_co_send_hid_info(btif_hh_device_t* p_dev, const char* dev_name, uint16_t vendor_id, uint16_t product_id, uint16_t vendor_id, uint16_t product_id, Loading Loading @@ -439,8 +440,8 @@ static void hh_open_handler(tBTA_HH_CONN& conn) { p_dev->dev_status = BTHH_CONN_STATE_CONNECTED; p_dev->dev_status = BTHH_CONN_STATE_CONNECTED; hh_connect_complete(conn.handle, conn.bda, BTIF_HH_DEV_CONNECTED); hh_connect_complete(conn.handle, conn.bda, BTIF_HH_DEV_CONNECTED); // Send set_idle if the peer_device is a keyboard // Send set_idle if the peer_device is a keyboard if (check_cod(&conn.bda, COD_HID_KEYBOARD) || if (check_cod_hid_major(conn.bda, COD_HID_KEYBOARD) || check_cod(&conn.bda, COD_HID_COMBO)) { check_cod_hid_major(conn.bda, COD_HID_COMBO)) { BTA_HhSetIdle(conn.handle, 0); BTA_HhSetIdle(conn.handle, 0); } } BTA_HhGetDscpInfo(conn.handle); BTA_HhGetDscpInfo(conn.handle); Loading