rocko migration: bluez: adapt recipe
* 'experimental' has been renamed to 'testing' in Bluez 5.44 * Several patches (0004..0011) are now upstream and can be removed * QCA specific patches have been refreshed https://jira.digi.com/browse/DEL-5518 Signed-off-by: Jose Diaz de Grenu <Jose.DiazdeGrenu@digi.com>
This commit is contained in:
parent
3903708d1c
commit
0a89a7134d
|
|
@ -1,124 +0,0 @@
|
|||
From: Isaac Hermida <isaac.hermida@digi.com>
|
||||
Date: Wed, 27 Sep 2017 10:00:15 +0200
|
||||
Subject: [PATCH] example-gatt-server: update example to master version
|
||||
|
||||
Current test example was not registering correctly the services, so the BLEGATT
|
||||
server was not working properly.
|
||||
Update this example to current version in master (commit ed63d7e5a9f6).
|
||||
|
||||
Note: In order to run it, the bluetoothd daemon needs to be started with the
|
||||
experimental (-E) flag and needs to enable and advertise the BLE
|
||||
functionallity (btmgmt le on/connectable on/advertisement on).
|
||||
|
||||
https://jira.digi.com/browse/DEL-5023
|
||||
|
||||
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
|
||||
---
|
||||
test/example-gatt-server | 28 +++++++++++++++++++++-------
|
||||
1 file changed, 21 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/test/example-gatt-server b/test/example-gatt-server
|
||||
index 84905f3d0856..24aaff973b11 100755
|
||||
--- a/test/example-gatt-server
|
||||
+++ b/test/example-gatt-server
|
||||
@@ -42,6 +42,9 @@ class FailedException(dbus.exceptions.DBusException):
|
||||
|
||||
|
||||
class Application(dbus.service.Object):
|
||||
+ """
|
||||
+ org.bluez.GattApplication1 interface implementation
|
||||
+ """
|
||||
def __init__(self, bus):
|
||||
self.path = '/'
|
||||
self.services = []
|
||||
@@ -74,6 +77,9 @@ class Application(dbus.service.Object):
|
||||
|
||||
|
||||
class Service(dbus.service.Object):
|
||||
+ """
|
||||
+ org.bluez.GattService1 interface implementation
|
||||
+ """
|
||||
PATH_BASE = '/org/bluez/example/service'
|
||||
|
||||
def __init__(self, bus, index, uuid, primary):
|
||||
@@ -121,6 +127,9 @@ class Service(dbus.service.Object):
|
||||
|
||||
|
||||
class Characteristic(dbus.service.Object):
|
||||
+ """
|
||||
+ org.bluez.GattCharacteristic1 interface implementation
|
||||
+ """
|
||||
def __init__(self, bus, index, uuid, flags, service):
|
||||
self.path = service.path + '/char' + str(index)
|
||||
self.bus = bus
|
||||
@@ -195,6 +204,9 @@ class Characteristic(dbus.service.Object):
|
||||
|
||||
|
||||
class Descriptor(dbus.service.Object):
|
||||
+ """
|
||||
+ org.bluez.GattDescriptor1 interface implementation
|
||||
+ """
|
||||
def __init__(self, bus, index, uuid, flags, characteristic):
|
||||
self.path = characteristic.path + '/desc' + str(index)
|
||||
self.bus = bus
|
||||
@@ -222,7 +234,7 @@ class Descriptor(dbus.service.Object):
|
||||
if interface != GATT_DESC_IFACE:
|
||||
raise InvalidArgsException()
|
||||
|
||||
- return self.get_properties()[GATT_CHRC_IFACE]
|
||||
+ return self.get_properties()[GATT_DESC_IFACE]
|
||||
|
||||
@dbus.service.method(GATT_DESC_IFACE,
|
||||
in_signature='a{sv}',
|
||||
@@ -426,7 +438,7 @@ class TestService(Service):
|
||||
TEST_SVC_UUID = '12345678-1234-5678-1234-56789abcdef0'
|
||||
|
||||
def __init__(self, bus, index):
|
||||
- Service.__init__(self, bus, index, self.TEST_SVC_UUID, False)
|
||||
+ Service.__init__(self, bus, index, self.TEST_SVC_UUID, True)
|
||||
self.add_characteristic(TestCharacteristic(bus, 0, self))
|
||||
self.add_characteristic(TestEncryptCharacteristic(bus, 1, self))
|
||||
self.add_characteristic(TestSecureCharacteristic(bus, 2, self))
|
||||
@@ -523,11 +535,11 @@ class TestEncryptCharacteristic(Characteristic):
|
||||
CharacteristicUserDescriptionDescriptor(bus, 3, self))
|
||||
|
||||
def ReadValue(self, options):
|
||||
- print('TestCharacteristic Read: ' + repr(self.value))
|
||||
+ print('TestEncryptCharacteristic Read: ' + repr(self.value))
|
||||
return self.value
|
||||
|
||||
def WriteValue(self, value, options):
|
||||
- print('TestCharacteristic Write: ' + repr(value))
|
||||
+ print('TestEncryptCharacteristic Write: ' + repr(value))
|
||||
self.value = value
|
||||
|
||||
class TestEncryptDescriptor(Descriptor):
|
||||
@@ -564,16 +576,16 @@ class TestSecureCharacteristic(Characteristic):
|
||||
['secure-read', 'secure-write'],
|
||||
service)
|
||||
self.value = []
|
||||
- self.add_descriptor(TestEncryptDescriptor(bus, 2, self))
|
||||
+ self.add_descriptor(TestSecureDescriptor(bus, 2, self))
|
||||
self.add_descriptor(
|
||||
CharacteristicUserDescriptionDescriptor(bus, 3, self))
|
||||
|
||||
def ReadValue(self, options):
|
||||
- print('TestCharacteristic Read: ' + repr(self.value))
|
||||
+ print('TestSecureCharacteristic Read: ' + repr(self.value))
|
||||
return self.value
|
||||
|
||||
def WriteValue(self, value, options):
|
||||
- print('TestCharacteristic Write: ' + repr(value))
|
||||
+ print('TestSecureCharacteristic Write: ' + repr(value))
|
||||
self.value = value
|
||||
|
||||
|
||||
@@ -636,6 +648,8 @@ def main():
|
||||
|
||||
mainloop = GObject.MainLoop()
|
||||
|
||||
+ print('Registering GATT application...')
|
||||
+
|
||||
service_manager.RegisterApplication(app.get_path(), {},
|
||||
reply_handler=register_app_cb,
|
||||
error_handler=register_app_error_cb)
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
From 2f78f64aee11dde478fd76f1e15bb1b977ba7099 Mon Sep 17 00:00:00 2001
|
||||
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
|
||||
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;
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
From 727cf85d5c710193df9b386b2a87afccbbc766ff Mon Sep 17 00:00:00 2001
|
||||
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
|
||||
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);
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
From 7e6b4a0de4580af0cefa8b3d45677f2f9f103f65 Mon Sep 17 00:00:00 2001
|
||||
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
|
||||
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;
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
From 3a908f611b0ea84e3388215ae800d9bec05b10b6 Mon Sep 17 00:00:00 2001
|
||||
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
|
||||
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)
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
From ddaa8ad58cd798c218ed9cc2c798cdaac6ed4924 Mon Sep 17 00:00:00 2001
|
||||
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
|
||||
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);
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
From c0202538bc31e25f37fc45681d07873c8a127ecb Mon Sep 17 00:00:00 2001
|
||||
From: Jiangbo Wu <jiangbo.wu@intel.com>
|
||||
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;
|
||||
|
|
@ -1,189 +0,0 @@
|
|||
From 4fbef59d01931111c3181194ec4d38cbcb4da45a Mon Sep 17 00:00:00 2001
|
||||
From: Szymon Janc <szymon.janc@codecoup.pl>
|
||||
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);
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,6 +1,6 @@
|
|||
From: Alex Gonzalez <alex.gonzalez@digi.com>
|
||||
Date: Thu, 6 Apr 2017 09:27:09 +0200
|
||||
Subject: [PATCH] hciattach_rome: Respect the user indication for noflow
|
||||
From: Jose Diaz de Grenu <Jose.DiazdeGrenu@digi.com>
|
||||
Date: Mon, 8 Jan 2018 10:30:18 +0100
|
||||
Subject: [PATCH 2/4] hciattach_rome: Respect the user indication for noflow
|
||||
|
||||
When hciattach is called with noflow, it should not assume the hardware
|
||||
supports hardware flow control.
|
||||
|
|
@ -9,6 +9,7 @@ Basically, use 'flow' or 'noflow' on the hciattach command line arguments
|
|||
to indicate whether to use or not hardware flow control.
|
||||
|
||||
Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
|
||||
Signed-off-by: Jose Diaz de Grenu <Jose.DiazdeGrenu@digi.com>
|
||||
---
|
||||
tools/hciattach.c | 2 +-
|
||||
tools/hciattach.h | 2 +-
|
||||
|
|
@ -30,10 +31,10 @@ index dda639cabca3..81d78ab3f69a 100644
|
|||
|
||||
static int qualcomm(int fd, struct uart_t *u, struct termios *ti)
|
||||
diff --git a/tools/hciattach.h b/tools/hciattach.h
|
||||
index 49e59321fcac..3524e716c847 100644
|
||||
index 481e3a65f685..5f2764cca0b0 100644
|
||||
--- a/tools/hciattach.h
|
||||
+++ b/tools/hciattach.h
|
||||
@@ -64,7 +64,7 @@ int ath3k_init(int fd, int speed, int init_speed, char *bdaddr,
|
||||
@@ -67,7 +67,7 @@ int ath3k_init(int fd, int speed, int init_speed, char *bdaddr,
|
||||
struct termios *ti);
|
||||
int ath3k_post(int fd, int pm);
|
||||
int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr);
|
||||
|
|
@ -1,11 +1,12 @@
|
|||
From: Alex Gonzalez <alex.gonzalez@digi.com>
|
||||
Date: Thu, 6 Apr 2017 14:37:57 +0200
|
||||
Subject: [PATCH] hciattach: If the user supplies a bdaddr, use it
|
||||
From: Jose Diaz de Grenu <Jose.DiazdeGrenu@digi.com>
|
||||
Date: Mon, 8 Jan 2018 10:30:27 +0100
|
||||
Subject: [PATCH 3/4] hciattach: If the user supplies a bdaddr, use it
|
||||
|
||||
The QCA6564 has no non-volatile configuration file for the bluetooth
|
||||
MAC, so use the one supplied on the command line.
|
||||
|
||||
Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
|
||||
Signed-off-by: Jose Diaz de Grenu <Jose.DiazdeGrenu@digi.com>
|
||||
---
|
||||
tools/hciattach.c | 4 +--
|
||||
tools/hciattach_rome.c | 76 ++++++++++----------------------------------------
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
From: Alex Gonzalez <alex.gonzalez@digi.com>
|
||||
Date: Mon, 10 Apr 2017 12:44:00 +0200
|
||||
Subject: [PATCH] hciattach: Add verbosity option
|
||||
From: Jose Diaz de Grenu <Jose.DiazdeGrenu@digi.com>
|
||||
Date: Mon, 8 Jan 2018 10:30:49 +0100
|
||||
Subject: [PATCH 4/4] hciattach: Add verbosity option
|
||||
|
||||
And reduce the verbosity of the hciattach_rome plugin.
|
||||
|
||||
Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
|
||||
Signed-off-by: Jose Diaz de Grenu <Jose.DiazdeGrenu@digi.com>
|
||||
---
|
||||
lib/bluetooth.h | 3 +
|
||||
tools/hciattach.c | 13 ++-
|
||||
|
|
@ -8,21 +8,13 @@ SRC_URI += " \
|
|||
file://0001-hcitool-do-not-show-unsupported-refresh-option.patch \
|
||||
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://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 \
|
||||
file://0004-QCA_bluetooth_chip_support.patch \
|
||||
file://0005-hciattach_rome-Respect-the-user-indication-for-noflo.patch \
|
||||
file://0006-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch \
|
||||
file://0007-hciattach-Add-verbosity-option.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_ccimx6ul = " ${QCA6564_COMMON_PATCHES}"
|
||||
|
|
@ -30,14 +22,14 @@ SRC_URI_append_ccimx6qpsbc = " ${QCA6564_COMMON_PATCHES}"
|
|||
|
||||
inherit update-rc.d
|
||||
|
||||
PACKAGECONFIG_append = " experimental"
|
||||
PACKAGECONFIG_append = " testing"
|
||||
|
||||
do_install_append() {
|
||||
install -d ${D}${sysconfdir}/init.d/
|
||||
install -m 0755 ${WORKDIR}/bluetooth-init ${D}${sysconfdir}/init.d/bluetooth-init
|
||||
install -m 0644 ${WORKDIR}/main.conf ${D}${sysconfdir}/bluetooth/
|
||||
if [ -n "${@bb.utils.contains('PACKAGECONFIG', 'experimental', 'experimental', '', d)}" ]; then
|
||||
sed -i '/^SSD_OPTIONS/a SSD_OPTIONS="${SSD_OPTIONS} --experimental"' ${D}${INIT_D_DIR}/bluetooth
|
||||
if [ -n "${@bb.utils.contains('PACKAGECONFIG', 'testing', 'testing', '', d)}" ]; then
|
||||
sed -i '/^SSD_OPTIONS/a SSD_OPTIONS="${SSD_OPTIONS} --testing"' ${D}${INIT_D_DIR}/bluetooth
|
||||
fi
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue