Message ID | 6387d20af8252ea1198c81afe728a9f67cd6bf77.1677179059.git.pav@iki.fi |
---|---|
State | New |
Headers | show |
Series | [BlueZ] device: wait GATT client ready before service accept() if no cache | expand |
Hello: This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>: On Thu, 23 Feb 2023 19:14:44 +0000 you wrote: > On device ATT attach, do not immediately call accept() for profiles, if > there is no cached data in GATT database. Instead, wait for service > resolution to complete, as likely accept() cannot succeed before that. > > Several profiles (bap, vcp, midi, deviceinfo) assume that GATT > attributes are available when their accept() is called, returning > success even if not. In this case, the services never find the remote > attributes and are not operable. Other profiles (hog, batt, ...) fail > their accept which prompts core to retry after discovery, and work > correctly also in this case. > > [...] Here is the summary with links: - [BlueZ] device: wait GATT client ready before service accept() if no cache https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=46a5d2beccb2 You are awesome, thank you!
diff --git a/src/device.c b/src/device.c index 28b93eb9a..d270421cc 100644 --- a/src/device.c +++ b/src/device.c @@ -5155,10 +5155,11 @@ static void gatt_client_init(struct btd_device *device) g_attrib_attach_client(device->attrib, device->client); /* - * Notify notify existing service about the new connection so they can - * react to notifications while discovering services + * If we have cache, notify existing service about the new connection + * so they can react to notifications while discovering services */ - device_accept_gatt_profiles(device); + if (!gatt_db_isempty(device->db)) + device_accept_gatt_profiles(device); device->gatt_ready_id = bt_gatt_client_ready_register(device->client, gatt_client_ready_cb,