summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArchie Pusaka <apusaka@chromium.org>2020-08-18 15:34:09 +0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2020-08-18 16:50:40 -0700
commitebfa306d97b5020bf5ae55ab3821facfaf1c053c (patch)
tree0da79954a58f66b6eae76a4e8f71def4c48c0819 /src
parentd081375efc2a1425aab052472048472a4736ff61 (diff)
downloadbluez-ebfa306d97b5020bf5ae55ab3821facfaf1c053c.tar.gz
device: Don't browse SDP if HIDSDPDisable is set
According to the HID1.1 spec, part 5.3.4.9: The HIDSDPDisable attribute is a Boolean value, which indicates whether connection to the SDP channel and Control or Interrupt channels are mutually exclusive. This feature supports Bluetooth HID devices that have minimal resources, and multiplex those resources between servicing the initialization (SDP) and runtime (Control and Interrupt) channels. However, Bluez still tries to connect SDP upon HID connection, regardless of the existence of the HIDSDPDisable attribute. This patch prevents the connection of SDP after HID has been established, if the device has HIDSDPDisable attribute.
Diffstat (limited to 'src')
-rw-r--r--src/device.c11
-rw-r--r--src/device.h1
2 files changed, 10 insertions, 2 deletions
diff --git a/src/device.c b/src/device.c
index bb8e07e8f..f7f8948dc 100644
--- a/src/device.c
+++ b/src/device.c
@@ -195,6 +195,7 @@ struct btd_device {
bool le;
bool pending_paired; /* "Paired" waiting for SDP */
bool svc_refreshed;
+ bool refresh_discovery;
/* Manage whether this device can wake the system from suspend.
* - wake_support: Requires a profile that supports wake (i.e. HID)
@@ -1472,7 +1473,6 @@ static gboolean dev_property_wake_allowed_exist(
return device_get_wake_support(device);
}
-
static gboolean disconnect_all(gpointer user_data)
{
struct btd_device *device = user_data;
@@ -1805,7 +1805,7 @@ done:
btd_error_failed(dev->connect, strerror(-err)));
} else {
/* Start passive SDP discovery to update known services */
- if (dev->bredr && !dev->svc_refreshed)
+ if (dev->bredr && !dev->svc_refreshed && dev->refresh_discovery)
device_browse_sdp(dev, NULL);
g_dbus_send_reply(dbus_conn, dev->connect, DBUS_TYPE_INVALID);
}
@@ -2572,6 +2572,11 @@ done:
browse_request_free(req);
}
+void device_set_refresh_discovery(struct btd_device *dev, bool refresh)
+{
+ dev->refresh_discovery = refresh;
+}
+
static void device_set_svc_refreshed(struct btd_device *device, bool value)
{
if (device->svc_refreshed == value)
@@ -4071,6 +4076,8 @@ static struct btd_device *device_new(struct btd_adapter *adapter,
device->db_id = gatt_db_register(device->db, gatt_service_added,
gatt_service_removed, device, NULL);
+ device->refresh_discovery = true;
+
return btd_device_ref(device);
}
diff --git a/src/device.h b/src/device.h
index 956fec1ae..3cd090786 100644
--- a/src/device.h
+++ b/src/device.h
@@ -146,6 +146,7 @@ void device_set_wake_override(struct btd_device *device, bool wake_override);
void device_set_wake_allowed(struct btd_device *device, bool wake_allowed,
guint32 id);
void device_set_wake_allowed_complete(struct btd_device *device);
+void device_set_refresh_discovery(struct btd_device *dev, bool refresh);
typedef void (*disconnect_watch) (struct btd_device *device, gboolean removal,
void *user_data);