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

Commit fea43dfd authored by Zhihai Xu's avatar Zhihai Xu
Browse files

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

need to set HID major in class of device of inquiry result for HID over LE,
if HID over LE service UUID is found in BLE advertisement data.
so we can show the HID icon in device list for HID over LE device.
16 bit UUID list in BLE advertisement data can contain multiple UUID,
need to go through the 16bit UUID list to find HID over LE service UUID.

bug:11450485
Change-Id: I7b2ee4c88485b287609eac34c35ce5e714e48280
parent 29299953
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)