bluez: add bluez 5.41
This is the stack covered by the Bluetooth certification. We will keep it even though the newer bluez 5.46 will be used by default. https://jira.digi.com/browse/DEL-5518 Signed-off-by: Jose Diaz de Grenu <Jose.DiazdeGrenu@digi.com>
This commit is contained in:
parent
0a89a7134d
commit
f4aee6cecc
|
|
@ -43,6 +43,11 @@ FEATURE_PACKAGES_dey-qt = "packagegroup-dey-qt"
|
||||||
FEATURE_PACKAGES_dey-trustfence = "packagegroup-dey-trustfence"
|
FEATURE_PACKAGES_dey-trustfence = "packagegroup-dey-trustfence"
|
||||||
FEATURE_PACKAGES_dey-wireless = "packagegroup-dey-wireless"
|
FEATURE_PACKAGES_dey-wireless = "packagegroup-dey-wireless"
|
||||||
|
|
||||||
|
# Our layer only provides version 5.41, which we want to keep because
|
||||||
|
# it was used for Bluetooth certification. However by default the newer
|
||||||
|
# 5.46 version should be used, which is provided by the poky layer.
|
||||||
|
PREFERRED_VERSION_bluez5 ?= "5.46"
|
||||||
|
|
||||||
# Set the PREFERRED_PROVIDER for jpeg functionality based on the MACHINE
|
# Set the PREFERRED_PROVIDER for jpeg functionality based on the MACHINE
|
||||||
# architecture. For armv7a devices libjpeg-turbo should be used to take
|
# architecture. For armv7a devices libjpeg-turbo should be used to take
|
||||||
# advantage of the SIMD instructions.
|
# advantage of the SIMD instructions.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
From: Giovanni Campagna <gcampagna-cNUdlRotFMnNLxjTenLetw@public.gmane.org>
|
||||||
|
Date: Sat, 12 Oct 2013 17:45:25 +0200
|
||||||
|
Subject: [PATCH] Allow using obexd without systemd in the user session
|
||||||
|
|
||||||
|
Not all sessions run systemd --user (actually, the majority
|
||||||
|
doesn't), so the dbus daemon must be able to spawn obexd
|
||||||
|
directly, and to do so it needs the full path of the daemon.
|
||||||
|
|
||||||
|
Upstream-Status: Denied
|
||||||
|
|
||||||
|
Not accepted by upstream maintainer for being a distro specific
|
||||||
|
configuration. See thread:
|
||||||
|
|
||||||
|
http://thread.gmane.org/gmane.linux.bluez.kernel/38725/focus=38843
|
||||||
|
|
||||||
|
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
|
||||||
|
---
|
||||||
|
Makefile.obexd | 4 ++--
|
||||||
|
obexd/src/org.bluez.obex.service | 4 ----
|
||||||
|
obexd/src/org.bluez.obex.service.in | 4 ++++
|
||||||
|
3 files changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
delete mode 100644 obexd/src/org.bluez.obex.service
|
||||||
|
create mode 100644 obexd/src/org.bluez.obex.service.in
|
||||||
|
|
||||||
|
diff --git a/Makefile.obexd b/Makefile.obexd
|
||||||
|
index 2e33cbc72f2b..d5d858c857b4 100644
|
||||||
|
--- a/Makefile.obexd
|
||||||
|
+++ b/Makefile.obexd
|
||||||
|
@@ -2,12 +2,12 @@
|
||||||
|
if SYSTEMD
|
||||||
|
systemduserunitdir = @SYSTEMD_USERUNITDIR@
|
||||||
|
systemduserunit_DATA = obexd/src/obex.service
|
||||||
|
+endif
|
||||||
|
|
||||||
|
dbussessionbusdir = @DBUS_SESSIONBUSDIR@
|
||||||
|
dbussessionbus_DATA = obexd/src/org.bluez.obex.service
|
||||||
|
-endif
|
||||||
|
|
||||||
|
-EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service
|
||||||
|
+EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service.in
|
||||||
|
|
||||||
|
obex_plugindir = $(libdir)/obex/plugins
|
||||||
|
|
||||||
|
diff --git a/obexd/src/org.bluez.obex.service b/obexd/src/org.bluez.obex.service
|
||||||
|
deleted file mode 100644
|
||||||
|
index a53808884554..000000000000
|
||||||
|
--- a/obexd/src/org.bluez.obex.service
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,4 +0,0 @@
|
||||||
|
-[D-BUS Service]
|
||||||
|
-Name=org.bluez.obex
|
||||||
|
-Exec=/bin/false
|
||||||
|
-SystemdService=dbus-org.bluez.obex.service
|
||||||
|
diff --git a/obexd/src/org.bluez.obex.service.in b/obexd/src/org.bluez.obex.service.in
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..9c815f246b77
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/obexd/src/org.bluez.obex.service.in
|
||||||
|
@@ -0,0 +1,4 @@
|
||||||
|
+[D-BUS Service]
|
||||||
|
+Name=org.bluez.obex
|
||||||
|
+Exec=@libexecdir@/obexd
|
||||||
|
+SystemdService=dbus-org.bluez.obex.service
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
From: Isaac Hermida <isaac.hermida@digi.com>
|
||||||
|
Date: Fri, 8 Jul 2016 12:19:33 +0200
|
||||||
|
Subject: [PATCH] hcitool: do not show unsupported refresh option
|
||||||
|
|
||||||
|
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
|
||||||
|
---
|
||||||
|
tools/hcitool.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/tools/hcitool.c b/tools/hcitool.c
|
||||||
|
index 02c4ebe1b71b..229c22c49909 100644
|
||||||
|
--- a/tools/hcitool.c
|
||||||
|
+++ b/tools/hcitool.c
|
||||||
|
@@ -568,7 +568,7 @@ static struct option scan_options[] = {
|
||||||
|
|
||||||
|
static const char *scan_help =
|
||||||
|
"Usage:\n"
|
||||||
|
- "\tscan [--length=N] [--numrsp=N] [--iac=lap] [--flush] [--class] [--info] [--oui] [--refresh]\n";
|
||||||
|
+ "\tscan [--length=N] [--numrsp=N] [--iac=lap] [--flush] [--class] [--info] [--oui]\n";
|
||||||
|
|
||||||
|
static void cmd_scan(int dev_id, int argc, char **argv)
|
||||||
|
{
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
From 4bdf0f96dcaa945fd29f26d56e5b36d8c23e4c8b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alexander Kanavin <alex.kanavin@gmail.com>
|
||||||
|
Date: Fri, 1 Apr 2016 17:07:34 +0300
|
||||||
|
Subject: [PATCH] tests: add a target for building tests without running them
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [oe specific]
|
||||||
|
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
|
||||||
|
---
|
||||||
|
Makefile.am | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/Makefile.am b/Makefile.am
|
||||||
|
index 1a48a71..ba3b92f 100644
|
||||||
|
--- a/Makefile.am
|
||||||
|
+++ b/Makefile.am
|
||||||
|
@@ -425,6 +425,9 @@ endif
|
||||||
|
TESTS = $(unit_tests)
|
||||||
|
AM_TESTS_ENVIRONMENT = MALLOC_CHECK_=3 MALLOC_PERTURB_=69
|
||||||
|
|
||||||
|
+# This allows building tests without running them
|
||||||
|
+buildtests: $(TESTS)
|
||||||
|
+
|
||||||
|
if DBUS_RUN_SESSION
|
||||||
|
AM_TESTS_ENVIRONMENT += dbus-run-session --
|
||||||
|
endif
|
||||||
|
--
|
||||||
|
2.8.0.rc3
|
||||||
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
From: Isaac Hermida <isaac.hermida@digi.com>
|
||||||
|
Date: Fri, 8 Jul 2016 10:42:57 +0200
|
||||||
|
Subject: [PATCH] hcitool: increase the shown connection limit to 20
|
||||||
|
|
||||||
|
Created a variable to set the number of connections to shown and increase that
|
||||||
|
value so we can list more current LE connections.
|
||||||
|
|
||||||
|
https://jira.digi.com/browse/DEL-2735
|
||||||
|
|
||||||
|
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
|
||||||
|
---
|
||||||
|
tools/hcitool.c | 10 ++++++----
|
||||||
|
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tools/hcitool.c b/tools/hcitool.c
|
||||||
|
index 229c22c49909..ae70c9c0d3b4 100644
|
||||||
|
--- a/tools/hcitool.c
|
||||||
|
+++ b/tools/hcitool.c
|
||||||
|
@@ -69,6 +69,8 @@
|
||||||
|
#define EIR_TX_POWER 0x0A /* transmit power level */
|
||||||
|
#define EIR_DEVICE_ID 0x10 /* device ID */
|
||||||
|
|
||||||
|
+#define MAX_CONNECTIONS_SHOWN 20 /* Max number of "hcitool conn" items to shown */
|
||||||
|
+
|
||||||
|
#define for_each_opt(opt, long, short) while ((opt=getopt_long(argc, argv, short ? short:"+", long, NULL)) != -1)
|
||||||
|
|
||||||
|
static volatile int signal_received = 0;
|
||||||
|
@@ -156,12 +158,12 @@ static int conn_list(int s, int dev_id, long arg)
|
||||||
|
if (id != -1 && dev_id != id)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
- if (!(cl = malloc(10 * sizeof(*ci) + sizeof(*cl)))) {
|
||||||
|
+ if (!(cl = malloc(MAX_CONNECTIONS_SHOWN * sizeof(*ci) + sizeof(*cl)))) {
|
||||||
|
perror("Can't allocate memory");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
cl->dev_id = dev_id;
|
||||||
|
- cl->conn_num = 10;
|
||||||
|
+ cl->conn_num = MAX_CONNECTIONS_SHOWN;
|
||||||
|
ci = cl->conn_info;
|
||||||
|
|
||||||
|
if (ioctl(s, HCIGETCONNLIST, (void *) cl)) {
|
||||||
|
@@ -190,12 +192,12 @@ static int find_conn(int s, int dev_id, long arg)
|
||||||
|
struct hci_conn_info *ci;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
- if (!(cl = malloc(10 * sizeof(*ci) + sizeof(*cl)))) {
|
||||||
|
+ if (!(cl = malloc(MAX_CONNECTIONS_SHOWN * sizeof(*ci) + sizeof(*cl)))) {
|
||||||
|
perror("Can't allocate memory");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
cl->dev_id = dev_id;
|
||||||
|
- cl->conn_num = 10;
|
||||||
|
+ cl->conn_num = MAX_CONNECTIONS_SHOWN;
|
||||||
|
ci = cl->conn_info;
|
||||||
|
|
||||||
|
if (ioctl(s, HCIGETCONNLIST, (void *) cl)) {
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
From: Isaac Hermida <isaac.hermida@digi.com>
|
||||||
|
Date: Thu, 3 Aug 2017 14:10:43 +0200
|
||||||
|
Subject: [PATCH] port test-discovery to python3
|
||||||
|
|
||||||
|
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
|
||||||
|
---
|
||||||
|
test/bluezutils.py | 4 ++--
|
||||||
|
test/test-discovery | 16 +++++++++-------
|
||||||
|
2 files changed, 11 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/test/bluezutils.py b/test/bluezutils.py
|
||||||
|
index de08cbdcb712..cd8964082450 100644
|
||||||
|
--- a/test/bluezutils.py
|
||||||
|
+++ b/test/bluezutils.py
|
||||||
|
@@ -15,7 +15,7 @@ def find_adapter(pattern=None):
|
||||||
|
|
||||||
|
def find_adapter_in_objects(objects, pattern=None):
|
||||||
|
bus = dbus.SystemBus()
|
||||||
|
- for path, ifaces in objects.iteritems():
|
||||||
|
+ for path, ifaces in objects.items():
|
||||||
|
adapter = ifaces.get(ADAPTER_INTERFACE)
|
||||||
|
if adapter is None:
|
||||||
|
continue
|
||||||
|
@@ -35,7 +35,7 @@ def find_device_in_objects(objects, device_address, adapter_pattern=None):
|
||||||
|
if adapter_pattern:
|
||||||
|
adapter = find_adapter_in_objects(objects, adapter_pattern)
|
||||||
|
path_prefix = adapter.object_path
|
||||||
|
- for path, ifaces in objects.iteritems():
|
||||||
|
+ for path, ifaces in objects.items():
|
||||||
|
device = ifaces.get(DEVICE_INTERFACE)
|
||||||
|
if device is None:
|
||||||
|
continue
|
||||||
|
diff --git a/test/test-discovery b/test/test-discovery
|
||||||
|
index cea77683d726..852611c862ea 100755
|
||||||
|
--- a/test/test-discovery
|
||||||
|
+++ b/test/test-discovery
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/python
|
||||||
|
+#!/usr/bin/python3
|
||||||
|
|
||||||
|
from __future__ import absolute_import, print_function, unicode_literals
|
||||||
|
|
||||||
|
@@ -18,9 +18,9 @@ def print_compact(address, properties):
|
||||||
|
name = ""
|
||||||
|
address = "<unknown>"
|
||||||
|
|
||||||
|
- for key, value in properties.iteritems():
|
||||||
|
+ for key, value in properties.items():
|
||||||
|
if type(value) is dbus.String:
|
||||||
|
- value = unicode(value).encode('ascii', 'replace')
|
||||||
|
+ value = str(value)
|
||||||
|
if (key == "Name"):
|
||||||
|
name = value
|
||||||
|
elif (key == "Address"):
|
||||||
|
@@ -41,7 +41,7 @@ def print_normal(address, properties):
|
||||||
|
for key in properties.keys():
|
||||||
|
value = properties[key]
|
||||||
|
if type(value) is dbus.String:
|
||||||
|
- value = unicode(value).encode('ascii', 'replace')
|
||||||
|
+ value = str(value)
|
||||||
|
if (key == "Class"):
|
||||||
|
print(" %s = 0x%06x" % (key, value))
|
||||||
|
else:
|
||||||
|
@@ -61,6 +61,8 @@ def skip_dev(old_dev, new_dev):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def interfaces_added(path, interfaces):
|
||||||
|
+ if "org.bluez.Device1" not in interfaces.keys():
|
||||||
|
+ return
|
||||||
|
properties = interfaces["org.bluez.Device1"]
|
||||||
|
if not properties:
|
||||||
|
return
|
||||||
|
@@ -70,7 +72,7 @@ def interfaces_added(path, interfaces):
|
||||||
|
|
||||||
|
if compact and skip_dev(dev, properties):
|
||||||
|
return
|
||||||
|
- devices[path] = dict(devices[path].items() + properties.items())
|
||||||
|
+ devices[path] = dict(list(devices[path].items()) + list(properties.items()))
|
||||||
|
else:
|
||||||
|
devices[path] = properties
|
||||||
|
|
||||||
|
@@ -93,7 +95,7 @@ def properties_changed(interface, changed, invalidated, path):
|
||||||
|
|
||||||
|
if compact and skip_dev(dev, changed):
|
||||||
|
return
|
||||||
|
- devices[path] = dict(devices[path].items() + changed.items())
|
||||||
|
+ devices[path] = dict(list(devices[path].items()) + list(changed.items()))
|
||||||
|
else:
|
||||||
|
devices[path] = changed
|
||||||
|
|
||||||
|
@@ -152,7 +154,7 @@ if __name__ == '__main__':
|
||||||
|
om = dbus.Interface(bus.get_object("org.bluez", "/"),
|
||||||
|
"org.freedesktop.DBus.ObjectManager")
|
||||||
|
objects = om.GetManagedObjects()
|
||||||
|
- for path, interfaces in objects.iteritems():
|
||||||
|
+ for path, interfaces in objects.items():
|
||||||
|
if "org.bluez.Device1" in interfaces:
|
||||||
|
devices[path] = interfaces["org.bluez.Device1"]
|
||||||
|
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
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)
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
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;
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
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);
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
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;
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
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)
|
||||||
|
|
@ -0,0 +1,137 @@
|
||||||
|
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);
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
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;
|
||||||
|
|
@ -0,0 +1,189 @@
|
||||||
|
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
|
|
@ -0,0 +1,186 @@
|
||||||
|
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
|
||||||
|
|
||||||
|
When hciattach is called with noflow, it should not assume the hardware
|
||||||
|
supports hardware flow control.
|
||||||
|
|
||||||
|
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>
|
||||||
|
---
|
||||||
|
tools/hciattach.c | 2 +-
|
||||||
|
tools/hciattach.h | 2 +-
|
||||||
|
tools/hciattach_rome.c | 50 +++++++++++++++++++++++++++++++++++---------------
|
||||||
|
tools/hciattach_rome.h | 1 +
|
||||||
|
4 files changed, 38 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tools/hciattach.c b/tools/hciattach.c
|
||||||
|
index dda639cabca3..81d78ab3f69a 100644
|
||||||
|
--- a/tools/hciattach.c
|
||||||
|
+++ b/tools/hciattach.c
|
||||||
|
@@ -286,7 +286,7 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti)
|
||||||
|
static int qca(int fd, struct uart_t *u, struct termios *ti)
|
||||||
|
{
|
||||||
|
fprintf(stderr,"qca\n");
|
||||||
|
- return qca_soc_init(fd, u->speed, u->bdaddr);
|
||||||
|
+ return qca_soc_init(fd, u->speed, u->bdaddr, ti);
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
--- a/tools/hciattach.h
|
||||||
|
+++ b/tools/hciattach.h
|
||||||
|
@@ -64,7 +64,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);
|
||||||
|
-int qca_soc_init(int fd, int speed, char *bdaddr);
|
||||||
|
+int qca_soc_init(int fd, int speed, char *bdaddr , struct termios * ti);
|
||||||
|
int intel_init(int fd, int init_speed, int *speed, struct termios *ti);
|
||||||
|
int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti,
|
||||||
|
const char *bdaddr);
|
||||||
|
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
|
||||||
|
index 59bdc16e4e8f..ee67bb068c09 100644
|
||||||
|
--- a/tools/hciattach_rome.c
|
||||||
|
+++ b/tools/hciattach_rome.c
|
||||||
|
@@ -1565,7 +1565,8 @@ static void flow_control(int fd, int opt)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-int rome_set_baudrate_req(int fd, int local_baud_rate, int controller_baud_rate)
|
||||||
|
+int rome_set_baudrate_req(int fd, int local_baud_rate,
|
||||||
|
+ int controller_baud_rate, int hwfc)
|
||||||
|
{
|
||||||
|
int size, err = 0;
|
||||||
|
unsigned char cmd[HCI_MAX_CMD_SIZE];
|
||||||
|
@@ -1575,6 +1576,12 @@ int rome_set_baudrate_req(int fd, int local_baud_rate, int controller_baud_rate)
|
||||||
|
|
||||||
|
memset(cmd, 0x0, HCI_MAX_CMD_SIZE);
|
||||||
|
|
||||||
|
+ /* If not using hardware flow control limit baud rate to 115200 */
|
||||||
|
+ if (!hwfc) {
|
||||||
|
+ local_baud_rate = USERIAL_BAUD_115200;
|
||||||
|
+ controller_baud_rate = BAUDRATE_115200;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
cmd_hdr = (void *) (cmd + 1);
|
||||||
|
cmd[0] = HCI_COMMAND_PKT;
|
||||||
|
cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF);
|
||||||
|
@@ -1621,7 +1628,7 @@ error:
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-int rome_hci_reset_req(int fd, char baud)
|
||||||
|
+int rome_hci_reset_req(int fd, char baud, int hwfc)
|
||||||
|
{
|
||||||
|
int size, err = 0;
|
||||||
|
unsigned char cmd[HCI_MAX_CMD_SIZE];
|
||||||
|
@@ -1641,8 +1648,9 @@ int rome_hci_reset_req(int fd, char baud)
|
||||||
|
/* Total length of the packet to be sent to the Controller */
|
||||||
|
size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE);
|
||||||
|
|
||||||
|
- /* Flow off during baudrate change */
|
||||||
|
- flow_control(fd, MSM_DISABLE_FLOW_CTRL);
|
||||||
|
+ /* If using hardware flow control, turn off during baudrate change */
|
||||||
|
+ if (hwfc)
|
||||||
|
+ flow_control(fd, MSM_DISABLE_FLOW_CTRL);
|
||||||
|
|
||||||
|
/* Send the HCI command packet to UART for transmission */
|
||||||
|
fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]);
|
||||||
|
@@ -1655,8 +1663,9 @@ int rome_hci_reset_req(int fd, char baud)
|
||||||
|
/* Change Local UART baudrate to high speed UART */
|
||||||
|
userial_vendor_set_baud(baud);
|
||||||
|
|
||||||
|
- /* Flow on after changing local uart baudrate */
|
||||||
|
- flow_control(fd, MSM_ENABLE_FLOW_CTRL);
|
||||||
|
+ /* If using hardware flow control, turn on after changing local uart baudrate */
|
||||||
|
+ if (hwfc)
|
||||||
|
+ flow_control(fd, MSM_ENABLE_FLOW_CTRL);
|
||||||
|
|
||||||
|
/* Wait for command complete event */
|
||||||
|
err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE);
|
||||||
|
@@ -1778,7 +1787,7 @@ int isSpeedValid(int speed, int *local_baud_rate, int *controller_baud_rate)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
-int qca_soc_init(int fd, int speed, char *bdaddr)
|
||||||
|
+int qca_soc_init(int fd, int speed, char *bdaddr , struct termios * ti)
|
||||||
|
{
|
||||||
|
int err = -1;
|
||||||
|
int size, local_baud_rate = 0, controller_baud_rate = 0;
|
||||||
|
@@ -1793,6 +1802,12 @@ int qca_soc_init(int fd, int speed, char *bdaddr)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
+
|
||||||
|
+ /* Assume we don't use hardware flow control unless user requested 'flow' */
|
||||||
|
+ vnd_userial.hwfc = 0;
|
||||||
|
+ if (ti->c_cflag & ~CRTSCTS)
|
||||||
|
+ vnd_userial.hwfc = 1;
|
||||||
|
+
|
||||||
|
/* Get Rome version information */
|
||||||
|
if((err = rome_patch_ver_req(fd)) <0){
|
||||||
|
fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err);
|
||||||
|
@@ -1838,11 +1853,14 @@ int qca_soc_init(int fd, int speed, char *bdaddr)
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
- /* Change baud rate 115.2 kbps to 3Mbps*/
|
||||||
|
- err = rome_hci_reset_req(fd, local_baud_rate);
|
||||||
|
- if ( err <0 ) {
|
||||||
|
- fprintf(stderr, "HCI Reset Failed !!\n");
|
||||||
|
- goto error;
|
||||||
|
+ /* If using hw flow control, change baud rate 115.2 kbps to 3Mbps*/
|
||||||
|
+ if (vnd_userial.hwfc) {
|
||||||
|
+ err = rome_hci_reset_req(fd, local_baud_rate,
|
||||||
|
+ vnd_userial.hwfc);
|
||||||
|
+ if ( err <0 ) {
|
||||||
|
+ fprintf(stderr, "HCI Reset Failed !!\n");
|
||||||
|
+ goto error;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "HCI Reset is done\n");
|
||||||
|
@@ -1888,7 +1906,8 @@ download:
|
||||||
|
if (local_baud_rate < 0 || controller_baud_rate < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
- err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate);
|
||||||
|
+ err = rome_set_baudrate_req(fd, local_baud_rate,
|
||||||
|
+ controller_baud_rate, vnd_userial.hwfc);
|
||||||
|
if (err < 0) {
|
||||||
|
fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__);
|
||||||
|
goto error;
|
||||||
|
@@ -1907,14 +1926,15 @@ download:
|
||||||
|
* Overriding the baud rate value in NVM file with the user
|
||||||
|
* requested baud rate, since default baud rate in NVM file is 3M.
|
||||||
|
*/
|
||||||
|
- err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate);
|
||||||
|
+ err = rome_set_baudrate_req(fd, local_baud_rate,
|
||||||
|
+ controller_baud_rate, vnd_userial.hwfc);
|
||||||
|
if (err < 0) {
|
||||||
|
fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Perform HCI reset here*/
|
||||||
|
- err = rome_hci_reset_req(fd, local_baud_rate);
|
||||||
|
+ err = rome_hci_reset_req(fd, local_baud_rate, vnd_userial.hwfc);
|
||||||
|
if ( err <0 ) {
|
||||||
|
fprintf(stderr, "HCI Reset Failed !!!\n");
|
||||||
|
goto error;
|
||||||
|
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
|
||||||
|
index 89f7db3bef86..760685ad7915 100644
|
||||||
|
--- a/tools/hciattach_rome.h
|
||||||
|
+++ b/tools/hciattach_rome.h
|
||||||
|
@@ -62,6 +62,7 @@ typedef struct
|
||||||
|
int fd; /* fd to Bluetooth device */
|
||||||
|
struct termios termios; /* serial terminal of BT port */
|
||||||
|
char port_name[256];
|
||||||
|
+ int hwfc;
|
||||||
|
} vnd_userial_cb_t;
|
||||||
|
|
||||||
|
/**** baud rates ****/
|
||||||
|
|
@ -0,0 +1,177 @@
|
||||||
|
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
|
||||||
|
|
||||||
|
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>
|
||||||
|
---
|
||||||
|
tools/hciattach.c | 4 +--
|
||||||
|
tools/hciattach_rome.c | 76 ++++++++++----------------------------------------
|
||||||
|
2 files changed, 17 insertions(+), 63 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tools/hciattach.c b/tools/hciattach.c
|
||||||
|
index 81d78ab3f69a..022bbe5fa6d5 100644
|
||||||
|
--- a/tools/hciattach.c
|
||||||
|
+++ b/tools/hciattach.c
|
||||||
|
@@ -285,7 +285,7 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti)
|
||||||
|
|
||||||
|
static int qca(int fd, struct uart_t *u, struct termios *ti)
|
||||||
|
{
|
||||||
|
- fprintf(stderr,"qca\n");
|
||||||
|
+ fprintf(stderr,"qca, bdaddr %s\n", u->bdaddr ? u->bdaddr : "Default");
|
||||||
|
return qca_soc_init(fd, u->speed, u->bdaddr, ti);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1363,7 +1363,7 @@ int main(int argc, char *argv[])
|
||||||
|
fprintf(stderr, "Unknown device type or id\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
-
|
||||||
|
+ u->bdaddr = NULL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
|
||||||
|
index ee67bb068c09..854cfff707aa 100644
|
||||||
|
--- a/tools/hciattach_rome.c
|
||||||
|
+++ b/tools/hciattach_rome.c
|
||||||
|
@@ -45,6 +45,7 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <termios.h>
|
||||||
|
+#include <endian.h>
|
||||||
|
#include <bluetooth/bluetooth.h>
|
||||||
|
#include "hciattach_rome.h"
|
||||||
|
#include "hciattach.h"
|
||||||
|
@@ -911,7 +912,7 @@ int get_value_from_config(char *file_path,char *param)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
-int rome_get_tlv_file(char *file_path)
|
||||||
|
+int rome_get_tlv_file(char *file_path, unsigned char * bdaddr)
|
||||||
|
{
|
||||||
|
FILE * pFile;
|
||||||
|
long fileSize;
|
||||||
|
@@ -921,7 +922,6 @@ int rome_get_tlv_file(char *file_path)
|
||||||
|
tlv_nvm_hdr *nvm_ptr;
|
||||||
|
unsigned char data_buf[PRINT_BUF_SIZE]={0,};
|
||||||
|
unsigned char *nvm_byte_ptr;
|
||||||
|
- unsigned char bdaddr[6];
|
||||||
|
unsigned short pcm_value, ibs_value;
|
||||||
|
|
||||||
|
fprintf(stderr, "File Open (%s)\n", file_path);
|
||||||
|
@@ -1008,12 +1008,15 @@ int rome_get_tlv_file(char *file_path)
|
||||||
|
nvm_byte_ptr+=sizeof(tlv_nvm_hdr);
|
||||||
|
|
||||||
|
/* Write BD Address */
|
||||||
|
- if(nvm_ptr->tag_id == TAG_NUM_2 && read_bd_address(&bdaddr) == 0) {
|
||||||
|
- memcpy(nvm_byte_ptr, bdaddr, 6);
|
||||||
|
- fprintf(stderr, "Overriding default BD ADDR with user"
|
||||||
|
- " programmed BD Address: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||||
|
- *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2),
|
||||||
|
- *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5));
|
||||||
|
+ if(nvm_ptr->tag_id == TAG_NUM_2 && bdaddr) {
|
||||||
|
+ bdaddr_t ba;
|
||||||
|
+ if (!str2ba(bdaddr, &ba)) {
|
||||||
|
+ memcpy(nvm_byte_ptr, &ba, 6);
|
||||||
|
+ fprintf(stderr, "Overriding default BD ADDR with user"
|
||||||
|
+ " programmed BD Address: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||||
|
+ *(nvm_byte_ptr+5), *(nvm_byte_ptr+4), *(nvm_byte_ptr+3),
|
||||||
|
+ *(nvm_byte_ptr+2), *(nvm_byte_ptr+1), *nvm_byte_ptr);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nvm_ptr->tag_id == TAG_NUM_17) {
|
||||||
|
@@ -1209,14 +1212,14 @@ error:
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
-int rome_download_tlv_file(int fd)
|
||||||
|
+int rome_download_tlv_file(int fd, char * bdaddr)
|
||||||
|
{
|
||||||
|
int tlv_size, err = -1;
|
||||||
|
|
||||||
|
/* Rampatch TLV file Downloading */
|
||||||
|
pdata_buffer = NULL;
|
||||||
|
|
||||||
|
- if((tlv_size = rome_get_tlv_file(rampatch_file_path)) < 0)
|
||||||
|
+ if((tlv_size = rome_get_tlv_file(rampatch_file_path, bdaddr)) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
if((err =rome_tlv_dnld_req(fd, tlv_size)) <0 )
|
||||||
|
@@ -1228,7 +1231,7 @@ int rome_download_tlv_file(int fd)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* NVM TLV file Downloading */
|
||||||
|
- if((tlv_size = rome_get_tlv_file(nvm_file_path)) < 0)
|
||||||
|
+ if((tlv_size = rome_get_tlv_file(nvm_file_path, bdaddr)) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
if((err =rome_tlv_dnld_req(fd, tlv_size)) <0 )
|
||||||
|
@@ -1679,55 +1682,6 @@ error:
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
-int read_bd_address(unsigned char *bdaddr)
|
||||||
|
-{
|
||||||
|
- int fd = -1;
|
||||||
|
- int readPtr = 0;
|
||||||
|
- unsigned char data[BD_ADDR_LEN];
|
||||||
|
-
|
||||||
|
- /* Open the persist file for reading device address*/
|
||||||
|
- fd = open("/etc/bluetooth/.bt_nv.bin", O_RDONLY);
|
||||||
|
- if(fd < 0)
|
||||||
|
- {
|
||||||
|
- fprintf(stderr, "%s: Open failed: Programming default BD ADDR\n", __func__);
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /* Read the NVM Header : fp will be advanced by readPtr number of bytes */
|
||||||
|
- readPtr = read(fd, data, PERSIST_HEADER_LEN);
|
||||||
|
- if (readPtr > 0)
|
||||||
|
- fprintf(stderr, "%s: Persist header data: %02x \t %02x \t %02x\n", __func__,
|
||||||
|
- data[NVITEM], data[RDWR_PROT], data[NVITEM_SIZE]);
|
||||||
|
- else {
|
||||||
|
- fprintf(stderr, "%s: Read from persist memory failed : Programming default"
|
||||||
|
- " BD ADDR\n");
|
||||||
|
- close(fd);
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /* Check for BD ADDR length before programming */
|
||||||
|
- if(data[NVITEM_SIZE] != BD_ADDR_LEN) {
|
||||||
|
- fprintf(stderr, "Invalid BD ADDR: Programming default BD ADDR!\n");
|
||||||
|
- close(fd);
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /* Read the BD ADDR info */
|
||||||
|
- readPtr = read(fd, data, BD_ADDR_LEN);
|
||||||
|
- if (readPtr > 0)
|
||||||
|
- fprintf(stderr, "BD-ADDR: ==> %02x:%02x:%02x:%02x:%02x:%02x\n", data[0],
|
||||||
|
- data[1], data[2], data[3], data[4], data[5]);
|
||||||
|
- else {
|
||||||
|
- fprintf(stderr, "%s: Read from persist memory failed : Programming default"
|
||||||
|
- " BD ADDR\n");
|
||||||
|
- close(fd);
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
- memcpy(bdaddr, data, BD_ADDR_LEN);
|
||||||
|
- close(fd);
|
||||||
|
- return 0;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
int isSpeedValid(int speed, int *local_baud_rate, int *controller_baud_rate)
|
||||||
|
{
|
||||||
|
switch(speed) {
|
||||||
|
@@ -1915,7 +1869,7 @@ download:
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Donwload TLV files (rampatch, NVM) */
|
||||||
|
- err = rome_download_tlv_file(fd);
|
||||||
|
+ err = rome_download_tlv_file(fd, bdaddr);
|
||||||
|
if (err < 0) {
|
||||||
|
fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__);
|
||||||
|
goto error;
|
||||||
|
|
@ -0,0 +1,723 @@
|
||||||
|
From: Alex Gonzalez <alex.gonzalez@digi.com>
|
||||||
|
Date: Mon, 10 Apr 2017 12:44:00 +0200
|
||||||
|
Subject: [PATCH] hciattach: Add verbosity option
|
||||||
|
|
||||||
|
And reduce the verbosity of the hciattach_rome plugin.
|
||||||
|
|
||||||
|
Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
|
||||||
|
---
|
||||||
|
lib/bluetooth.h | 3 +
|
||||||
|
tools/hciattach.c | 13 ++-
|
||||||
|
tools/hciattach_rome.c | 244 ++++++++++++++++++++++++-------------------------
|
||||||
|
3 files changed, 132 insertions(+), 128 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/bluetooth.h b/lib/bluetooth.h
|
||||||
|
index eb279260e009..38e3e6900744 100644
|
||||||
|
--- a/lib/bluetooth.h
|
||||||
|
+++ b/lib/bluetooth.h
|
||||||
|
@@ -136,6 +136,9 @@ enum {
|
||||||
|
BT_CLOSED
|
||||||
|
};
|
||||||
|
|
||||||
|
+extern int verbose_on;
|
||||||
|
+#define hciprintf(fd, arg...) if (verbose_on) { fprintf(fd, ##arg);} else { do {} while (0);}
|
||||||
|
+
|
||||||
|
/* Byte order conversions */
|
||||||
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
|
#define htobs(d) (d)
|
||||||
|
diff --git a/tools/hciattach.c b/tools/hciattach.c
|
||||||
|
index 022bbe5fa6d5..4aacdafeda7d 100644
|
||||||
|
--- a/tools/hciattach.c
|
||||||
|
+++ b/tools/hciattach.c
|
||||||
|
@@ -50,6 +50,8 @@
|
||||||
|
|
||||||
|
#include "hciattach.h"
|
||||||
|
|
||||||
|
+int verbose_on = 0;
|
||||||
|
+
|
||||||
|
struct uart_t {
|
||||||
|
char *type;
|
||||||
|
int m_id;
|
||||||
|
@@ -125,8 +127,6 @@ int read_hci_event(int fd, unsigned char* buf, int size)
|
||||||
|
fprintf(stderr, "%s: Timing out on select for 3 secs.\n", __FUNCTION__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- else
|
||||||
|
- fprintf(stderr, "%s: Data(HCI-CMD-COMP-EVENT) available in TTY Serial buffer\n", __FUNCTION__);
|
||||||
|
|
||||||
|
/* The first byte identifies the packet type. For HCI event packets, it
|
||||||
|
* should be 0x04, so we read until we get to the 0x04. */
|
||||||
|
@@ -285,7 +285,7 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti)
|
||||||
|
|
||||||
|
static int qca(int fd, struct uart_t *u, struct termios *ti)
|
||||||
|
{
|
||||||
|
- fprintf(stderr,"qca, bdaddr %s\n", u->bdaddr ? u->bdaddr : "Default");
|
||||||
|
+ fprintf(stderr,"qca, bdaddr %s, verbose %d\n", u->bdaddr ? u->bdaddr : "Default", verbose_on);
|
||||||
|
return qca_soc_init(fd, u->speed, u->bdaddr, ti);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1258,7 +1258,7 @@ static void usage(void)
|
||||||
|
{
|
||||||
|
printf("hciattach - HCI UART driver initialization utility\n");
|
||||||
|
printf("Usage:\n");
|
||||||
|
- printf("\thciattach [-n] [-p] [-b] [-r] [-t timeout] [-s initial_speed]"
|
||||||
|
+ printf("\thciattach [-n] [-p] [-b] [-r] [-v] [-t timeout] [-s initial_speed]"
|
||||||
|
" <tty> <type | id> [speed] [flow|noflow]"
|
||||||
|
" [sleep|nosleep] [bdaddr]\n");
|
||||||
|
printf("\thciattach -l\n");
|
||||||
|
@@ -1281,7 +1281,7 @@ int main(int argc, char *argv[])
|
||||||
|
printpid = 0;
|
||||||
|
raw = 0;
|
||||||
|
|
||||||
|
- while ((opt=getopt(argc, argv, "bnpt:s:lrf:")) != EOF) {
|
||||||
|
+ while ((opt=getopt(argc, argv, "bnpt:s:lrf:v")) != EOF) {
|
||||||
|
switch(opt) {
|
||||||
|
case 'b':
|
||||||
|
send_break = 1;
|
||||||
|
@@ -1319,6 +1319,9 @@ int main(int argc, char *argv[])
|
||||||
|
fprintf(stderr, "Line_disp val : %d\n", line_disp);
|
||||||
|
break;
|
||||||
|
|
||||||
|
+ case 'v':
|
||||||
|
+ verbose_on = 1;
|
||||||
|
+ break;
|
||||||
|
default:
|
||||||
|
usage();
|
||||||
|
exit(1);
|
||||||
|
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
|
||||||
|
index 854cfff707aa..40983fc087c0 100644
|
||||||
|
--- a/tools/hciattach_rome.c
|
||||||
|
+++ b/tools/hciattach_rome.c
|
||||||
|
@@ -139,7 +139,7 @@ unsigned char userial_to_tcio_baud(unsigned char cfg_baud, unsigned int *baud)
|
||||||
|
void userial_vendor_set_baud(unsigned char userial_baud)
|
||||||
|
{
|
||||||
|
unsigned int tcio_baud;
|
||||||
|
- fprintf(stderr, "## userial_vendor_set_baud: %d\n", userial_baud);
|
||||||
|
+ hciprintf(stderr, "## userial_vendor_set_baud: %d\n", userial_baud);
|
||||||
|
|
||||||
|
if (tcgetattr(vnd_userial.fd, &vnd_userial.termios) < 0) {
|
||||||
|
perror("Can't get port settings");
|
||||||
|
@@ -201,7 +201,7 @@ int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data)
|
||||||
|
break;
|
||||||
|
#endif // (BT_WAKE_VIA_USERIAL_IOCTL==TRUE)
|
||||||
|
case USERIAL_OP_FLOW_ON:
|
||||||
|
- fprintf(stderr, "## userial_vendor_ioctl: UART Flow On\n ");
|
||||||
|
+ hciprintf(stderr, "## userial_vendor_ioctl: UART Flow On\n ");
|
||||||
|
ti.c_cflag |= CRTSCTS;
|
||||||
|
|
||||||
|
if (err = tcsetattr(fd, TCSANOW, &ti) < 0) {
|
||||||
|
@@ -212,7 +212,7 @@ int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data)
|
||||||
|
break;
|
||||||
|
|
||||||
|
case USERIAL_OP_FLOW_OFF:
|
||||||
|
- fprintf(stderr, "## userial_vendor_ioctl: UART Flow Off\n ");
|
||||||
|
+ hciprintf(stderr, "## userial_vendor_ioctl: UART Flow Off\n ");
|
||||||
|
ti.c_cflag &= ~CRTSCTS;
|
||||||
|
if (err = tcsetattr(fd, TCSANOW, &ti) < 0) {
|
||||||
|
fprintf(stderr, "Can't set port settings");
|
||||||
|
@@ -233,51 +233,51 @@ int get_vs_hci_event(unsigned char *rsp)
|
||||||
|
int err = 0, soc_id =0;
|
||||||
|
unsigned char paramlen = 0;
|
||||||
|
|
||||||
|
- if( (rsp[EVENTCODE_OFFSET] == VSEVENT_CODE) || (rsp[EVENTCODE_OFFSET] == EVT_CMD_COMPLETE))
|
||||||
|
- fprintf(stderr, "%s: Received HCI-Vendor Specific event\n", __FUNCTION__);
|
||||||
|
- else {
|
||||||
|
+ if( (rsp[EVENTCODE_OFFSET] == VSEVENT_CODE) || (rsp[EVENTCODE_OFFSET] == EVT_CMD_COMPLETE)) {
|
||||||
|
+ hciprintf(stderr, "%s: Received HCI-Vendor Specific event\n", __FUNCTION__);
|
||||||
|
+ } else {
|
||||||
|
fprintf(stderr, "%s: Failed to receive HCI-Vendor Specific event\n", __FUNCTION__);
|
||||||
|
err = -EIO;
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
- fprintf(stderr, "%s: Parameter Length: 0x%x\n", __FUNCTION__, paramlen = rsp[EVT_PLEN]);
|
||||||
|
- fprintf(stderr, "%s: Command response: 0x%x\n", __FUNCTION__, rsp[CMD_RSP_OFFSET]);
|
||||||
|
- fprintf(stderr, "%s: Response type : 0x%x\n", __FUNCTION__, rsp[RSP_TYPE_OFFSET]);
|
||||||
|
+ paramlen = rsp[EVT_PLEN];
|
||||||
|
+ hciprintf(stderr, "%s: Parameter Length: 0x%x\n", __FUNCTION__, paramlen);
|
||||||
|
+ hciprintf(stderr, "%s: Command response: 0x%x\n", __FUNCTION__, rsp[CMD_RSP_OFFSET]);
|
||||||
|
+ hciprintf(stderr, "%s: Response type : 0x%x\n", __FUNCTION__, rsp[RSP_TYPE_OFFSET]);
|
||||||
|
|
||||||
|
/* Check the status of the operation */
|
||||||
|
switch ( rsp[CMD_RSP_OFFSET] )
|
||||||
|
{
|
||||||
|
case EDL_CMD_REQ_RES_EVT:
|
||||||
|
- fprintf(stderr, "%s: Command Request Response\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: Command Request Response\n", __FUNCTION__);
|
||||||
|
switch(rsp[RSP_TYPE_OFFSET])
|
||||||
|
{
|
||||||
|
case EDL_PATCH_VER_RES_EVT:
|
||||||
|
case EDL_APP_VER_RES_EVT:
|
||||||
|
- fprintf(stderr, "\t Current Product ID\t\t: 0x%08x\n",
|
||||||
|
- (unsigned int)(rsp[PATCH_PROD_ID_OFFSET +3] << 24 |
|
||||||
|
+ hciprintf(stderr, "\t Current Product ID\t\t: 0x%08x\n",
|
||||||
|
+ (unsigned int)(rsp[PATCH_PROD_ID_OFFSET +3] << 24 |
|
||||||
|
rsp[PATCH_PROD_ID_OFFSET+2] << 16 |
|
||||||
|
rsp[PATCH_PROD_ID_OFFSET+1] << 8 |
|
||||||
|
rsp[PATCH_PROD_ID_OFFSET] ));
|
||||||
|
|
||||||
|
/* Patch Version indicates FW patch version */
|
||||||
|
- fprintf(stderr, "\t Current Patch Version\t\t: 0x%04x\n",
|
||||||
|
- (unsigned short)(rsp[PATCH_PATCH_VER_OFFSET + 1] << 8 |
|
||||||
|
+ hciprintf(stderr, "\t Current Patch Version\t\t: 0x%04x\n",
|
||||||
|
+ (unsigned short)(rsp[PATCH_PATCH_VER_OFFSET + 1] << 8 |
|
||||||
|
rsp[PATCH_PATCH_VER_OFFSET] ));
|
||||||
|
|
||||||
|
/* ROM Build Version indicates ROM build version like 1.0/1.1/2.0 */
|
||||||
|
- fprintf(stderr, "\t Current ROM Build Version\t: 0x%04x\n", rome_ver =
|
||||||
|
- (int)(rsp[PATCH_ROM_BUILD_VER_OFFSET + 1] << 8 |
|
||||||
|
- rsp[PATCH_ROM_BUILD_VER_OFFSET] ));
|
||||||
|
+ rome_ver = (int)(rsp[PATCH_ROM_BUILD_VER_OFFSET + 1] << 8 |
|
||||||
|
+ rsp[PATCH_ROM_BUILD_VER_OFFSET] );
|
||||||
|
+ hciprintf(stderr, "\t Current ROM Build Version\t: 0x%04x\n", rome_ver);
|
||||||
|
|
||||||
|
/* In case rome 1.0/1.1, there is no SOC ID version available */
|
||||||
|
- if (paramlen - 10)
|
||||||
|
- {
|
||||||
|
- fprintf(stderr, "\t Current SOC Version\t\t: 0x%08x\n", soc_id =
|
||||||
|
- (unsigned int)(rsp[PATCH_SOC_VER_OFFSET +3] << 24 |
|
||||||
|
- rsp[PATCH_SOC_VER_OFFSET+2] << 16 |
|
||||||
|
- rsp[PATCH_SOC_VER_OFFSET+1] << 8 |
|
||||||
|
- rsp[PATCH_SOC_VER_OFFSET] ));
|
||||||
|
+ if (paramlen - 10) {
|
||||||
|
+ soc_id = (unsigned int)(rsp[PATCH_SOC_VER_OFFSET +3] << 24 |
|
||||||
|
+ rsp[PATCH_SOC_VER_OFFSET+2] << 16 |
|
||||||
|
+ rsp[PATCH_SOC_VER_OFFSET+1] << 8 |
|
||||||
|
+ rsp[PATCH_SOC_VER_OFFSET]);
|
||||||
|
+ hciprintf(stderr, "\t Current SOC Version\t\t: 0x%08x\n", soc_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Rome Chipset Version can be decided by Patch version and SOC version,
|
||||||
|
@@ -290,7 +290,7 @@ int get_vs_hci_event(unsigned char *rsp)
|
||||||
|
switch (err = rsp[CMD_STATUS_OFFSET])
|
||||||
|
{
|
||||||
|
case HCI_CMD_SUCCESS:
|
||||||
|
- fprintf(stderr, "%s: Download Packet successfully!\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: Download Packet successfully!\n", __FUNCTION__);
|
||||||
|
break;
|
||||||
|
case PATCH_LEN_ERROR:
|
||||||
|
fprintf(stderr, "%s: Invalid patch length argument passed for EDL PATCH "
|
||||||
|
@@ -318,7 +318,7 @@ int get_vs_hci_event(unsigned char *rsp)
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NVM_ACCESS_CODE:
|
||||||
|
- fprintf(stderr, "%s: NVM Access Code!!!\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: NVM Access Code!!!\n", __FUNCTION__);
|
||||||
|
err = HCI_CMD_SUCCESS;
|
||||||
|
break;
|
||||||
|
case EDL_SET_BAUDRATE_RSP_EVT:
|
||||||
|
@@ -362,7 +362,7 @@ int wait_for_data(int fd, int maxTimeOut)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
- fprintf(stderr, "%s: HCI-VS-EVENT available in TTY Serial buffer\n",
|
||||||
|
+ hciprintf(stderr, "%s: HCI-VS-EVENT available in TTY Serial buffer\n",
|
||||||
|
__FUNCTION__);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
@@ -381,7 +381,7 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n",
|
||||||
|
+ hciprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n",
|
||||||
|
__FUNCTION__);
|
||||||
|
|
||||||
|
/* Check whether data is available in TTY buffer before calling read() */
|
||||||
|
@@ -425,7 +425,7 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size)
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
|
||||||
|
- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[0] - 0x%x\n", __FUNCTION__, buf[0]);
|
||||||
|
+ hciprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[0] - 0x%x\n", __FUNCTION__, buf[0]);
|
||||||
|
/* The next two bytes are the event code and parameter total length. */
|
||||||
|
while (count < 3) {
|
||||||
|
r = read(fd, buf + count, 3 - count);
|
||||||
|
@@ -436,7 +436,7 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size)
|
||||||
|
count += r;
|
||||||
|
}
|
||||||
|
|
||||||
|
- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[1] - 0x%x\n", __FUNCTION__, buf[1]);
|
||||||
|
+ hciprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[1] - 0x%x\n", __FUNCTION__, buf[1]);
|
||||||
|
/* Now we read the parameters. */
|
||||||
|
if (buf[2] < (size - 3))
|
||||||
|
remain = buf[2];
|
||||||
|
@@ -454,7 +454,7 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size)
|
||||||
|
if(get_vs_hci_event(buf) != HCI_CMD_SUCCESS)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, count - 0x%x\n", __FUNCTION__, count);
|
||||||
|
+ hciprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, count - 0x%x\n", __FUNCTION__, count);
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -477,7 +477,7 @@ int hci_send_vs_cmd(int fd, unsigned char *cmd, unsigned char *rsp, int size)
|
||||||
|
fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
- fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
failed:
|
||||||
|
@@ -507,8 +507,8 @@ void frame_hci_cmd_pkt(
|
||||||
|
case EDL_PATCH_SET_REQ_CMD:
|
||||||
|
/* Copy the patch header info as CMD params */
|
||||||
|
memcpy(&cmd[5], phdr_buffer, PATCH_HDR_LEN);
|
||||||
|
- fprintf(stderr, "%s: Sending EDL_PATCH_SET_REQ_CMD\n", __FUNCTION__);
|
||||||
|
- fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
|
||||||
|
+ hciprintf(stderr, "%s: Sending EDL_PATCH_SET_REQ_CMD\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
|
||||||
|
segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
|
||||||
|
break;
|
||||||
|
case EDL_PATCH_DLD_REQ_CMD:
|
||||||
|
@@ -522,36 +522,36 @@ void frame_hci_cmd_pkt(
|
||||||
|
cmd[9] = EXTRACT_BYTE(p_base_addr, 3);
|
||||||
|
memcpy(&cmd[10], (pdata_buffer + offset), size);
|
||||||
|
|
||||||
|
- fprintf(stderr, "%s: Sending EDL_PATCH_DLD_REQ_CMD: size: %d bytes\n",
|
||||||
|
+ hciprintf(stderr, "%s: Sending EDL_PATCH_DLD_REQ_CMD: size: %d bytes\n",
|
||||||
|
__FUNCTION__, size);
|
||||||
|
- fprintf(stderr, "HCI-CMD %d:\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t"
|
||||||
|
+ hciprintf(stderr, "HCI-CMD %d:\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t"
|
||||||
|
"0x%x\t0x%x\t0x%x\t\n", segtNo, cmd[0], cmd[1], cmd[2],
|
||||||
|
cmd[3], cmd[4], cmd[5], cmd[6], cmd[7], cmd[8], cmd[9]);
|
||||||
|
break;
|
||||||
|
case EDL_PATCH_ATCH_REQ_CMD:
|
||||||
|
- fprintf(stderr, "%s: Sending EDL_PATCH_ATTACH_REQ_CMD\n", __FUNCTION__);
|
||||||
|
- fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
|
||||||
|
- segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
|
||||||
|
+ hciprintf(stderr, "%s: Sending EDL_PATCH_ATTACH_REQ_CMD\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
|
||||||
|
+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
|
||||||
|
break;
|
||||||
|
case EDL_PATCH_RST_REQ_CMD:
|
||||||
|
- fprintf(stderr, "%s: Sending EDL_PATCH_RESET_REQ_CMD\n", __FUNCTION__);
|
||||||
|
- fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
|
||||||
|
- segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
|
||||||
|
+ hciprintf(stderr, "%s: Sending EDL_PATCH_RESET_REQ_CMD\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
|
||||||
|
+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
|
||||||
|
break;
|
||||||
|
case EDL_PATCH_VER_REQ_CMD:
|
||||||
|
- fprintf(stderr, "%s: Sending EDL_PATCH_VER_REQ_CMD\n", __FUNCTION__);
|
||||||
|
- fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
|
||||||
|
- segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
|
||||||
|
- break;
|
||||||
|
+ hciprintf(stderr, "%s: Sending EDL_PATCH_VER_REQ_CMD\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
|
||||||
|
+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
|
||||||
|
+ break;
|
||||||
|
case EDL_PATCH_TLV_REQ_CMD:
|
||||||
|
- fprintf(stderr, "%s: Sending EDL_PATCH_TLV_REQ_CMD\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: Sending EDL_PATCH_TLV_REQ_CMD\n", __FUNCTION__);
|
||||||
|
/* Parameter Total Length */
|
||||||
|
cmd[3] = size +2;
|
||||||
|
|
||||||
|
/* TLV Segment Length */
|
||||||
|
cmd[5] = size;
|
||||||
|
- fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
|
||||||
|
- segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5]);
|
||||||
|
+ hciprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
|
||||||
|
+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5]);
|
||||||
|
offset = (segtNo * MAX_SIZE_PER_TLV_SEGMENT);
|
||||||
|
memcpy(&cmd[6], (pdata_buffer + offset), size);
|
||||||
|
break;
|
||||||
|
@@ -601,14 +601,13 @@ void rome_extract_patch_header_info(unsigned char *buf)
|
||||||
|
rampatch_patch_info.patch_ctrl |=
|
||||||
|
(LSH(buf[index + P_CONTROL_OFFSET], (index * 8)));
|
||||||
|
|
||||||
|
- fprintf(stderr, "PATCH_ID\t : 0x%x\n", rampatch_patch_info.patch_id);
|
||||||
|
- fprintf(stderr, "ROM_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.rom_version);
|
||||||
|
- fprintf(stderr, "BUILD_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.build_version);
|
||||||
|
- fprintf(stderr, "PATCH_LENGTH\t : 0x%x\n", rampatch_patch_info.patch_length);
|
||||||
|
- fprintf(stderr, "PATCH_CRC\t : 0x%x\n", rampatch_patch_info.patch_crc);
|
||||||
|
- fprintf(stderr, "PATCH_CONTROL\t : 0x%x\n", rampatch_patch_info.patch_ctrl);
|
||||||
|
- fprintf(stderr, "PATCH_BASE_ADDR\t : 0x%x\n", rampatch_patch_info.patch_base_addr);
|
||||||
|
-
|
||||||
|
+ hciprintf(stderr, "PATCH_ID\t : 0x%x\n", rampatch_patch_info.patch_id);
|
||||||
|
+ hciprintf(stderr, "ROM_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.rom_version);
|
||||||
|
+ hciprintf(stderr, "BUILD_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.build_version);
|
||||||
|
+ hciprintf(stderr, "PATCH_LENGTH\t : 0x%x\n", rampatch_patch_info.patch_length);
|
||||||
|
+ hciprintf(stderr, "PATCH_CRC\t : 0x%x\n", rampatch_patch_info.patch_crc);
|
||||||
|
+ hciprintf(stderr, "PATCH_CONTROL\t : 0x%x\n", rampatch_patch_info.patch_ctrl);
|
||||||
|
+ hciprintf(stderr, "PATCH_BASE_ADDR\t : 0x%x\n", rampatch_patch_info.patch_base_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rome_edl_set_patch_request(int fd)
|
||||||
|
@@ -636,7 +635,7 @@ int rome_edl_set_patch_request(int fd)
|
||||||
|
fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
- fprintf(stderr, "%s: Successfully set patch info on the Controller\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: Successfully set patch info on the Controller\n", __FUNCTION__);
|
||||||
|
error:
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
@@ -651,7 +650,7 @@ int rome_edl_patch_download_request(int fd)
|
||||||
|
|
||||||
|
no_of_patch_segment = (rampatch_patch_info.patch_length /
|
||||||
|
MAX_DATA_PER_SEGMENT);
|
||||||
|
- fprintf(stderr, "%s: %d patch segments to be d'loaded from patch base addr: 0x%x\n",
|
||||||
|
+ hciprintf(stderr, "%s: %d patch segments to be d'loaded from patch base addr: 0x%x\n",
|
||||||
|
__FUNCTION__, no_of_patch_segment,
|
||||||
|
rampatch_patch_info.patch_base_addr);
|
||||||
|
|
||||||
|
@@ -663,8 +662,7 @@ int rome_edl_patch_download_request(int fd)
|
||||||
|
* segments with a max. size of 239 bytes
|
||||||
|
*/
|
||||||
|
for (index = 1; index <= no_of_patch_segment; index++) {
|
||||||
|
-
|
||||||
|
- fprintf(stderr, "%s: Downloading patch segment: %d\n", __FUNCTION__, index);
|
||||||
|
+ hciprintf(stderr, "%s: Downloading patch segment: %d\n", __FUNCTION__, index);
|
||||||
|
|
||||||
|
/* Frame the HCI CMD PKT to be sent to Controller*/
|
||||||
|
frame_hci_cmd_pkt(cmd, EDL_PATCH_DLD_REQ_CMD, p_base_addr,
|
||||||
|
@@ -690,8 +688,9 @@ int rome_edl_patch_download_request(int fd)
|
||||||
|
__FUNCTION__, index);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
- fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n",
|
||||||
|
- __FUNCTION__, index);
|
||||||
|
+
|
||||||
|
+ hciprintf(stderr, "%s: Successfully downloaded patch segment: %d\n",
|
||||||
|
+ __FUNCTION__, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if any pending patch data to be sent */
|
||||||
|
@@ -725,8 +724,8 @@ int rome_edl_patch_download_request(int fd)
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
- fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n",
|
||||||
|
- __FUNCTION__, index);
|
||||||
|
+ hciprintf(stderr, "%s: Successfully downloaded patch segment: %d\n",
|
||||||
|
+ __FUNCTION__, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
error:
|
||||||
|
@@ -740,7 +739,7 @@ static int rome_download_rampatch(int fd)
|
||||||
|
fprintf(stderr, "%s:\n", __FUNCTION__);
|
||||||
|
|
||||||
|
/* Get handle to the RAMPATCH binary file */
|
||||||
|
- fprintf(stderr, "%s: Getting handle to the RAMPATCH binary file from %s\n", __FUNCTION__, ROME_FW_PATH);
|
||||||
|
+ hciprintf(stderr, "%s: Getting handle to the RAMPATCH binary file from %s\n", __FUNCTION__, ROME_FW_PATH);
|
||||||
|
file = fopen(ROME_FW_PATH, "r");
|
||||||
|
if (file == NULL) {
|
||||||
|
fprintf(stderr, "%s: Failed to get handle to the RAMPATCH bin file!\n",
|
||||||
|
@@ -749,7 +748,7 @@ static int rome_download_rampatch(int fd)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate memory for the patch headder info */
|
||||||
|
- fprintf(stderr, "%s: Allocating memory for the patch header\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: Allocating memory for the patch header\n", __FUNCTION__);
|
||||||
|
phdr_buffer = (unsigned char *) malloc(PATCH_HDR_LEN + 1);
|
||||||
|
if (phdr_buffer == NULL) {
|
||||||
|
fprintf(stderr, "%s: Failed to allocate memory for patch header\n",
|
||||||
|
@@ -760,7 +759,7 @@ static int rome_download_rampatch(int fd)
|
||||||
|
phdr_buffer[index] = 0x0;
|
||||||
|
|
||||||
|
/* Read 28 bytes of patch header information */
|
||||||
|
- fprintf(stderr, "%s: Reading patch header info\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: Reading patch header info\n", __FUNCTION__);
|
||||||
|
index = 0;
|
||||||
|
do {
|
||||||
|
c = fgetc (file);
|
||||||
|
@@ -768,7 +767,7 @@ static int rome_download_rampatch(int fd)
|
||||||
|
} while (index != PATCH_HDR_LEN);
|
||||||
|
|
||||||
|
/* Save the patch header info into local structure */
|
||||||
|
- fprintf(stderr, "%s: Saving patch hdr. info\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: Saving patch hdr. info\n", __FUNCTION__);
|
||||||
|
rome_extract_patch_header_info((unsigned char *)phdr_buffer);
|
||||||
|
|
||||||
|
/* Set the patch header info onto the Controller */
|
||||||
|
@@ -779,7 +778,7 @@ static int rome_download_rampatch(int fd)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate memory for the patch payload */
|
||||||
|
- fprintf(stderr, "%s: Allocating memory for patch payload\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: Allocating memory for patch payload\n", __FUNCTION__);
|
||||||
|
size = rampatch_patch_info.patch_length;
|
||||||
|
pdata_buffer = (unsigned char *) malloc(size+1);
|
||||||
|
if (pdata_buffer == NULL) {
|
||||||
|
@@ -791,7 +790,7 @@ static int rome_download_rampatch(int fd)
|
||||||
|
pdata_buffer[index] = 0x0;
|
||||||
|
|
||||||
|
/* Read the patch data from Rampatch binary image */
|
||||||
|
- fprintf(stderr, "%s: Reading patch payload from RAMPATCH file\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: Reading patch payload from RAMPATCH file\n", __FUNCTION__);
|
||||||
|
index = 0;
|
||||||
|
do {
|
||||||
|
c = fgetc (file);
|
||||||
|
@@ -924,7 +923,7 @@ int rome_get_tlv_file(char *file_path, unsigned char * bdaddr)
|
||||||
|
unsigned char *nvm_byte_ptr;
|
||||||
|
unsigned short pcm_value, ibs_value;
|
||||||
|
|
||||||
|
- fprintf(stderr, "File Open (%s)\n", file_path);
|
||||||
|
+ hciprintf(stderr, "File Open (%s)\n", file_path);
|
||||||
|
pFile = fopen ( file_path , "r" );
|
||||||
|
if (pFile==NULL) {;
|
||||||
|
fprintf(stderr, "%s File Open Fail\n", file_path);
|
||||||
|
@@ -967,30 +966,30 @@ int rome_get_tlv_file(char *file_path, unsigned char * bdaddr)
|
||||||
|
gtlv_dwndcfg = ptlv_header->tlv.patch.dwnd_cfg;
|
||||||
|
|
||||||
|
if(ptlv_header->tlv_type == TLV_TYPE_PATCH){
|
||||||
|
- fprintf(stderr, "====================================================\n");
|
||||||
|
- fprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type);
|
||||||
|
- fprintf(stderr, "Length\t\t\t : %d bytes\n", (ptlv_header->tlv_length1) |
|
||||||
|
- (ptlv_header->tlv_length2 << 8) |
|
||||||
|
- (ptlv_header->tlv_length3 << 16));
|
||||||
|
- fprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv.patch.tlv_data_len);
|
||||||
|
- fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len);
|
||||||
|
- fprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver);
|
||||||
|
- fprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm);
|
||||||
|
- fprintf(stderr, "Event Handling\t\t\t : 0x%x", ptlv_header->tlv.patch.dwnd_cfg);
|
||||||
|
- fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1);
|
||||||
|
- fprintf(stderr, "Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id);
|
||||||
|
- fprintf(stderr, "Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver);
|
||||||
|
- fprintf(stderr, "Patch Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.patch_ver);
|
||||||
|
- fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved2);
|
||||||
|
- fprintf(stderr, "Patch Entry Address\t\t : 0x%x\n", (ptlv_header->tlv.patch.patch_entry_addr));
|
||||||
|
- fprintf(stderr, "====================================================\n");
|
||||||
|
-
|
||||||
|
+ hciprintf(stderr, "====================================================\n");
|
||||||
|
+ hciprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type);
|
||||||
|
+ hciprintf(stderr, "Length\t\t\t : %d bytes\n", (ptlv_header->tlv_length1) |
|
||||||
|
+ (ptlv_header->tlv_length2 << 8) |
|
||||||
|
+ (ptlv_header->tlv_length3 << 16));
|
||||||
|
+ hciprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv.patch.tlv_data_len);
|
||||||
|
+ hciprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len);
|
||||||
|
+ hciprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver);
|
||||||
|
+ hciprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm);
|
||||||
|
+ hciprintf(stderr, "Event Handling\t\t\t : 0x%x", ptlv_header->tlv.patch.dwnd_cfg);
|
||||||
|
+ hciprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1);
|
||||||
|
+ hciprintf(stderr, "Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id);
|
||||||
|
+ hciprintf(stderr, "Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver);
|
||||||
|
+ hciprintf(stderr, "Patch Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.patch_ver);
|
||||||
|
+ hciprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved2);
|
||||||
|
+ hciprintf(stderr, "Patch Entry Address\t\t : 0x%x\n", (ptlv_header->tlv.patch.patch_entry_addr));
|
||||||
|
+ hciprintf(stderr, "====================================================\n");
|
||||||
|
} else if(ptlv_header->tlv_type == TLV_TYPE_NVM) {
|
||||||
|
- fprintf(stderr, "====================================================\n");
|
||||||
|
- fprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type);
|
||||||
|
- fprintf(stderr, "Length\t\t\t : %d bytes\n", nvm_length = (ptlv_header->tlv_length1) |
|
||||||
|
- (ptlv_header->tlv_length2 << 8) |
|
||||||
|
- (ptlv_header->tlv_length3 << 16));
|
||||||
|
+ nvm_length = (ptlv_header->tlv_length1) |
|
||||||
|
+ (ptlv_header->tlv_length2 << 8) |
|
||||||
|
+ (ptlv_header->tlv_length3 << 16);
|
||||||
|
+ hciprintf(stderr, "====================================================\n");
|
||||||
|
+ hciprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type);
|
||||||
|
+ hciprintf(stderr, "Length\t\t\t : %d bytes\n", nvm_length);
|
||||||
|
|
||||||
|
if(nvm_length <= 0)
|
||||||
|
return readSize;
|
||||||
|
@@ -998,11 +997,11 @@ int rome_get_tlv_file(char *file_path, unsigned char * bdaddr)
|
||||||
|
for(nvm_byte_ptr=(unsigned char *)(nvm_ptr = &(ptlv_header->tlv.nvm)), nvm_index=0;
|
||||||
|
nvm_index < nvm_length ; nvm_ptr = (tlv_nvm_hdr *) nvm_byte_ptr)
|
||||||
|
{
|
||||||
|
- fprintf(stderr, "TAG ID\t\t\t : %d\n", nvm_ptr->tag_id);
|
||||||
|
- fprintf(stderr, "TAG Length\t\t\t : %d\n", nvm_tag_len = nvm_ptr->tag_len);
|
||||||
|
- fprintf(stderr, "TAG Pointer\t\t\t : %d\n", nvm_ptr->tag_ptr);
|
||||||
|
- fprintf(stderr, "TAG Extended Flag\t\t : %d\n", nvm_ptr->tag_ex_flag);
|
||||||
|
-
|
||||||
|
+ nvm_tag_len = nvm_ptr->tag_len;
|
||||||
|
+ hciprintf(stderr, "TAG ID\t\t\t : %d\n", nvm_ptr->tag_id);
|
||||||
|
+ hciprintf(stderr, "TAG Length\t\t\t : %d\n", nvm_tag_len);
|
||||||
|
+ hciprintf(stderr, "TAG Pointer\t\t\t : %d\n", nvm_ptr->tag_ptr);
|
||||||
|
+ hciprintf(stderr, "TAG Extended Flag\t\t : %d\n", nvm_ptr->tag_ex_flag);
|
||||||
|
/* Increase nvm_index to NVM data */
|
||||||
|
nvm_index+=sizeof(tlv_nvm_hdr);
|
||||||
|
nvm_byte_ptr+=sizeof(tlv_nvm_hdr);
|
||||||
|
@@ -1058,7 +1057,7 @@ int rome_get_tlv_file(char *file_path, unsigned char * bdaddr)
|
||||||
|
snprintf((char *) data_buf, PRINT_BUF_SIZE, "%s%.02x ",
|
||||||
|
(char *)data_buf, *(nvm_byte_ptr + i));
|
||||||
|
|
||||||
|
- fprintf(stderr, "TAG Data\t\t\t : %s\n", data_buf);
|
||||||
|
+ hciprintf(stderr, "TAG Data\t\t\t : %s\n", data_buf);
|
||||||
|
|
||||||
|
/* Clear buffer */
|
||||||
|
memset(data_buf, 0x0, PRINT_BUF_SIZE);
|
||||||
|
@@ -1068,7 +1067,7 @@ int rome_get_tlv_file(char *file_path, unsigned char * bdaddr)
|
||||||
|
nvm_byte_ptr +=nvm_ptr->tag_len;
|
||||||
|
}
|
||||||
|
|
||||||
|
- fprintf(stderr, "====================================================\n");
|
||||||
|
+ hciprintf(stderr, "====================================================\n");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "TLV Header type is unknown (%d) \n", ptlv_header->tlv_type);
|
||||||
|
@@ -1083,7 +1082,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc
|
||||||
|
unsigned char cmd[HCI_MAX_CMD_SIZE];
|
||||||
|
unsigned char rsp[HCI_MAX_EVENT_SIZE];
|
||||||
|
|
||||||
|
- fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d wait_cc_evt = 0x%x\n", __FUNCTION__, index, seg_size, wait_cc_evt);
|
||||||
|
+ hciprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d wait_cc_evt = 0x%x\n", __FUNCTION__, index, seg_size, wait_cc_evt);
|
||||||
|
|
||||||
|
/* Frame the HCI CMD PKT to be sent to Controller*/
|
||||||
|
frame_hci_cmd_pkt(cmd, EDL_PATCH_TLV_REQ_CMD, 0, index, seg_size);
|
||||||
|
@@ -1109,7 +1108,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", __FUNCTION__, index);
|
||||||
|
+ hciprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", __FUNCTION__, index);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1123,7 +1122,7 @@ int rome_tlv_dnld_req(int fd, int tlv_size)
|
||||||
|
remain_size = (tlv_size < MAX_SIZE_PER_TLV_SEGMENT)?\
|
||||||
|
tlv_size: (tlv_size%MAX_SIZE_PER_TLV_SEGMENT);
|
||||||
|
|
||||||
|
- fprintf(stderr, "%s: TLV size: %d, Total Seg num: %d, remain size: %d\n",
|
||||||
|
+ hciprintf(stderr, "%s: TLV size: %d, Total Seg num: %d, remain size: %d\n",
|
||||||
|
__FUNCTION__,tlv_size, total_segment, remain_size);
|
||||||
|
|
||||||
|
if (gTlv_type == TLV_TYPE_PATCH) {
|
||||||
|
@@ -1137,12 +1136,12 @@ int rome_tlv_dnld_req(int fd, int tlv_size)
|
||||||
|
case ROME_SKIP_EVT_NONE:
|
||||||
|
wait_vsc_evt = TRUE;
|
||||||
|
wait_cc_evt = TRUE;
|
||||||
|
- fprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_NONE", __func__);
|
||||||
|
+ hciprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_NONE", __func__);
|
||||||
|
break;
|
||||||
|
case ROME_SKIP_EVT_VSE_CC:
|
||||||
|
wait_vsc_evt = FALSE;
|
||||||
|
wait_cc_evt = FALSE;
|
||||||
|
- fprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_VSE_CC", __func__);
|
||||||
|
+ hciprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_VSE_CC", __func__);
|
||||||
|
break;
|
||||||
|
/* Not handled for now */
|
||||||
|
case ROME_SKIP_EVT_VSE:
|
||||||
|
@@ -1479,14 +1478,14 @@ int rome_1_0_nvm_tag_dnld(int fd)
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- fprintf(stderr, "%s: Start sending NVM Tags (ver: 0x%x)\n", __FUNCTION__, (unsigned int) NVM_VERSION);
|
||||||
|
+ hciprintf(stderr, "%s: Start sending NVM Tags (ver: 0x%x)\n", __FUNCTION__, (unsigned int) NVM_VERSION);
|
||||||
|
|
||||||
|
for (i=0; (i < MAX_TAG_CMD) && (cmds[i][0] != TAG_END); i++)
|
||||||
|
{
|
||||||
|
/* Write BD Address */
|
||||||
|
if(cmds[i][TAG_NUM_OFFSET] == TAG_NUM_2){
|
||||||
|
memcpy(&cmds[i][TAG_BDADDR_OFFSET], vnd_local_bd_addr, 6);
|
||||||
|
- fprintf(stderr, "BD Address: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
|
||||||
|
+ hciprintf(stderr, "BD Address: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
|
||||||
|
cmds[i][TAG_BDADDR_OFFSET ], cmds[i][TAG_BDADDR_OFFSET + 1],
|
||||||
|
cmds[i][TAG_BDADDR_OFFSET + 2], cmds[i][TAG_BDADDR_OFFSET + 3],
|
||||||
|
cmds[i][TAG_BDADDR_OFFSET + 4], cmds[i][TAG_BDADDR_OFFSET + 5]);
|
||||||
|
@@ -1598,7 +1597,7 @@ int rome_set_baudrate_req(int fd, int local_baud_rate,
|
||||||
|
flow_control(fd, MSM_DISABLE_FLOW_CTRL);
|
||||||
|
|
||||||
|
/* Send the HCI command packet to UART for transmission */
|
||||||
|
- fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ;
|
||||||
|
+ hciprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ;
|
||||||
|
err = write(fd, cmd, size);
|
||||||
|
if (err != size) {
|
||||||
|
fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err);
|
||||||
|
@@ -1616,7 +1615,7 @@ int rome_set_baudrate_req(int fd, int local_baud_rate,
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
- fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__);
|
||||||
|
|
||||||
|
/* Wait for command complete event */
|
||||||
|
err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE);
|
||||||
|
@@ -1624,7 +1623,6 @@ int rome_set_baudrate_req(int fd, int local_baud_rate,
|
||||||
|
fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
- fprintf(stderr, "%s\n", __FUNCTION__);
|
||||||
|
error:
|
||||||
|
return err;
|
||||||
|
|
||||||
|
@@ -1639,7 +1637,7 @@ int rome_hci_reset_req(int fd, char baud, int hwfc)
|
||||||
|
hci_command_hdr *cmd_hdr;
|
||||||
|
int flags;
|
||||||
|
|
||||||
|
- fprintf(stderr, "%s: HCI RESET \n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: HCI RESET \n", __FUNCTION__);
|
||||||
|
|
||||||
|
memset(cmd, 0x0, HCI_MAX_CMD_SIZE);
|
||||||
|
|
||||||
|
@@ -1656,7 +1654,7 @@ int rome_hci_reset_req(int fd, char baud, int hwfc)
|
||||||
|
flow_control(fd, MSM_DISABLE_FLOW_CTRL);
|
||||||
|
|
||||||
|
/* Send the HCI command packet to UART for transmission */
|
||||||
|
- fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]);
|
||||||
|
+ hciprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]);
|
||||||
|
err = write(fd, cmd, size);
|
||||||
|
if (err != size) {
|
||||||
|
fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err);
|
||||||
|
@@ -1768,28 +1766,28 @@ int qca_soc_init(int fd, int speed, char *bdaddr , struct termios * ti)
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
- fprintf(stderr, "%s: Rome Version (0x%08x)\n", __FUNCTION__, rome_ver);
|
||||||
|
+ hciprintf(stderr, "%s: Rome Version (0x%08x)\n", __FUNCTION__, rome_ver);
|
||||||
|
|
||||||
|
switch (rome_ver){
|
||||||
|
case ROME_VER_1_0:
|
||||||
|
{
|
||||||
|
/* Set and Download the RAMPATCH */
|
||||||
|
- fprintf(stderr, "%s: Setting Patch Header & Downloading Patches\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: Setting Patch Header & Downloading Patches\n", __FUNCTION__);
|
||||||
|
err = rome_download_rampatch(fd);
|
||||||
|
if (err < 0) {
|
||||||
|
fprintf(stderr, "%s: DOWNLOAD RAMPATCH failed!\n", __FUNCTION__);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
- fprintf(stderr, "%s: DOWNLOAD RAMPTACH complete\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: DOWNLOAD RAMPTACH complete\n", __FUNCTION__);
|
||||||
|
|
||||||
|
/* Attach the RAMPATCH */
|
||||||
|
- fprintf(stderr, "%s: Attaching the patches\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: Attaching the patches\n", __FUNCTION__);
|
||||||
|
err = rome_attach_rampatch(fd);
|
||||||
|
if (err < 0) {
|
||||||
|
fprintf(stderr, "%s: ATTACH RAMPATCH failed!\n", __FUNCTION__);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
- fprintf(stderr, "%s: ATTACH RAMPTACH complete\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: ATTACH RAMPTACH complete\n", __FUNCTION__);
|
||||||
|
|
||||||
|
/* Send Reset */
|
||||||
|
size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN);
|
||||||
|
@@ -1800,7 +1798,7 @@ int qca_soc_init(int fd, int speed, char *bdaddr , struct termios * ti)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* NVM download */
|
||||||
|
- fprintf(stderr, "%s: Downloading NVM\n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: Downloading NVM\n", __FUNCTION__);
|
||||||
|
err = rome_1_0_nvm_tag_dnld(fd);
|
||||||
|
if ( err <0 ) {
|
||||||
|
fprintf(stderr, "Downloading NVM Failed !!\n");
|
||||||
|
@@ -1817,7 +1815,7 @@ int qca_soc_init(int fd, int speed, char *bdaddr , struct termios * ti)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- fprintf(stderr, "HCI Reset is done\n");
|
||||||
|
+ hciprintf(stderr, "HCI Reset is done\n");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ROME_VER_1_1:
|
||||||
|
@@ -1874,7 +1872,7 @@ download:
|
||||||
|
fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
- fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__);
|
||||||
|
+ hciprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Overriding the baud rate value in NVM file with the user
|
||||||
|
@@ -1893,7 +1891,7 @@ download:
|
||||||
|
fprintf(stderr, "HCI Reset Failed !!!\n");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
- fprintf(stderr, "HCI Reset is done\n");
|
||||||
|
+ hciprintf(stderr, "HCI Reset is done\n");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case ROME_VER_UNKNOWN:
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012-2017 by Digi International Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License version 2 as published by
|
||||||
|
# the Free Software Foundation.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# !Description: Initialize bluetooth hardware
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
# Bluetooth power GPIO
|
||||||
|
BT_EN_QCA_GPIO_NR="244"
|
||||||
|
|
||||||
|
# set_gpio_value <gpio_nr> <value>
|
||||||
|
set_gpio_value() {
|
||||||
|
local SG_GPIONR="${1}"
|
||||||
|
local SG_GPIOVAL="${2}"
|
||||||
|
local SG_GPIOPATH="/sys/class/gpio/gpio${SG_GPIONR}"
|
||||||
|
|
||||||
|
[ -d "${SG_GPIOPATH}" ] || printf "%s" "${SG_GPIONR}" > /sys/class/gpio/export
|
||||||
|
printf out > "${SG_GPIOPATH}/direction" && sleep .2
|
||||||
|
printf "${SG_GPIOVAL}" > "${SG_GPIOPATH}/value" && sleep .2
|
||||||
|
[ -d "${SG_GPIOPATH}" ] && printf "%s" "${SG_GPIONR}" > /sys/class/gpio/unexport
|
||||||
|
}
|
||||||
|
|
||||||
|
# powercycle_gpio <gpio_nr>
|
||||||
|
powercycle_gpio() {
|
||||||
|
set_gpio_value "${1}" 0
|
||||||
|
set_gpio_value "${1}" 1
|
||||||
|
}
|
||||||
|
|
||||||
|
error() {
|
||||||
|
echo ${1}
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
bluetooth_init() {
|
||||||
|
# Get MAC address from the device tree. Use a default value if it has not been set.
|
||||||
|
BT_MACADDR="$(hexdump -ve '1/1 "%02X" ":"' /proc/device-tree/bluetooth/mac-address 2>/dev/null | sed 's/:$//g')"
|
||||||
|
if [ -z "${BT_MACADDR}" ] || [ "${BT_MACADDR}" = "00:00:00:00:00:00" ]; then
|
||||||
|
BT_MACADDR="00:04:F3:FF:FF:BB"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start the Bluetooth driver and bring up the interface
|
||||||
|
HCIATTACH_LOG="/var/log/hciattach.log"
|
||||||
|
|
||||||
|
for RETRY in $(seq 1 5)
|
||||||
|
do
|
||||||
|
killproc hciattach
|
||||||
|
powercycle_gpio "${BT_EN_QCA_GPIO_NR}"
|
||||||
|
if hciattach ttyBt qca ${BT_RATE:-3000000} -t30 ${BT_FLOW:-flow} unused ${BT_MACADDR} >${HCIATTACH_LOG} 2>&1; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
BT_ERROR="FAIL (hciattach)"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Source function library
|
||||||
|
. /etc/init.d/functions
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
if [ -d "/proc/device-tree/bluetooth" ]; then
|
||||||
|
echo -n "Starting bluetooth hardware: "
|
||||||
|
bluetooth_init
|
||||||
|
echo "${BT_ERROR:-done.}"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
if [ -d "/sys/class/bluetooth/hci0" ]; then
|
||||||
|
echo -n "Stopping bluetooth hardware: "
|
||||||
|
killproc hciattach
|
||||||
|
# Power down bluetooth
|
||||||
|
set_gpio_value "${BT_EN_QCA_GPIO_NR}" 0
|
||||||
|
echo "done."
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
$0 stop
|
||||||
|
sleep 1
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
[General]
|
||||||
|
|
||||||
|
# Default adapter name
|
||||||
|
# Defaults to 'BlueZ X.YZ'
|
||||||
|
Name = cc6qp
|
||||||
|
|
||||||
|
[Policy]
|
||||||
|
|
||||||
|
# AutoEnable defines option to enable all controllers when they are found.
|
||||||
|
# This includes adapters present on start as well as adapters that are plugged
|
||||||
|
# in later on. Defaults to 'false'.
|
||||||
|
AutoEnable=true
|
||||||
|
|
@ -0,0 +1,138 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012-2017 by Digi International Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License version 2 as published by
|
||||||
|
# the Free Software Foundation.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# !Description: Initialize bluetooth hardware
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
# Bluetooth power GPIO
|
||||||
|
BT_PWR_GPIO_NR="244"
|
||||||
|
|
||||||
|
# set_gpio_value <gpio_nr> <value>
|
||||||
|
set_gpio_value() {
|
||||||
|
local SG_GPIONR="${1}"
|
||||||
|
local SG_GPIOVAL="${2}"
|
||||||
|
local SG_GPIOPATH="/sys/class/gpio/gpio${SG_GPIONR}"
|
||||||
|
|
||||||
|
[ -d "${SG_GPIOPATH}" ] || printf "%s" "${SG_GPIONR}" > /sys/class/gpio/export
|
||||||
|
printf out > "${SG_GPIOPATH}/direction" && sleep .2
|
||||||
|
printf "${SG_GPIOVAL}" > "${SG_GPIOPATH}/value" && sleep .2
|
||||||
|
[ -d "${SG_GPIOPATH}" ] && printf "%s" "${SG_GPIONR}" > /sys/class/gpio/unexport
|
||||||
|
}
|
||||||
|
|
||||||
|
# powercycle_gpio <gpio_nr>
|
||||||
|
powercycle_gpio() {
|
||||||
|
set_gpio_value "${1}" 0
|
||||||
|
set_gpio_value "${1}" 1
|
||||||
|
}
|
||||||
|
|
||||||
|
error() {
|
||||||
|
echo ${1}
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
bluetooth_init() {
|
||||||
|
# Get MAC address from the device tree. Use a default value if it has not been set.
|
||||||
|
BT_MACADDR="$(hexdump -ve '1/1 "%02X" ":"' /proc/device-tree/bluetooth/mac-address 2>/dev/null | sed 's/:$//g')"
|
||||||
|
if [ -z "${BT_MACADDR}" ] || [ "${BT_MACADDR}" = "00:00:00:00:00:00" ]; then
|
||||||
|
BT_MACADDR="00:04:F3:FF:FF:BB"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use a sub-shell here to change to firmware directory
|
||||||
|
(
|
||||||
|
cd /lib/firmware/ar3k/1020200
|
||||||
|
|
||||||
|
# Update the MAC address file only if it has changed.
|
||||||
|
FW_MAC="ar3kbdaddr.pst"
|
||||||
|
[ -f "${FW_MAC}" ] && [ "$(cat ${FW_MAC})" = "${BT_MACADDR}" ] || echo ${BT_MACADDR} > ${FW_MAC}
|
||||||
|
|
||||||
|
# Symlink the correct firmware file depending on region code
|
||||||
|
JPN_REGCODE="0x2"
|
||||||
|
REGCODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null)"
|
||||||
|
BT_CLASS_LINK="PS_ASIC.pst"
|
||||||
|
BT_CLASS_FILE="PS_ASIC_class_1.pst"
|
||||||
|
if [ -n "${REGCODE}" ] && [ "${JPN_REGCODE}" = "${REGCODE}" ]; then
|
||||||
|
BT_CLASS_FILE="PS_ASIC_class_2.pst"
|
||||||
|
fi
|
||||||
|
if ! cmp -s ${BT_CLASS_FILE} ${BT_CLASS_LINK}; then
|
||||||
|
ln -sf ${BT_CLASS_FILE} ${BT_CLASS_LINK}
|
||||||
|
fi
|
||||||
|
# Remove not used configuration and readme files
|
||||||
|
# -- Do not quote the subcommand to avoid leading/trailing whitespace
|
||||||
|
# -- being part of the file name.
|
||||||
|
rm -f $(echo PS_ASIC_class_?.pst | sed -e "s,${BT_CLASS_FILE},,g") readme.txt
|
||||||
|
)
|
||||||
|
|
||||||
|
# Start the Bluetooth driver and bring up the interface
|
||||||
|
HCIATTACH_LOG="/var/log/hciattach.log"
|
||||||
|
BT_CMD="HCIATTACH"
|
||||||
|
RETRIES="5"
|
||||||
|
while [ "${RETRIES}" -gt "0" ]; do
|
||||||
|
case "${BT_CMD}" in
|
||||||
|
HCIATTACH)
|
||||||
|
# Reset BT
|
||||||
|
killproc hciattach
|
||||||
|
powercycle_gpio "${BT_PWR_GPIO_NR}"
|
||||||
|
if hciattach ttyBt ath3k 4000000 >${HCIATTACH_LOG} 2>&1; then
|
||||||
|
BT_CMD="HCICONFIG_UP"
|
||||||
|
else
|
||||||
|
BT_ERROR="FAILED (hciattach)"
|
||||||
|
BT_CMD="BT_INIT_FAIL"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
HCICONFIG_UP)
|
||||||
|
if hciconfig hci0 up; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
BT_ERROR="FAILED (hciconfig up)"
|
||||||
|
BT_CMD="BT_INIT_FAIL"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
BT_INIT_FAIL)
|
||||||
|
RETRIES="$((RETRIES - 1))"
|
||||||
|
BT_CMD="HCIATTACH"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
[ "${RETRIES}" = "0" ] && error "${BT_ERROR}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Source function library
|
||||||
|
. /etc/init.d/functions
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
if [ -d "/proc/device-tree/bluetooth" ]; then
|
||||||
|
echo -n "Starting bluetooth hardware: "
|
||||||
|
bluetooth_init
|
||||||
|
echo "done."
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
if [ -d "/sys/class/bluetooth/hci0" ]; then
|
||||||
|
echo -n "Stopping bluetooth hardware: "
|
||||||
|
hciconfig hci0 down || BT_ERROR="FAILED (hciconfig down)"
|
||||||
|
killproc hciattach
|
||||||
|
# Power down bluetooth
|
||||||
|
set_gpio_value "${BT_PWR_GPIO_NR}" 0
|
||||||
|
echo "${BT_ERROR:-done.}"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
$0 stop
|
||||||
|
sleep 1
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
[General]
|
||||||
|
|
||||||
|
# Default adapter name
|
||||||
|
# Defaults to 'BlueZ X.YZ'
|
||||||
|
Name = cc6
|
||||||
|
|
||||||
|
#[Policy]
|
||||||
|
|
||||||
|
# AutoEnable defines option to enable all controllers when they are found.
|
||||||
|
# This includes adapters present on start as well as adapters that are plugged
|
||||||
|
# in later on. Defaults to 'false'.
|
||||||
|
#AutoEnable=true
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012-2017 by Digi International Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License version 2 as published by
|
||||||
|
# the Free Software Foundation.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# !Description: Initialize bluetooth hardware
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
# Bluetooth power GPIO
|
||||||
|
BT_EN_QCA_GPIO_NR="137"
|
||||||
|
|
||||||
|
# set_gpio_value <gpio_nr> <value>
|
||||||
|
set_gpio_value() {
|
||||||
|
local SG_GPIONR="${1}"
|
||||||
|
local SG_GPIOVAL="${2}"
|
||||||
|
local SG_GPIOPATH="/sys/class/gpio/gpio${SG_GPIONR}"
|
||||||
|
|
||||||
|
[ -d "${SG_GPIOPATH}" ] || printf "%s" "${SG_GPIONR}" > /sys/class/gpio/export
|
||||||
|
printf out > "${SG_GPIOPATH}/direction" && sleep .2
|
||||||
|
printf "${SG_GPIOVAL}" > "${SG_GPIOPATH}/value" && sleep .2
|
||||||
|
[ -d "${SG_GPIOPATH}" ] && printf "%s" "${SG_GPIONR}" > /sys/class/gpio/unexport
|
||||||
|
}
|
||||||
|
|
||||||
|
# powercycle_gpio <gpio_nr>
|
||||||
|
powercycle_gpio() {
|
||||||
|
set_gpio_value "${1}" 0
|
||||||
|
set_gpio_value "${1}" 1
|
||||||
|
}
|
||||||
|
|
||||||
|
error() {
|
||||||
|
echo ${1}
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
bluetooth_init() {
|
||||||
|
# Get MAC address from the device tree. Use a default value if it has not been set.
|
||||||
|
BT_MACADDR="$(hexdump -ve '1/1 "%02X" ":"' /proc/device-tree/bluetooth/mac-address 2>/dev/null | sed 's/:$//g')"
|
||||||
|
if [ -z "${BT_MACADDR}" ] || [ "${BT_MACADDR}" = "00:00:00:00:00:00" ]; then
|
||||||
|
BT_MACADDR="00:04:F3:FF:FF:BB"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Module version older than revision 4 has swapped TX and RX lines
|
||||||
|
MOD_VERSION="$(($(cat /proc/device-tree/digi,hwid,hv 2>/dev/null || true)))"
|
||||||
|
if [ "${MOD_VERSION}" -lt "4" ]; then
|
||||||
|
# Ignore the CTS flow control
|
||||||
|
BT_CTS_QCA_GPIO_NR="18"
|
||||||
|
set_gpio_value "${BT_CTS_QCA_GPIO_NR}" 0
|
||||||
|
|
||||||
|
# Reduce the rate to avoid the need for HW flow control
|
||||||
|
BT_RATE="115200"
|
||||||
|
BT_RATE_CODE="00" # 115200 bps
|
||||||
|
BT_FLOW="noflow"
|
||||||
|
|
||||||
|
# Modify the baudrate in the firmware file
|
||||||
|
BT_FW_FILE="/lib/firmware/qca/nvm_tlv_3.2.bin"
|
||||||
|
if [ "$(hexdump -s 56 -n 1 -ve '1/1 "%.2x"' ${BT_FW_FILE})" != "${BT_RATE_CODE}" ]; then
|
||||||
|
printf "\x${BT_RATE_CODE}" | dd of="${BT_FW_FILE}" bs=1 seek=56 count=1 conv=notrunc,fsync 2>/dev/null
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start the Bluetooth driver and bring up the interface
|
||||||
|
HCIATTACH_LOG="/var/log/hciattach.log"
|
||||||
|
|
||||||
|
for RETRY in $(seq 1 5)
|
||||||
|
do
|
||||||
|
killproc hciattach
|
||||||
|
powercycle_gpio "${BT_EN_QCA_GPIO_NR}"
|
||||||
|
if hciattach ttyBt qca ${BT_RATE:-3000000} -t30 ${BT_FLOW:-flow} unused ${BT_MACADDR} >${HCIATTACH_LOG} 2>&1; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
BT_ERROR="FAIL (hciattach)"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Source function library
|
||||||
|
. /etc/init.d/functions
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
if [ -d "/proc/device-tree/bluetooth" ]; then
|
||||||
|
echo -n "Starting bluetooth hardware: "
|
||||||
|
bluetooth_init
|
||||||
|
echo "${BT_ERROR:-done.}"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
if [ -d "/sys/class/bluetooth/hci0" ]; then
|
||||||
|
echo -n "Stopping bluetooth hardware: "
|
||||||
|
killproc hciattach
|
||||||
|
# Power down bluetooth
|
||||||
|
set_gpio_value "${BT_EN_QCA_GPIO_NR}" 0
|
||||||
|
echo "done."
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
$0 stop
|
||||||
|
sleep 1
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
[General]
|
||||||
|
|
||||||
|
# Default adapter name
|
||||||
|
# Defaults to 'BlueZ X.YZ'
|
||||||
|
Name = cc6ul
|
||||||
|
|
||||||
|
[Policy]
|
||||||
|
|
||||||
|
# AutoEnable defines option to enable all controllers when they are found.
|
||||||
|
# This includes adapters present on start as well as adapters that are plugged
|
||||||
|
# in later on. Defaults to 'false'.
|
||||||
|
AutoEnable=true
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
All versions of the SDP server in BlueZ 5.46 and earlier are vulnerable to an
|
||||||
|
information disclosure vulnerability which allows remote attackers to obtain
|
||||||
|
sensitive information from the bluetoothd process memory. This vulnerability
|
||||||
|
lies in the processing of SDP search attribute requests.
|
||||||
|
|
||||||
|
CVE: CVE-2017-1000250
|
||||||
|
Upstream-Status: Backport
|
||||||
|
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
||||||
|
|
||||||
|
From 9e009647b14e810e06626dde7f1bb9ea3c375d09 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
|
||||||
|
Date: Wed, 13 Sep 2017 10:01:40 +0300
|
||||||
|
Subject: sdp: Fix Out-of-bounds heap read in service_search_attr_req function
|
||||||
|
|
||||||
|
Check if there is enough data to continue otherwise return an error.
|
||||||
|
---
|
||||||
|
src/sdpd-request.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/sdpd-request.c b/src/sdpd-request.c
|
||||||
|
index 1eefdce..318d044 100644
|
||||||
|
--- a/src/sdpd-request.c
|
||||||
|
+++ b/src/sdpd-request.c
|
||||||
|
@@ -917,7 +917,7 @@ static int service_search_attr_req(sdp_req_t *req, sdp_buf_t *buf)
|
||||||
|
} else {
|
||||||
|
/* continuation State exists -> get from cache */
|
||||||
|
sdp_buf_t *pCache = sdp_get_cached_rsp(cstate);
|
||||||
|
- if (pCache) {
|
||||||
|
+ if (pCache && cstate->cStateValue.maxBytesSent < pCache->data_size) {
|
||||||
|
uint16_t sent = MIN(max, pCache->data_size - cstate->cStateValue.maxBytesSent);
|
||||||
|
pResponse = pCache->data;
|
||||||
|
memcpy(buf->data, pResponse + cstate->cStateValue.maxBytesSent, sent);
|
||||||
|
--
|
||||||
|
cgit v1.1
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
|
DESC=bluetooth
|
||||||
|
|
||||||
|
DAEMON=@LIBEXECDIR@/bluetooth/bluetoothd
|
||||||
|
|
||||||
|
# If you want to be ignore error of "org.freedesktop.hostname1",
|
||||||
|
# please enable NOPLUGIN_OPTION.
|
||||||
|
# NOPLUGIN_OPTION="--noplugin=hostname"
|
||||||
|
NOPLUGIN_OPTION=""
|
||||||
|
SSD_OPTIONS="--oknodo --quiet --exec $DAEMON -- $NOPLUGIN_OPTION"
|
||||||
|
|
||||||
|
test -f $DAEMON || exit 0
|
||||||
|
|
||||||
|
# FIXME: any of the sourced files may fail if/with syntax errors
|
||||||
|
test -f /etc/default/bluetooth && . /etc/default/bluetooth
|
||||||
|
test -f /etc/default/rcS && . /etc/default/rcS
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
start)
|
||||||
|
echo "Starting $DESC"
|
||||||
|
|
||||||
|
if test "$BLUETOOTH_ENABLED" = 0; then
|
||||||
|
echo "disabled. see /etc/default/bluetooth"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
start-stop-daemon --start --background $SSD_OPTIONS
|
||||||
|
echo "${DAEMON##*/}"
|
||||||
|
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
echo "Stopping $DESC"
|
||||||
|
if test "$BLUETOOTH_ENABLED" = 0; then
|
||||||
|
echo "disabled."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
start-stop-daemon --stop $SSD_OPTIONS
|
||||||
|
echo "${DAEMON}"
|
||||||
|
;;
|
||||||
|
restart|force-reload)
|
||||||
|
$0 stop
|
||||||
|
sleep 1
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
pidof ${DAEMON} >/dev/null
|
||||||
|
status=$?
|
||||||
|
if [ $status -eq 0 ]; then
|
||||||
|
echo "bluetooth is running."
|
||||||
|
else
|
||||||
|
echo "bluetooth is not running"
|
||||||
|
fi
|
||||||
|
exit $status
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
N=/etc/init.d/bluetooth
|
||||||
|
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
# vim:noet
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
From ed55b49a226ca3909f52416be2ae5ce1c5ca2cb2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ross Burton <ross.burton@intel.com>
|
||||||
|
Date: Fri, 22 Apr 2016 15:40:37 +0100
|
||||||
|
Subject: [PATCH] Makefile.obexd: add missing mkdir in builtin.h generation
|
||||||
|
|
||||||
|
In parallel out-of-tree builds it's possible that obexd/src/builtin.h is
|
||||||
|
generated before the target directory has been implicitly created. Solve this by
|
||||||
|
creating the directory before writing into it.
|
||||||
|
|
||||||
|
Upstream-Status: Submitted
|
||||||
|
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
||||||
|
---
|
||||||
|
Makefile.obexd | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/Makefile.obexd b/Makefile.obexd
|
||||||
|
index 2e33cbc..c8286f0 100644
|
||||||
|
--- a/Makefile.obexd
|
||||||
|
+++ b/Makefile.obexd
|
||||||
|
@@ -105,2 +105,3 @@ obexd/src/plugin.$(OBJEXT): obexd/src/builtin.h
|
||||||
|
obexd/src/builtin.h: obexd/src/genbuiltin $(obexd_builtin_sources)
|
||||||
|
+ $(AM_V_at)$(MKDIR_P) $(dir $@)
|
||||||
|
$(AM_V_GEN)$(srcdir)/obexd/src/genbuiltin $(obexd_builtin_modules) > $@
|
||||||
|
--
|
||||||
|
2.8.0.rc3
|
||||||
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
cd unit
|
||||||
|
|
||||||
|
failed=0
|
||||||
|
all=0
|
||||||
|
|
||||||
|
for f in test-*; do
|
||||||
|
"./$f"
|
||||||
|
case "$?" in
|
||||||
|
0)
|
||||||
|
echo "PASS: $f"
|
||||||
|
all=$((all + 1))
|
||||||
|
;;
|
||||||
|
77)
|
||||||
|
echo "SKIP: $f"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "FAIL: $f"
|
||||||
|
failed=$((failed + 1))
|
||||||
|
all=$((all + 1))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$failed" -eq 0 ] ; then
|
||||||
|
echo "All $all tests passed"
|
||||||
|
else
|
||||||
|
echo "$failed of $all tests failed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
SUMMARY = "Linux Bluetooth Stack Userland V5"
|
||||||
|
DESCRIPTION = "Linux Bluetooth stack V5 userland components. These include a system configurations, daemons, tools and system libraries."
|
||||||
|
HOMEPAGE = "http://www.bluez.org"
|
||||||
|
SECTION = "libs"
|
||||||
|
LICENSE = "GPLv2+ & LGPLv2.1+"
|
||||||
|
LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
|
||||||
|
file://COPYING.LIB;md5=fb504b67c50331fc78734fed90fb0e09 \
|
||||||
|
file://src/main.c;beginline=1;endline=24;md5=9bc54b93cd7e17bf03f52513f39f926e"
|
||||||
|
DEPENDS = "udev libusb dbus-glib glib-2.0 libcheck readline"
|
||||||
|
PROVIDES += "bluez-hcidump"
|
||||||
|
RPROVIDES_${PN} += "bluez-hcidump"
|
||||||
|
|
||||||
|
RCONFLICTS_${PN} = "bluez4"
|
||||||
|
|
||||||
|
PACKAGECONFIG ??= "obex-profiles"
|
||||||
|
PACKAGECONFIG[obex-profiles] = "--enable-obex,--disable-obex,libical"
|
||||||
|
PACKAGECONFIG[experimental] = "--enable-experimental,--disable-experimental,"
|
||||||
|
|
||||||
|
SRC_URI = "\
|
||||||
|
${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
|
||||||
|
file://out-of-tree.patch \
|
||||||
|
file://init \
|
||||||
|
file://run-ptest \
|
||||||
|
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch', d)} \
|
||||||
|
file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \
|
||||||
|
file://cve-2017-1000250.patch \
|
||||||
|
"
|
||||||
|
S = "${WORKDIR}/bluez-${PV}"
|
||||||
|
|
||||||
|
inherit autotools pkgconfig systemd update-rc.d distro_features_check ptest
|
||||||
|
|
||||||
|
EXTRA_OECONF = "\
|
||||||
|
--enable-tools \
|
||||||
|
--disable-cups \
|
||||||
|
--enable-test \
|
||||||
|
--enable-datafiles \
|
||||||
|
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--enable-systemd', '--disable-systemd', d)} \
|
||||||
|
--enable-library \
|
||||||
|
"
|
||||||
|
|
||||||
|
# bluez5 builds a large number of useful utilities but does not
|
||||||
|
# install them. Specify which ones we want put into ${PN}-noinst-tools.
|
||||||
|
NOINST_TOOLS_READLINE ??= ""
|
||||||
|
NOINST_TOOLS_EXPERIMENTAL ??= ""
|
||||||
|
NOINST_TOOLS = " \
|
||||||
|
${NOINST_TOOLS_READLINE} \
|
||||||
|
${@bb.utils.contains('PACKAGECONFIG', 'experimental', '${NOINST_TOOLS_EXPERIMENTAL}', '', d)} \
|
||||||
|
"
|
||||||
|
|
||||||
|
do_install_append() {
|
||||||
|
install -d ${D}${INIT_D_DIR}
|
||||||
|
install -m 0755 ${WORKDIR}/init ${D}${INIT_D_DIR}/bluetooth
|
||||||
|
|
||||||
|
install -d ${D}${sysconfdir}/bluetooth/
|
||||||
|
if [ -f ${S}/profiles/audio/audio.conf ]; then
|
||||||
|
install -m 0644 ${S}/profiles/audio/audio.conf ${D}/${sysconfdir}/bluetooth/
|
||||||
|
fi
|
||||||
|
if [ -f ${S}/profiles/network/network.conf ]; then
|
||||||
|
install -m 0644 ${S}/profiles/network/network.conf ${D}/${sysconfdir}/bluetooth/
|
||||||
|
fi
|
||||||
|
if [ -f ${S}/profiles/input/input.conf ]; then
|
||||||
|
install -m 0644 ${S}/profiles/input/input.conf ${D}/${sysconfdir}/bluetooth/
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f ${D}/${sysconfdir}/init.d/bluetooth ]; then
|
||||||
|
sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}/${sysconfdir}/init.d/bluetooth
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install desired tools that upstream leaves in build area
|
||||||
|
for f in ${NOINST_TOOLS} ; do
|
||||||
|
install -m 755 ${B}/$f ${D}/${bindir}
|
||||||
|
done
|
||||||
|
|
||||||
|
# Patch python tools to use Python 3; they should be source compatible, but
|
||||||
|
# still refer to Python 2 in the shebang
|
||||||
|
sed -i -e '1s,#!.*python.*,#!${bindir}/python3,' ${D}${libdir}/bluez/test/*
|
||||||
|
}
|
||||||
|
|
||||||
|
ALLOW_EMPTY_libasound-module-bluez = "1"
|
||||||
|
PACKAGES =+ "libasound-module-bluez ${PN}-testtools ${PN}-obex ${PN}-noinst-tools"
|
||||||
|
|
||||||
|
FILES_libasound-module-bluez = "${libdir}/alsa-lib/lib*.so ${datadir}/alsa"
|
||||||
|
FILES_${PN} += "${libdir}/bluetooth/plugins/*.so ${systemd_unitdir}/ ${datadir}/dbus-1"
|
||||||
|
FILES_${PN}-dev += "\
|
||||||
|
${libdir}/bluetooth/plugins/*.la \
|
||||||
|
${libdir}/alsa-lib/*.la \
|
||||||
|
"
|
||||||
|
|
||||||
|
FILES_${PN}-obex = "${libexecdir}/bluetooth/obexd \
|
||||||
|
${exec_prefix}/lib/systemd/user/obex.service \
|
||||||
|
${datadir}/dbus-1/services/org.bluez.obex.service \
|
||||||
|
"
|
||||||
|
SYSTEMD_SERVICE_${PN}-obex = "obex.service"
|
||||||
|
|
||||||
|
FILES_${PN}-testtools = "${libdir}/bluez/test/*"
|
||||||
|
|
||||||
|
def get_noinst_tools_paths (d, bb, tools):
|
||||||
|
s = list()
|
||||||
|
bindir = d.getVar("bindir", True)
|
||||||
|
for bdp in tools.split():
|
||||||
|
f = os.path.basename(bdp)
|
||||||
|
s.append("%s/%s" % (bindir, f))
|
||||||
|
return "\n".join(s)
|
||||||
|
|
||||||
|
FILES_${PN}-noinst-tools = "${@get_noinst_tools_paths(d, bb, d.getVar('NOINST_TOOLS', True))}"
|
||||||
|
|
||||||
|
RDEPENDS_${PN}-testtools += "python3 python3-dbus python3-pygobject"
|
||||||
|
|
||||||
|
SYSTEMD_SERVICE_${PN} = "bluetooth.service"
|
||||||
|
INITSCRIPT_PACKAGES = "${PN}"
|
||||||
|
INITSCRIPT_NAME_${PN} = "bluetooth"
|
||||||
|
|
||||||
|
EXCLUDE_FROM_WORLD = "1"
|
||||||
|
|
||||||
|
do_compile_ptest() {
|
||||||
|
oe_runmake buildtests
|
||||||
|
}
|
||||||
|
|
||||||
|
do_install_ptest() {
|
||||||
|
cp -r ${B}/unit/ ${D}${PTEST_PATH}
|
||||||
|
rm -f ${D}${PTEST_PATH}/unit/*.o
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
require bluez5.inc
|
||||||
|
|
||||||
|
REQUIRED_DISTRO_FEATURES = "bluez5"
|
||||||
|
|
||||||
|
SRC_URI[md5sum] = "318341b2188698130adb73236ee69244"
|
||||||
|
SRC_URI[sha256sum] = "df7dc4462494dad4e60a2943240d584f6e760235dca64f5f10eba46dbab7f5f0"
|
||||||
|
|
||||||
|
# noinst programs in Makefile.tools that are conditional on READLINE
|
||||||
|
# support
|
||||||
|
NOINST_TOOLS_READLINE ?= " \
|
||||||
|
attrib/gatttool \
|
||||||
|
tools/obex-client-tool \
|
||||||
|
tools/obex-server-tool \
|
||||||
|
tools/bluetooth-player \
|
||||||
|
tools/obexctl \
|
||||||
|
tools/btmgmt \
|
||||||
|
"
|
||||||
|
|
||||||
|
# noinst programs in Makefile.tools that are conditional on EXPERIMENTAL
|
||||||
|
# support
|
||||||
|
NOINST_TOOLS_EXPERIMENTAL ?= " \
|
||||||
|
emulator/btvirt \
|
||||||
|
emulator/b1ee \
|
||||||
|
emulator/hfp \
|
||||||
|
tools/3dsp \
|
||||||
|
tools/mgmt-tester \
|
||||||
|
tools/gap-tester \
|
||||||
|
tools/l2cap-tester \
|
||||||
|
tools/sco-tester \
|
||||||
|
tools/smp-tester \
|
||||||
|
tools/hci-tester \
|
||||||
|
tools/rfcomm-tester \
|
||||||
|
tools/bdaddr \
|
||||||
|
tools/avinfo \
|
||||||
|
tools/avtest \
|
||||||
|
tools/scotest \
|
||||||
|
tools/amptest \
|
||||||
|
tools/hwdb \
|
||||||
|
tools/hcieventmask \
|
||||||
|
tools/hcisecfilter \
|
||||||
|
tools/btinfo \
|
||||||
|
tools/btattach \
|
||||||
|
tools/btsnoop \
|
||||||
|
tools/btproxy \
|
||||||
|
tools/btiotest \
|
||||||
|
tools/mcaptest \
|
||||||
|
tools/cltest \
|
||||||
|
tools/oobtest \
|
||||||
|
tools/seq2bseq \
|
||||||
|
tools/ibeacon \
|
||||||
|
tools/btgatt-client \
|
||||||
|
tools/btgatt-server \
|
||||||
|
tools/gatt-service \
|
||||||
|
profiles/iap/iapd \
|
||||||
|
"
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
# Copyright (C) 2015-2018 Digi International.
|
||||||
|
|
||||||
|
FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:"
|
||||||
|
|
||||||
|
SRC_URI += " \
|
||||||
|
file://bluetooth-init \
|
||||||
|
file://main.conf \
|
||||||
|
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 \
|
||||||
|
"
|
||||||
|
|
||||||
|
SRC_URI_append_ccimx6ul = " ${QCA6564_COMMON_PATCHES}"
|
||||||
|
SRC_URI_append_ccimx6qpsbc = " ${QCA6564_COMMON_PATCHES}"
|
||||||
|
|
||||||
|
inherit update-rc.d
|
||||||
|
|
||||||
|
PACKAGECONFIG_append = " experimental"
|
||||||
|
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
PACKAGES =+ "${PN}-init"
|
||||||
|
|
||||||
|
FILES_${PN} += " ${sysconfdir}/bluetooth/main.conf"
|
||||||
|
FILES_${PN}-init = "${sysconfdir}/init.d/bluetooth-init"
|
||||||
|
|
||||||
|
INITSCRIPT_PACKAGES += "${PN}-init"
|
||||||
|
INITSCRIPT_NAME_${PN}-init = "bluetooth-init"
|
||||||
|
INITSCRIPT_PARAMS_${PN}-init = "start 19 2 3 4 5 . stop 21 0 1 6 ."
|
||||||
|
|
||||||
|
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||||
Loading…
Reference in New Issue