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

Commit 88cb8db9 authored by Andre Eisenbach's avatar Andre Eisenbach Committed by Zhihai Xu
Browse files

LE: Only prepend valid HID report IDs

If a remote HOGP device does not supply a valid report ID, do not
prepend it to the HID report.

This fixes interop issues with various LE mice, where the cursor would
not move on screen as expected.
BLTH02618447

Bug:11342157
Change-Id: I7832bb091654a5625f37b1531bd80fad9bbe6a51
parent 3005e0ed
Loading
Loading
Loading
Loading
+16 −10
Original line number Diff line number Diff line
@@ -2193,18 +2193,23 @@ void bta_hh_le_input_rpt_notify(tBTA_GATTC_NOTIFY *p_data)
    else if (p_data->char_id.char_id.uuid.uu.uuid16 == GATT_UUID_HID_BT_KB_INPUT)
        app_id = BTA_HH_APP_ID_KB;

    APPL_TRACE_ERROR1("Notification received on report ID: %d", p_rpt->rpt_id);

    /* need to append report ID to the head of data */
    if (p_rpt->rpt_id != 0)
    {
        if ((p_buf = (UINT8 *)GKI_getbuf((UINT16)(p_data->len + 1))) == NULL)
        {
            APPL_TRACE_ERROR0("No resources to send report data");
            return;
        }

    APPL_TRACE_ERROR1("Notification received on report ID: %d", p_rpt->rpt_id);

        p_buf[0] = p_rpt->rpt_id;
        memcpy(&p_buf[1], p_data->value, p_data->len);
    p_data->len ++;
        ++p_data->len;
    } else {
        p_buf = p_data->value;
    }

    bta_hh_co_data((UINT8)p_dev_cb->hid_handle,
                    p_buf,
@@ -2215,6 +2220,7 @@ void bta_hh_le_input_rpt_notify(tBTA_GATTC_NOTIFY *p_data)
                    p_dev_cb->addr,
                    app_id);

    if (p_buf != p_data->value)
        GKI_freebuf(p_buf);
}