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

Commit e8812f21 authored by Archie Pusaka's avatar Archie Pusaka
Browse files

hid: fix assigning empty handle to uhid

aosp/3119833 introduces a bug when separating uhid and hh struct.
When the hh struct was just created, the handle is still unassigned,
but is nevertheless passed to the uhid struct. Likewise for the
link_spec member.

This CL makes sure to pass the correct values to the uhid struct.

Bug: 291522341
Test: mmm packages/modules/Bluetooth
Test: manual verification that set/get feature reports are forwarded
      to the correct peripherals.
Flag: EXEMPT, bugfix to previous mechanical refactor
Change-Id: I058429446595b687ddfba2dd9693f4c97acc3f85
parent 868c34c8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ void bta_hh_co_data(uint8_t dev_handle, uint8_t* p_rpt, uint16_t len);
 *
 ******************************************************************************/
bool bta_hh_co_open(uint8_t dev_handle, uint8_t sub_class, uint16_t attr_mask,
                    uint8_t app_id);
                    uint8_t app_id, tAclLinkSpec& link_spec);

/*******************************************************************************
 *
+4 −3
Original line number Diff line number Diff line
@@ -428,7 +428,8 @@ int bta_hh_co_write(int fd, uint8_t* rpt, uint16_t len) {
 * Returns       True if platform specific initialization is successful
 ******************************************************************************/
bool bta_hh_co_open(uint8_t dev_handle, uint8_t sub_class,
                    tBTA_HH_ATTR_MASK attr_mask, uint8_t app_id) {
                    tBTA_HH_ATTR_MASK attr_mask, uint8_t app_id,
                    tAclLinkSpec& link_spec) {
  bool new_device = false;

  if (dev_handle == BTA_HH_INVALID_HANDLE) {
@@ -457,8 +458,8 @@ bool bta_hh_co_open(uint8_t dev_handle, uint8_t sub_class,

    p_dev->uhid.fd = -1;
    p_dev->uhid.hh_keep_polling = 0;
    p_dev->uhid.link_spec = p_dev->link_spec;
    p_dev->uhid.dev_handle = p_dev->dev_handle;
    p_dev->uhid.link_spec = link_spec;
    p_dev->uhid.dev_handle = dev_handle;
    p_dev->attr_mask = attr_mask;
    p_dev->sub_class = sub_class;
    p_dev->app_id = app_id;
+2 −2
Original line number Diff line number Diff line
@@ -556,8 +556,8 @@ static void hh_open_handler(tBTA_HH_CONN& conn) {
  }

  /* Initialize device driver */
  if (!bta_hh_co_open(conn.handle, conn.sub_class, conn.attr_mask,
                      conn.app_id)) {
  if (!bta_hh_co_open(conn.handle, conn.sub_class, conn.attr_mask, conn.app_id,
                      conn.link_spec)) {
    log::warn("Failed to find the uhid driver");
    hh_connect_complete(conn.handle, conn.link_spec, BTIF_HH_DEV_DISCONNECTED);
    return;
+2 −1
Original line number Diff line number Diff line
@@ -49,7 +49,8 @@ void bta_hh_co_get_rpt_rsp(uint8_t /* dev_handle */, uint8_t /* status */,
  inc_func_call_count(__func__);
}
bool bta_hh_co_open(uint8_t /* dev_handle */, uint8_t /* sub_class */,
                    tBTA_HH_ATTR_MASK /* attr_mask */, uint8_t /* app_id */) {
                    tBTA_HH_ATTR_MASK /* attr_mask */, uint8_t /* app_id */,
                    tAclLinkSpec& /* link_spec */) {
  inc_func_call_count(__func__);
  return true;
}