From 9053e0c3182cecf1ea737ef9a7f60ff7f818cdc3 Mon Sep 17 00:00:00 2001 From: Isaac Hermida Date: Fri, 3 Nov 2017 18:21:50 +0100 Subject: [PATCH] bluez: Fix BR/EDR pairing for dual mode devices Subset of commits to fix the pairing for dual mode devices. Main commit that fixes is 2d3685252a21cda4b918ad1cc4dd0572bd5c6d3c, but some previous commits are required as well. """ For dual mode devices we need to pass address type used in pairing events to reply with correct one on agent reply. Otherwise reply for BR/EDR pairing of dual mode device would use address type (which is valid only for LE address) resulting in reply being ignored by kernel and eventually pairing timeout. """ https://jira.digi.com/browse/DEL-5226 Signed-off-by: Isaac Hermida --- ...DR-over-LE-if-it-set-in-advertisemen.patch | 47 +++++ ...Fix-not-connecting-services-properly.patch | 38 ++++ ...device-Fix-marking-auto-connect-flag.patch | 29 +++ ...refer-bonded-bearers-when-connecting.patch | 30 +++ ...ccept-and-.disconnect-instead-of-att.patch | 137 +++++++++++++ ...-bonding-while-failed-to-pair-device.patch | 99 +++++++++ ...BR-EDR-pairing-for-dual-mode-devices.patch | 189 ++++++++++++++++++ ... => 0012-QCA_bluetooth_chip_support.patch} | 0 ...spect-the-user-indication-for-noflo.patch} | 0 ...f-the-user-supplies-a-bdaddr-use-it.patch} | 0 ...0015-hciattach-Add-verbosity-option.patch} | 0 .../bluez/bluez5_5.41.bbappend | 15 +- 12 files changed, 580 insertions(+), 4 deletions(-) create mode 100644 meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0005-core-Prefer-BR-EDR-over-LE-if-it-set-in-advertisemen.patch create mode 100644 meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0006-core-device-Fix-not-connecting-services-properly.patch create mode 100644 meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0007-core-device-Fix-marking-auto-connect-flag.patch create mode 100644 meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0008-core-device-Prefer-bonded-bearers-when-connecting.patch create mode 100644 meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0009-input-hog-Use-.accept-and-.disconnect-instead-of-att.patch create mode 100644 meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0010-src-device-Free-bonding-while-failed-to-pair-device.patch create mode 100644 meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0011-core-Fix-BR-EDR-pairing-for-dual-mode-devices.patch rename meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/{0005-QCA_bluetooth_chip_support.patch => 0012-QCA_bluetooth_chip_support.patch} (100%) rename meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/{0006-hciattach_rome-Respect-the-user-indication-for-noflo.patch => 0013-hciattach_rome-Respect-the-user-indication-for-noflo.patch} (100%) rename meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/{0007-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch => 0014-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch} (100%) rename meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/{0008-hciattach-Add-verbosity-option.patch => 0015-hciattach-Add-verbosity-option.patch} (100%) diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0005-core-Prefer-BR-EDR-over-LE-if-it-set-in-advertisemen.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0005-core-Prefer-BR-EDR-over-LE-if-it-set-in-advertisemen.patch new file mode 100644 index 000000000..310dd5a1b --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0005-core-Prefer-BR-EDR-over-LE-if-it-set-in-advertisemen.patch @@ -0,0 +1,47 @@ +From 2f78f64aee11dde478fd76f1e15bb1b977ba7099 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz +Date: Wed, 10 Aug 2016 16:23:56 +0300 +Subject: [PATCH 1/7] core: Prefer BR/EDR over LE if it set in advertisement + flag + +This makes the code prefer BR/EDR if the last advertisement has it set +in the flags. +--- + src/adapter.c | 5 ++++- + src/device.c | 6 +++++- + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/src/adapter.c b/src/adapter.c +index 37423985dfb4..ddabf2de5462 100644 +--- a/src/adapter.c ++++ b/src/adapter.c +@@ -5488,8 +5488,11 @@ static void update_found_devices(struct btd_adapter *adapter, + * supports this we can make the non-zero check conditional. + */ + if (bdaddr_type != BDADDR_BREDR && eir_data.flags && +- !(eir_data.flags & EIR_BREDR_UNSUP)) ++ !(eir_data.flags & EIR_BREDR_UNSUP)) { + device_set_bredr_support(dev); ++ /* Update last seen for BR/EDR in case its flag is set */ ++ device_update_last_seen(dev, BDADDR_BREDR); ++ } + + if (eir_data.name != NULL && eir_data.name_complete) + device_store_cached_name(dev, eir_data.name); +diff --git a/src/device.c b/src/device.c +index 82704f8bb343..7f40af44cd01 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -1763,7 +1763,11 @@ static uint8_t select_conn_bearer(struct btd_device *dev) + if (dev->le && (!dev->bredr || bredr_last == NVAL_TIME)) + return dev->bdaddr_type; + +- if (bredr_last < le_last) ++ /* ++ * Prefer BR/EDR if time is the same since it might be from an ++ * advertisement with BR/EDR flag set. ++ */ ++ if (bredr_last <= le_last) + return BDADDR_BREDR; + + return dev->bdaddr_type; diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0006-core-device-Fix-not-connecting-services-properly.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0006-core-device-Fix-not-connecting-services-properly.patch new file mode 100644 index 000000000..11fa4e12f --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0006-core-device-Fix-not-connecting-services-properly.patch @@ -0,0 +1,38 @@ +From 727cf85d5c710193df9b386b2a87afccbbc766ff Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz +Date: Fri, 12 Aug 2016 11:20:10 +0300 +Subject: [PATCH 2/7] core/device: Fix not connecting services properly + +Device.Connect shall check if the service discovery is pending or no +service have been connected yet before switching to LE otherwise these +services may never be connected. +--- + src/device.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/src/device.c b/src/device.c +index 7f40af44cd01..460a9980fc63 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -1779,9 +1779,18 @@ static DBusMessage *dev_connect(DBusConnection *conn, DBusMessage *msg, + struct btd_device *dev = user_data; + uint8_t bdaddr_type; + +- if (dev->bredr_state.connected) +- bdaddr_type = dev->bdaddr_type; +- else if (dev->le_state.connected && dev->bredr) ++ if (dev->bredr_state.connected) { ++ /* ++ * Check if services have been resolved and there is at list ++ * one connected before switching to connect LE. ++ */ ++ if (dev->bredr_state.svc_resolved && ++ find_service_with_state(dev->services, ++ BTD_SERVICE_STATE_CONNECTED)) ++ bdaddr_type = dev->bdaddr_type; ++ else ++ bdaddr_type = BDADDR_BREDR; ++ } else if (dev->le_state.connected && dev->bredr) + bdaddr_type = BDADDR_BREDR; + else + bdaddr_type = select_conn_bearer(dev); diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0007-core-device-Fix-marking-auto-connect-flag.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0007-core-device-Fix-marking-auto-connect-flag.patch new file mode 100644 index 000000000..39278978b --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0007-core-device-Fix-marking-auto-connect-flag.patch @@ -0,0 +1,29 @@ +From 7e6b4a0de4580af0cefa8b3d45677f2f9f103f65 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz +Date: Mon, 22 Aug 2016 13:04:15 +0300 +Subject: [PATCH 3/7] core/device: Fix marking auto-connect flag + +Device auto-connect shall be set only if the profile is able to accept +incoming connections, this fixes the wrong behavior or connecting LE +with dual mode devices immediatelly after probing service as profiles +may have auto-connect flag for outgoing connection (usually BR/EDR only). +--- + src/device.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/device.c b/src/device.c +index 460a9980fc63..0b13a3190539 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -4084,7 +4084,10 @@ static struct btd_service *probe_service(struct btd_device *device, + return NULL; + } + +- if (profile->auto_connect) ++ /* Only set auto connect if profile has set the flag and can really ++ * accept connections. ++ */ ++ if (profile->auto_connect && profile->accept) + device_set_auto_connect(device, TRUE); + + return service; diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0008-core-device-Prefer-bonded-bearers-when-connecting.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0008-core-device-Prefer-bonded-bearers-when-connecting.patch new file mode 100644 index 000000000..bf111f2f2 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0008-core-device-Prefer-bonded-bearers-when-connecting.patch @@ -0,0 +1,30 @@ +From 3a908f611b0ea84e3388215ae800d9bec05b10b6 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz +Date: Tue, 23 Aug 2016 12:58:03 +0300 +Subject: [PATCH 4/7] core/device: Prefer bonded bearers when connecting + +When attempting to connect a dual-mode device prefer bonded bearer if +only one has been marked as bonded. This prevents connecting to a +different bearer after pairing is complete and cross transport pairing +is not supported. +--- + src/device.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/device.c b/src/device.c +index 0b13a3190539..ade74e58a3bf 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -1742,6 +1742,12 @@ static uint8_t select_conn_bearer(struct btd_device *dev) + time_t bredr_last = NVAL_TIME, le_last = NVAL_TIME; + time_t current = time(NULL); + ++ /* Prefer bonded bearer in case only one is bonded */ ++ if (dev->bredr_state.bonded && !dev->le_state.bonded ) ++ return BDADDR_BREDR; ++ else if (!dev->bredr_state.bonded && dev->le_state.bonded) ++ return dev->bdaddr_type; ++ + if (dev->bredr_seen) { + bredr_last = current - dev->bredr_seen; + if (bredr_last > SEEN_TRESHHOLD) diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0009-input-hog-Use-.accept-and-.disconnect-instead-of-att.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0009-input-hog-Use-.accept-and-.disconnect-instead-of-att.patch new file mode 100644 index 000000000..168932afc --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0009-input-hog-Use-.accept-and-.disconnect-instead-of-att.patch @@ -0,0 +1,137 @@ +From ddaa8ad58cd798c218ed9cc2c798cdaac6ed4924 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz +Date: Mon, 26 Sep 2016 16:44:03 +0300 +Subject: [PATCH 5/7] input/hog: Use .accept and .disconnect instead of attio + +This adds .accept and .disconnect callbacks instead of attio which +is deprecated. +--- + profiles/input/hog.c | 56 ++++++++++++++++++++++++++-------------------------- + src/device.c | 8 ++++++++ + src/device.h | 1 + + 3 files changed, 37 insertions(+), 28 deletions(-) + +diff --git a/profiles/input/hog.c b/profiles/input/hog.c +index a934c6238525..b25437917188 100644 +--- a/profiles/input/hog.c ++++ b/profiles/input/hog.c +@@ -69,24 +69,6 @@ struct hog_device { + static gboolean suspend_supported = FALSE; + static struct queue *devices = NULL; + +-static void attio_connected_cb(GAttrib *attrib, gpointer user_data) +-{ +- struct hog_device *dev = user_data; +- +- DBG("HoG connected"); +- +- bt_hog_attach(dev->hog, attrib); +-} +- +-static void attio_disconnected_cb(gpointer user_data) +-{ +- struct hog_device *dev = user_data; +- +- DBG("HoG disconnected"); +- +- bt_hog_detach(dev->hog); +-} +- + static struct hog_device *hog_device_new(struct btd_device *device, + struct gatt_primary *prim) + { +@@ -115,15 +97,6 @@ static struct hog_device *hog_device_new(struct btd_device *device, + + dev->device = btd_device_ref(device); + +- /* +- * TODO: Remove attio callback and use .accept once using +- * bt_gatt_client. +- */ +- dev->attioid = btd_device_add_attio_callback(device, +- attio_connected_cb, +- attio_disconnected_cb, +- dev); +- + if (!devices) + devices = queue_new(); + +@@ -142,7 +115,6 @@ static void hog_device_free(void *data) + devices = NULL; + } + +- btd_device_remove_attio_callback(dev->device, dev->attioid); + btd_device_unref(dev->device); + bt_hog_unref(dev->hog); + free(dev); +@@ -215,11 +187,39 @@ static void hog_remove(struct btd_service *service) + hog_device_free(dev); + } + ++static int hog_accept(struct btd_service *service) ++{ ++ struct hog_device *dev = btd_service_get_user_data(service); ++ struct btd_device *device = btd_service_get_device(service); ++ GAttrib *attrib = btd_device_get_attrib(device); ++ ++ /* TODO: Replace GAttrib with bt_gatt_client */ ++ bt_hog_attach(dev->hog, attrib); ++ ++ btd_service_connecting_complete(service, 0); ++ ++ return 0; ++} ++ ++static int hog_disconnect(struct btd_service *service) ++{ ++ struct hog_device *dev = btd_service_get_user_data(service); ++ ++ bt_hog_detach(dev->hog); ++ ++ btd_service_disconnecting_complete(service, 0); ++ ++ return 0; ++} ++ + static struct btd_profile hog_profile = { + .name = "input-hog", + .remote_uuid = HOG_UUID, + .device_probe = hog_probe, + .device_remove = hog_remove, ++ .accept = hog_accept, ++ .disconnect = hog_disconnect, ++ .auto_connect = true, + }; + + static int hog_init(void) +diff --git a/src/device.c b/src/device.c +index ade74e58a3bf..2a77a2e67232 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -5921,6 +5921,14 @@ struct bt_gatt_client *btd_device_get_gatt_client(struct btd_device *device) + return device->client; + } + ++void *btd_device_get_attrib(struct btd_device *device) ++{ ++ if (!device) ++ return NULL; ++ ++ return device->attrib; ++} ++ + struct bt_gatt_server *btd_device_get_gatt_server(struct btd_device *device) + { + if (!device) +diff --git a/src/device.h b/src/device.h +index db108278a12e..387f598fb2e5 100644 +--- a/src/device.h ++++ b/src/device.h +@@ -70,6 +70,7 @@ GSList *btd_device_get_primaries(struct btd_device *device); + struct gatt_db *btd_device_get_gatt_db(struct btd_device *device); + struct bt_gatt_client *btd_device_get_gatt_client(struct btd_device *device); + struct bt_gatt_server *btd_device_get_gatt_server(struct btd_device *device); ++void *btd_device_get_attrib(struct btd_device *device); + void btd_device_gatt_set_service_changed(struct btd_device *device, + uint16_t start, uint16_t end); + bool device_attach_att(struct btd_device *dev, GIOChannel *io); diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0010-src-device-Free-bonding-while-failed-to-pair-device.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0010-src-device-Free-bonding-while-failed-to-pair-device.patch new file mode 100644 index 000000000..3e11556d4 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0010-src-device-Free-bonding-while-failed-to-pair-device.patch @@ -0,0 +1,99 @@ +From c0202538bc31e25f37fc45681d07873c8a127ecb Mon Sep 17 00:00:00 2001 +From: Jiangbo Wu +Date: Sun, 2 Oct 2016 20:38:31 +0800 +Subject: [PATCH 6/7] src/device: Free bonding while failed to pair device + +device unable pair since another pairng is in progress, and need to +free bonding before it created for next pairing. +--- + src/device.c | 62 +++++++++++++++++++++++++++++++----------------------------- + 1 file changed, 32 insertions(+), 30 deletions(-) + +diff --git a/src/device.c b/src/device.c +index 2a77a2e67232..97d7c4e899f6 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -2330,6 +2330,35 @@ static void create_bond_req_exit(DBusConnection *conn, void *user_data) + } + } + ++static void bonding_request_free(struct bonding_req *bonding) ++{ ++ if (!bonding) ++ return; ++ ++ if (bonding->listener_id) ++ g_dbus_remove_watch(dbus_conn, bonding->listener_id); ++ ++ if (bonding->msg) ++ dbus_message_unref(bonding->msg); ++ ++ if (bonding->cb_iter) ++ g_free(bonding->cb_iter); ++ ++ if (bonding->agent) { ++ agent_cancel(bonding->agent); ++ agent_unref(bonding->agent); ++ bonding->agent = NULL; ++ } ++ ++ if (bonding->retry_timer) ++ g_source_remove(bonding->retry_timer); ++ ++ if (bonding->device) ++ bonding->device->bonding = NULL; ++ ++ g_free(bonding); ++} ++ + static DBusMessage *pair_device(DBusConnection *conn, DBusMessage *msg, + void *data) + { +@@ -2400,8 +2429,10 @@ static DBusMessage *pair_device(DBusConnection *conn, DBusMessage *msg, + BDADDR_BREDR, io_cap); + } + +- if (err < 0) ++ if (err < 0) { ++ bonding_request_free(device->bonding); + return btd_error_failed(msg, strerror(-err)); ++ } + + return NULL; + } +@@ -2442,35 +2473,6 @@ static DBusMessage *new_authentication_return(DBusMessage *msg, uint8_t status) + } + } + +-static void bonding_request_free(struct bonding_req *bonding) +-{ +- if (!bonding) +- return; +- +- if (bonding->listener_id) +- g_dbus_remove_watch(dbus_conn, bonding->listener_id); +- +- if (bonding->msg) +- dbus_message_unref(bonding->msg); +- +- if (bonding->cb_iter) +- g_free(bonding->cb_iter); +- +- if (bonding->agent) { +- agent_cancel(bonding->agent); +- agent_unref(bonding->agent); +- bonding->agent = NULL; +- } +- +- if (bonding->retry_timer) +- g_source_remove(bonding->retry_timer); +- +- if (bonding->device) +- bonding->device->bonding = NULL; +- +- g_free(bonding); +-} +- + static void device_cancel_bonding(struct btd_device *device, uint8_t status) + { + struct bonding_req *bonding = device->bonding; diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0011-core-Fix-BR-EDR-pairing-for-dual-mode-devices.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0011-core-Fix-BR-EDR-pairing-for-dual-mode-devices.patch new file mode 100644 index 000000000..f667587a9 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0011-core-Fix-BR-EDR-pairing-for-dual-mode-devices.patch @@ -0,0 +1,189 @@ +From 4fbef59d01931111c3181194ec4d38cbcb4da45a Mon Sep 17 00:00:00 2001 +From: Szymon Janc +Date: Fri, 21 Oct 2016 21:41:18 +0200 +Subject: [PATCH 7/7] core: Fix BR/EDR pairing for dual mode devices + +For dual mode devices we need to pass address type used in pairing +events to reply with correct one on agent reply. Otherwise reply for +BR/EDR pairing of dual mode device would use address type (which is +valid only for LE address) resulting in reply being ignored by kernel +and eventually pairing timeout. +--- + src/adapter.c | 7 ++++--- + src/device.c | 31 +++++++++++++++++-------------- + src/device.h | 10 +++++----- + 3 files changed, 26 insertions(+), 22 deletions(-) + +diff --git a/src/adapter.c b/src/adapter.c +index ddabf2de5462..5ebe3d7c8eec 100644 +--- a/src/adapter.c ++++ b/src/adapter.c +@@ -6180,7 +6180,7 @@ static void user_confirm_request_callback(uint16_t index, uint16_t length, + return; + } + +- err = device_confirm_passkey(device, btohl(ev->value), ++ err = device_confirm_passkey(device, ev->addr.type, btohl(ev->value), + ev->confirm_hint); + if (err < 0) { + btd_error(adapter->dev_id, +@@ -6254,7 +6254,7 @@ static void user_passkey_request_callback(uint16_t index, uint16_t length, + return; + } + +- err = device_request_passkey(device); ++ err = device_request_passkey(device, ev->addr.type); + if (err < 0) { + btd_error(adapter->dev_id, + "device_request_passkey: %s", strerror(-err)); +@@ -6293,7 +6293,8 @@ static void user_passkey_notify_callback(uint16_t index, uint16_t length, + + DBG("passkey %06u entered %u", passkey, ev->entered); + +- err = device_notify_passkey(device, passkey, ev->entered); ++ err = device_notify_passkey(device, ev->addr.type, passkey, ++ ev->entered); + if (err < 0) + btd_error(adapter->dev_id, + "device_notify_passkey: %s", strerror(-err)); +diff --git a/src/device.c b/src/device.c +index 97d7c4e899f6..d6be3fcf82c2 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -127,6 +127,7 @@ struct authentication_req { + auth_type_t type; + struct agent *agent; + struct btd_device *device; ++ uint8_t addr_type; + uint32_t passkey; + char *pincode; + gboolean secure; +@@ -5644,7 +5645,7 @@ static void confirm_cb(struct agent *agent, DBusError *err, void *data) + return; + + btd_adapter_confirm_reply(device->adapter, &device->bdaddr, +- device->bdaddr_type, ++ auth->addr_type, + err ? FALSE : TRUE); + + agent_unref(device->authr->agent); +@@ -5665,7 +5666,7 @@ static void passkey_cb(struct agent *agent, DBusError *err, + passkey = INVALID_PASSKEY; + + btd_adapter_passkey_reply(device->adapter, &device->bdaddr, +- device->bdaddr_type, passkey); ++ auth->addr_type, passkey); + + agent_unref(device->authr->agent); + device->authr->agent = NULL; +@@ -5683,7 +5684,9 @@ static void display_pincode_cb(struct agent *agent, DBusError *err, void *data) + } + + static struct authentication_req *new_auth(struct btd_device *device, +- auth_type_t type, gboolean secure) ++ uint8_t addr_type, ++ auth_type_t type, ++ gboolean secure) + { + struct authentication_req *auth; + struct agent *agent; +@@ -5711,6 +5714,7 @@ static struct authentication_req *new_auth(struct btd_device *device, + auth->agent = agent; + auth->device = device; + auth->type = type; ++ auth->addr_type = addr_type; + auth->secure = secure; + device->authr = auth; + +@@ -5722,7 +5726,7 @@ int device_request_pincode(struct btd_device *device, gboolean secure) + struct authentication_req *auth; + int err; + +- auth = new_auth(device, AUTH_TYPE_PINCODE, secure); ++ auth = new_auth(device, BDADDR_BREDR, AUTH_TYPE_PINCODE, secure); + if (!auth) + return -EPERM; + +@@ -5736,12 +5740,12 @@ int device_request_pincode(struct btd_device *device, gboolean secure) + return err; + } + +-int device_request_passkey(struct btd_device *device) ++int device_request_passkey(struct btd_device *device, uint8_t type) + { + struct authentication_req *auth; + int err; + +- auth = new_auth(device, AUTH_TYPE_PASSKEY, FALSE); ++ auth = new_auth(device, type, AUTH_TYPE_PASSKEY, FALSE); + if (!auth) + return -EPERM; + +@@ -5755,14 +5759,13 @@ int device_request_passkey(struct btd_device *device) + return err; + } + +-int device_confirm_passkey(struct btd_device *device, uint32_t passkey, +- uint8_t confirm_hint) +- ++int device_confirm_passkey(struct btd_device *device, uint8_t type, ++ int32_t passkey, uint8_t confirm_hint) + { + struct authentication_req *auth; + int err; + +- auth = new_auth(device, AUTH_TYPE_CONFIRM, FALSE); ++ auth = new_auth(device, type, AUTH_TYPE_CONFIRM, FALSE); + if (!auth) + return -EPERM; + +@@ -5783,8 +5786,8 @@ int device_confirm_passkey(struct btd_device *device, uint32_t passkey, + return err; + } + +-int device_notify_passkey(struct btd_device *device, uint32_t passkey, +- uint8_t entered) ++int device_notify_passkey(struct btd_device *device, uint8_t type, ++ uint32_t passkey, uint8_t entered) + { + struct authentication_req *auth; + int err; +@@ -5794,7 +5797,7 @@ int device_notify_passkey(struct btd_device *device, uint32_t passkey, + if (auth->type != AUTH_TYPE_NOTIFY_PASSKEY) + return -EPERM; + } else { +- auth = new_auth(device, AUTH_TYPE_NOTIFY_PASSKEY, FALSE); ++ auth = new_auth(device, type, AUTH_TYPE_NOTIFY_PASSKEY, FALSE); + if (!auth) + return -EPERM; + } +@@ -5814,7 +5817,7 @@ int device_notify_pincode(struct btd_device *device, gboolean secure, + struct authentication_req *auth; + int err; + +- auth = new_auth(device, AUTH_TYPE_NOTIFY_PINCODE, secure); ++ auth = new_auth(device, BDADDR_BREDR, AUTH_TYPE_NOTIFY_PINCODE, secure); + if (!auth) + return -EPERM; + +diff --git a/src/device.h b/src/device.h +index 387f598fb2e5..dd7c4f300be1 100644 +--- a/src/device.h ++++ b/src/device.h +@@ -110,11 +110,11 @@ int device_bonding_attempt_retry(struct btd_device *device); + long device_bonding_last_duration(struct btd_device *device); + void device_bonding_restart_timer(struct btd_device *device); + int device_request_pincode(struct btd_device *device, gboolean secure); +-int device_request_passkey(struct btd_device *device); +-int device_confirm_passkey(struct btd_device *device, uint32_t passkey, +- uint8_t confirm_hint); +-int device_notify_passkey(struct btd_device *device, uint32_t passkey, +- uint8_t entered); ++int device_request_passkey(struct btd_device *device, uint8_t type); ++int device_confirm_passkey(struct btd_device *device, uint8_t type, ++ int32_t passkey, uint8_t confirm_hint); ++int device_notify_passkey(struct btd_device *device, uint8_t type, ++ uint32_t passkey, uint8_t entered); + int device_notify_pincode(struct btd_device *device, gboolean secure, + const char *pincode); + void device_cancel_authentication(struct btd_device *device, gboolean aborted); diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0005-QCA_bluetooth_chip_support.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0012-QCA_bluetooth_chip_support.patch similarity index 100% rename from meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0005-QCA_bluetooth_chip_support.patch rename to meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0012-QCA_bluetooth_chip_support.patch diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0006-hciattach_rome-Respect-the-user-indication-for-noflo.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0013-hciattach_rome-Respect-the-user-indication-for-noflo.patch similarity index 100% rename from meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0006-hciattach_rome-Respect-the-user-indication-for-noflo.patch rename to meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0013-hciattach_rome-Respect-the-user-indication-for-noflo.patch diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0007-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0014-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch similarity index 100% rename from meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0007-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch rename to meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0014-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0008-hciattach-Add-verbosity-option.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0015-hciattach-Add-verbosity-option.patch similarity index 100% rename from meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0008-hciattach-Add-verbosity-option.patch rename to meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0015-hciattach-Add-verbosity-option.patch diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5_5.41.bbappend b/meta-digi-dey/recipes-connectivity/bluez/bluez5_5.41.bbappend index c75e99a53..2c7439747 100644 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5_5.41.bbappend +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5_5.41.bbappend @@ -9,13 +9,20 @@ SRC_URI += " \ file://0002-hcitool-increase-the-shown-connection-limit-to-20.patch \ file://0003-port-test-discovery-to-python3.patch \ file://0004-example-gatt-server-update-example-to-master-version.patch \ + file://0005-core-Prefer-BR-EDR-over-LE-if-it-set-in-advertisemen.patch \ + file://0006-core-device-Fix-not-connecting-services-properly.patch \ + file://0007-core-device-Fix-marking-auto-connect-flag.patch \ + file://0008-core-device-Prefer-bonded-bearers-when-connecting.patch \ + file://0009-input-hog-Use-.accept-and-.disconnect-instead-of-att.patch \ + file://0010-src-device-Free-bonding-while-failed-to-pair-device.patch \ + file://0011-core-Fix-BR-EDR-pairing-for-dual-mode-devices.patch \ " QCA6564_COMMON_PATCHES = " \ - file://0005-QCA_bluetooth_chip_support.patch \ - file://0006-hciattach_rome-Respect-the-user-indication-for-noflo.patch \ - file://0007-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch \ - file://0008-hciattach-Add-verbosity-option.patch \ + file://0012-QCA_bluetooth_chip_support.patch \ + file://0013-hciattach_rome-Respect-the-user-indication-for-noflo.patch \ + file://0014-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch \ + file://0015-hciattach-Add-verbosity-option.patch \ " SRC_URI_append_ccimx6ul = " ${QCA6564_COMMON_PATCHES}"