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

Commit a6eb8059 authored by Adam Hampson's avatar Adam Hampson
Browse files

bluetooth: hid: store ssr_max_latency and ssr_min_tout in bonding db



Store the ssr_max_latency and ssr_min_tout parameters in the
bonding database.  Previously these parameters were not stored for HID
devices.  This caused an inconsistency in sniff behavior between
when the HID device was paired and following a reboot of the host.

When the HID device is paired the SSR parameters are retrieved
from the HID device and are stored in the HID Host's device list.
If the host is rebooted then the HID Host's device list is
constructed from the bonding database.

If the SSR max latency is non-zero then the SSR parameters are
sent to the firmware and SSR is used.  In the event that the SSR
max latency is 0, as it is if the parameters are not found, then
SSR is disabled.

Bug: 12764547

Change-Id: I63637575fdfcf4cb4ca0ce8dc2e4ccda9cccaf66
Signed-off-by: default avatarAdam Hampson <ahampson@google.com>
parent a451e1c6
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -236,7 +236,8 @@ bt_status_t btif_storage_add_hid_device_info(bt_bdaddr_t *remote_bd_addr,
                                                    UINT16 attr_mask, UINT8 sub_class,
                                                    UINT8 app_id, UINT16 vendor_id,
                                                    UINT16 product_id, UINT16 version,
                                                    UINT8 ctry_code, UINT16 dl_len, UINT8 *dsc_list);
                                                    UINT8 ctry_code, UINT16 ssr_max_latency,
                                                    UINT16 ssr_min_tout, UINT16 dl_len, UINT8 *dsc_list);

/*******************************************************************************
**
+1 −0
Original line number Diff line number Diff line
@@ -975,6 +975,7 @@ static void btif_hh_upstreams_evt(UINT16 event, char* p_param)
                    ret = btif_storage_add_hid_device_info(&(p_dev->bd_addr), p_dev->attr_mask,p_dev->sub_class,p_dev->app_id,
                                                        p_data->dscp_info.vendor_id, p_data->dscp_info.product_id,
                                                        p_data->dscp_info.version,   p_data->dscp_info.ctry_code,
                                                        p_data->dscp_info.ssr_max_latency, p_data->dscp_info.ssr_min_tout,
                                                        len, p_data->dscp_info.descriptor.dsc_list);

                    ASSERTC(ret == BT_STATUS_SUCCESS, "storing hid info failed", ret);
+14 −1
Original line number Diff line number Diff line
@@ -1359,7 +1359,8 @@ bt_status_t btif_storage_add_hid_device_info(bt_bdaddr_t *remote_bd_addr,
                                                    UINT16 attr_mask, UINT8 sub_class,
                                                    UINT8 app_id, UINT16 vendor_id,
                                                    UINT16 product_id, UINT16 version,
                                                    UINT8 ctry_code, UINT16 dl_len, UINT8 *dsc_list)
                                                    UINT8 ctry_code, UINT16 ssr_max_latency,
                                                    UINT16 ssr_min_tout, UINT16 dl_len, UINT8 *dsc_list)
{
    bdstr_t bdstr;
    BTIF_TRACE_DEBUG0("btif_storage_add_hid_device_info:");
@@ -1371,6 +1372,8 @@ bt_status_t btif_storage_add_hid_device_info(bt_bdaddr_t *remote_bd_addr,
    btif_config_set_int("Remote", bdstr, "HidProductId", product_id);
    btif_config_set_int("Remote", bdstr, "HidVersion", version);
    btif_config_set_int("Remote", bdstr, "HidCountryCode", ctry_code);
    btif_config_set_int("Remote", bdstr, "HidSSRMaxLatency", ssr_max_latency);
    btif_config_set_int("Remote", bdstr, "HidSSRMinTimeout", ssr_min_tout);
    if(dl_len > 0)
        btif_config_set("Remote", bdstr, "HidDescriptor", (const char*)dsc_list, dl_len,
                        BTIF_CFG_TYPE_BIN);
@@ -1431,6 +1434,14 @@ bt_status_t btif_storage_load_bonded_hid_info(void)
            btif_config_get_int("Remote", kname, "HidCountryCode", &value);
            dscp_info.ctry_code = (uint8_t) value;

            value = 0;
            btif_config_get_int("Remote", kname, "HidSSRMaxLatency", &value);
            dscp_info.ssr_max_latency = (uint16_t) value;

            value = 0;
            btif_config_get_int("Remote", kname, "HidSSRMinTimeout", &value);
            dscp_info.ssr_min_tout = (uint16_t) value;

            int len = 0;
            int type;
            btif_config_get("Remote", kname, "HidDescriptor", NULL, &len, &type);
@@ -1477,6 +1488,8 @@ bt_status_t btif_storage_remove_hid_info(bt_bdaddr_t *remote_bd_addr)
    btif_config_remove("Remote", bdstr, "HidProductId");
    btif_config_remove("Remote", bdstr, "HidVersion");
    btif_config_remove("Remote", bdstr, "HidCountryCode");
    btif_config_remove("Remote", bdstr, "HidSSRMaxLatency");
    btif_config_remove("Remote", bdstr, "HidSSRMinTimeout");
    btif_config_remove("Remote", bdstr, "HidDescriptor");
    btif_config_save();
    return BT_STATUS_SUCCESS;