Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f4d11041 authored by Zhihai Xu's avatar Zhihai Xu Committed by Android (Google) Code Review
Browse files

Merge "set HID major in class of device of inquiry result for HID over LE"

parents 55e48b59 fea43dfd
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -1518,6 +1518,7 @@ BOOLEAN btm_ble_update_inq_result(tINQ_DB_ENT *p_i, UINT8 addr_type, UINT8 evt_t
    UINT8                data_len, rssi;
    tBTM_BLE_INQ_CB     *p_le_inq_cb = &btm_cb.ble_ctr_cb.inq_var;
    UINT8 *p1;
    UINT8               *p_uuid16;

    STREAM_TO_UINT8    (data_len, p);

@@ -1562,6 +1563,26 @@ BOOLEAN btm_ble_update_inq_result(tINQ_DB_ENT *p_i, UINT8 addr_type, UINT8 evt_t
            p_cur->flag = * p_flag;
    }

    if (p_le_inq_cb->adv_len != 0)
    {
        if ((p_uuid16 = BTM_CheckAdvData(p_le_inq_cb->adv_data_cache,
                                         BTM_BLE_AD_TYPE_16SRV_CMPL, &len)) != NULL)
        {
            UINT8 i;
            for (i = 0; i + 2 <= len; i = i + 2)
            {
                /* if this BLE device support HID over LE, set HID Major in class of device */
                if ((p_uuid16[i] | (p_uuid16[i+1] << 8)) == UUID_SERVCLASS_LE_HID)
                {
                    p_cur->dev_class[0] = 0;
                    p_cur->dev_class[1] = BTM_COD_MAJOR_PERIPHERAL;
                    p_cur->dev_class[2] = 0;
                    break;
                }
            }
        }
    }

    /* if BR/EDR not supported is not set, assume is a DUMO device */
    if ((p_cur->flag & BTM_BLE_BREDR_NOT_SPT) == 0 &&
         evt_type != BTM_BLE_CONNECT_DIR_EVT)