Package init
This commit is contained in:
commit
3d0cfcbbb6
35
0001-build-Always-define-confdir-and-statedir.patch
Normal file
35
0001-build-Always-define-confdir-and-statedir.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 69d2e7bebb79f500179298c6c51fafbc217df6c8 Mon Sep 17 00:00:00 2001
|
||||
From: Bastien Nocera <hadess@hadess.net>
|
||||
Date: Wed, 20 Sep 2017 12:49:10 +0200
|
||||
Subject: [PATCH 1/4] build: Always define confdir and statedir
|
||||
|
||||
As we will need those paths to lock down on them.
|
||||
---
|
||||
Makefile.am | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 555f301ca..1c38d94e5 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -30,14 +30,14 @@ include_HEADERS =
|
||||
AM_CFLAGS = $(WARNING_CFLAGS) $(MISC_CFLAGS)
|
||||
AM_LDFLAGS = $(MISC_LDFLAGS)
|
||||
|
||||
+confdir = $(sysconfdir)/bluetooth
|
||||
+statedir = $(localstatedir)/lib/bluetooth
|
||||
+
|
||||
if DATAFILES
|
||||
dbusdir = @DBUS_CONFDIR@/dbus-1/system.d
|
||||
dbus_DATA = src/bluetooth.conf
|
||||
|
||||
-confdir = $(sysconfdir)/bluetooth
|
||||
conf_DATA =
|
||||
-
|
||||
-statedir = $(localstatedir)/lib/bluetooth
|
||||
state_DATA =
|
||||
endif
|
||||
|
||||
--
|
||||
2.14.1
|
||||
|
||||
31
0001-build-Enable-BIND_NOW.patch
Normal file
31
0001-build-Enable-BIND_NOW.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From e45c8fdcb3d7cdb654f6819c02d1bbb5b40b6116 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Thu, 7 Nov 2013 09:23:35 +0100
|
||||
Subject: [PATCH 1/4] build: Enable BIND_NOW
|
||||
|
||||
Partial RELRO means that the object is GNU_RELRO but not BIND_NOW. This
|
||||
reduces the effectiveness of RELRO. bluez triggers this because it
|
||||
enables PIE during the build, and rpmdiff takes this as an indicator
|
||||
that the best possible hardening is desired.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=983161
|
||||
---
|
||||
acinclude.m4 | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/acinclude.m4 b/acinclude.m4
|
||||
index bc39c6d73..efce2f3cb 100644
|
||||
--- a/acinclude.m4
|
||||
+++ b/acinclude.m4
|
||||
@@ -50,7 +50,7 @@ AC_DEFUN([MISC_FLAGS], [
|
||||
if (test "${enableval}" = "yes" &&
|
||||
test "${ac_cv_prog_cc_pie}" = "yes"); then
|
||||
misc_cflags="$misc_cflags -fPIC"
|
||||
- misc_ldflags="$misc_ldflags -pie"
|
||||
+ misc_ldflags="$misc_ldflags -pie -Wl,-z,now"
|
||||
fi
|
||||
])
|
||||
if (test "$enable_coverage" = "yes"); then
|
||||
--
|
||||
2.14.1
|
||||
|
||||
38
0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch
Normal file
38
0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch
Normal file
@ -0,0 +1,38 @@
|
||||
From 90b72b787a6ae6b9b0bf8ece238e108e8607a433 Mon Sep 17 00:00:00 2001
|
||||
From: Bastien Nocera <hadess@hadess.net>
|
||||
Date: Sat, 9 Nov 2013 18:13:43 +0100
|
||||
Subject: [PATCH 1/2] obex: Use GLib helper function to manipulate paths
|
||||
|
||||
Instead of trying to do it by hand. This also makes sure that
|
||||
relative paths aren't used by the agent.
|
||||
---
|
||||
obexd/src/manager.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/obexd/src/manager.c b/obexd/src/manager.c
|
||||
index f84384ae4..285c07c37 100644
|
||||
--- a/obexd/src/manager.c
|
||||
+++ b/obexd/src/manager.c
|
||||
@@ -650,14 +650,14 @@ static void agent_reply(DBusPendingCall *call, void *user_data)
|
||||
DBUS_TYPE_STRING, &name,
|
||||
DBUS_TYPE_INVALID)) {
|
||||
/* Splits folder and name */
|
||||
- const char *slash = strrchr(name, '/');
|
||||
+ gboolean is_relative = !g_path_is_absolute(name);
|
||||
DBG("Agent replied with %s", name);
|
||||
- if (!slash) {
|
||||
- agent->new_name = g_strdup(name);
|
||||
+ if (is_relative) {
|
||||
+ agent->new_name = g_path_get_basename(name);
|
||||
agent->new_folder = NULL;
|
||||
} else {
|
||||
- agent->new_name = g_strdup(slash + 1);
|
||||
- agent->new_folder = g_strndup(name, slash - name);
|
||||
+ agent->new_name = g_path_get_basename(name);
|
||||
+ agent->new_folder = g_path_get_dirname(name);
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.14.1
|
||||
|
||||
72
0001-policy-Add-logic-to-connect-a-Sink.patch
Normal file
72
0001-policy-Add-logic-to-connect-a-Sink.patch
Normal file
@ -0,0 +1,72 @@
|
||||
From 477ecca127c529611adbc53f08039cefaf86305d Mon Sep 17 00:00:00 2001
|
||||
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
|
||||
Date: Tue, 26 Jun 2018 13:37:33 +0300
|
||||
Subject: [PATCH] policy: Add logic to connect a Sink
|
||||
|
||||
If HFP/HSP HS connects and the device also supports a Sink connect it
|
||||
as well since some devices (e.g. Sony MW600) may not connect it
|
||||
automatically.
|
||||
---
|
||||
plugins/policy.c | 39 +++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 39 insertions(+)
|
||||
|
||||
diff --git a/plugins/policy.c b/plugins/policy.c
|
||||
index 1f5a506a2..de51e58b9 100644
|
||||
--- a/plugins/policy.c
|
||||
+++ b/plugins/policy.c
|
||||
@@ -297,6 +297,42 @@ static void sink_cb(struct btd_service *service, btd_service_state_t old_state,
|
||||
}
|
||||
}
|
||||
|
||||
+static void hs_cb(struct btd_service *service, btd_service_state_t old_state,
|
||||
+ btd_service_state_t new_state)
|
||||
+{
|
||||
+ struct btd_device *dev = btd_service_get_device(service);
|
||||
+ struct policy_data *data;
|
||||
+ struct btd_service *sink;
|
||||
+
|
||||
+ /* If the device supports Sink set a timer to connect it as well */
|
||||
+ sink = btd_device_get_service(dev, A2DP_SINK_UUID);
|
||||
+ if (sink == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ data = policy_get_data(dev);
|
||||
+
|
||||
+ switch (new_state) {
|
||||
+ case BTD_SERVICE_STATE_UNAVAILABLE:
|
||||
+ break;
|
||||
+ case BTD_SERVICE_STATE_DISCONNECTED:
|
||||
+ break;
|
||||
+ case BTD_SERVICE_STATE_CONNECTING:
|
||||
+ break;
|
||||
+ case BTD_SERVICE_STATE_CONNECTED:
|
||||
+ /* Check if service initiate the connection then proceed
|
||||
+ * immediately otherwise set timer
|
||||
+ */
|
||||
+ if (old_state == BTD_SERVICE_STATE_CONNECTING)
|
||||
+ policy_connect(data, sink);
|
||||
+ else if (btd_service_get_state(sink) !=
|
||||
+ BTD_SERVICE_STATE_CONNECTED)
|
||||
+ policy_set_sink_timer(data);
|
||||
+ break;
|
||||
+ case BTD_SERVICE_STATE_DISCONNECTING:
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static gboolean policy_connect_tg(gpointer user_data)
|
||||
{
|
||||
struct policy_data *data = user_data;
|
||||
@@ -615,6 +651,9 @@ static void service_cb(struct btd_service *service,
|
||||
controller_cb(service, old_state, new_state);
|
||||
else if (g_str_equal(profile->remote_uuid, AVRCP_TARGET_UUID))
|
||||
target_cb(service, old_state, new_state);
|
||||
+ else if (g_str_equal(profile->remote_uuid, HFP_HS_UUID) ||
|
||||
+ g_str_equal(profile->remote_uuid, HSP_HS_UUID))
|
||||
+ hs_cb(service, old_state, new_state);
|
||||
|
||||
/*
|
||||
* Return if the reconnection feature is not enabled (all
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
From 4570164f0c90603bd07eb9e7c07e17bbafb5b5da Mon Sep 17 00:00:00 2001
|
||||
From: Craig Andrews <candrews@integralblue.com>
|
||||
Date: Wed, 13 Sep 2017 15:23:09 +0200
|
||||
Subject: [PATCH 2/4] systemd: Add PrivateTmp and NoNewPrivileges options
|
||||
|
||||
PrivateTmp makes bluetoothd's /tmp and /var/tmp be inside a different
|
||||
namespace. This is useful to secure access to temporary files of the
|
||||
process.
|
||||
|
||||
NoNewPrivileges ensures that service process and all its children
|
||||
can never gain new privileges through execve(), lowering the risk of
|
||||
possible privilege escalations.
|
||||
---
|
||||
src/bluetooth.service.in | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/src/bluetooth.service.in b/src/bluetooth.service.in
|
||||
index f799f65f0..a6f3030f9 100644
|
||||
--- a/src/bluetooth.service.in
|
||||
+++ b/src/bluetooth.service.in
|
||||
@@ -12,8 +12,14 @@ NotifyAccess=main
|
||||
#Restart=on-failure
|
||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
||||
LimitNPROC=1
|
||||
+
|
||||
+# Filesystem lockdown
|
||||
ProtectHome=true
|
||||
ProtectSystem=full
|
||||
+PrivateTmp=true
|
||||
+
|
||||
+# Privilege escalation
|
||||
+NoNewPrivileges=true
|
||||
|
||||
[Install]
|
||||
WantedBy=bluetooth.target
|
||||
--
|
||||
2.14.1
|
||||
|
||||
43
0003-systemd-Add-more-filesystem-lockdown.patch
Normal file
43
0003-systemd-Add-more-filesystem-lockdown.patch
Normal file
@ -0,0 +1,43 @@
|
||||
From 73a9c0902e7c97adf96e735407a75033152c04a9 Mon Sep 17 00:00:00 2001
|
||||
From: Bastien Nocera <hadess@hadess.net>
|
||||
Date: Wed, 13 Sep 2017 15:37:11 +0200
|
||||
Subject: [PATCH 3/4] systemd: Add more filesystem lockdown
|
||||
|
||||
We can only access the configuration file as read-only and read-write
|
||||
to the Bluetooth cache directory and sub-directories.
|
||||
---
|
||||
Makefile.am | 2 ++
|
||||
src/bluetooth.service.in | 4 ++++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 1c38d94e5..13ccf9079 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -478,6 +478,8 @@ MAINTAINERCLEANFILES = Makefile.in \
|
||||
|
||||
SED_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
|
||||
$(SED) -e 's,@libexecdir\@,$(libexecdir),g' \
|
||||
+ -e 's,@statedir\@,$(statedir),g' \
|
||||
+ -e 's,@confdir\@,$(confdir),g' \
|
||||
< $< > $@
|
||||
|
||||
%.service: %.service.in Makefile
|
||||
diff --git a/src/bluetooth.service.in b/src/bluetooth.service.in
|
||||
index a6f3030f9..7e55b5043 100644
|
||||
--- a/src/bluetooth.service.in
|
||||
+++ b/src/bluetooth.service.in
|
||||
@@ -17,6 +17,10 @@ LimitNPROC=1
|
||||
ProtectHome=true
|
||||
ProtectSystem=full
|
||||
PrivateTmp=true
|
||||
+ProtectKernelTunables=true
|
||||
+ProtectControlGroups=true
|
||||
+ReadWritePaths=@statedir@
|
||||
+ReadOnlyPaths=@confdir@
|
||||
|
||||
# Privilege escalation
|
||||
NoNewPrivileges=true
|
||||
--
|
||||
2.14.1
|
||||
|
||||
41
0003-tools-csr_usb-Fix-compilation-failure.patch
Normal file
41
0003-tools-csr_usb-Fix-compilation-failure.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 07a12a6685ea57be18f39e349dbc42e4af3744ed Mon Sep 17 00:00:00 2001
|
||||
From: Bastien Nocera <hadess@hadess.net>
|
||||
Date: Tue, 5 Sep 2017 10:32:15 +0200
|
||||
Subject: [PATCH 3/4] tools/csr_usb: Fix compilation failure
|
||||
|
||||
GCC's "format-nonliteral" security check is enabled as an error in
|
||||
recent versions of Fedora. Given the reduced scope of use, mark the
|
||||
error as ignorable through pragma.
|
||||
|
||||
tools/csr_usb.c: In function 'read_value':
|
||||
tools/csr_usb.c:82:2: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
|
||||
n = fscanf(file, format, &value);
|
||||
^
|
||||
---
|
||||
tools/csr_usb.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/tools/csr_usb.c b/tools/csr_usb.c
|
||||
index a1d7324f7..33e9968a2 100644
|
||||
--- a/tools/csr_usb.c
|
||||
+++ b/tools/csr_usb.c
|
||||
@@ -67,6 +67,8 @@ struct usbfs_bulktransfer {
|
||||
#define USBFS_IOCTL_CLAIMINTF _IOR('U', 15, unsigned int)
|
||||
#define USBFS_IOCTL_RELEASEINTF _IOR('U', 16, unsigned int)
|
||||
|
||||
+#pragma GCC diagnostic push
|
||||
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
static int read_value(const char *name, const char *attr, const char *format)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
@@ -88,6 +90,7 @@ static int read_value(const char *name, const char *attr, const char *format)
|
||||
fclose(file);
|
||||
return value;
|
||||
}
|
||||
+#pragma GCC diagnostic pop
|
||||
|
||||
static char *check_device(const char *name)
|
||||
{
|
||||
--
|
||||
2.14.1
|
||||
|
||||
34
0004-systemd-More-lockdown.patch
Normal file
34
0004-systemd-More-lockdown.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From 171d812218883281fed57b57fafd5c18eac441ac Mon Sep 17 00:00:00 2001
|
||||
From: Bastien Nocera <hadess@hadess.net>
|
||||
Date: Wed, 13 Sep 2017 15:38:26 +0200
|
||||
Subject: [PATCH 4/4] systemd: More lockdown
|
||||
|
||||
bluetoothd does not need to execute mapped memory, or real-time
|
||||
access, so block those.
|
||||
---
|
||||
src/bluetooth.service.in | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/src/bluetooth.service.in b/src/bluetooth.service.in
|
||||
index 7e55b5043..e8267b338 100644
|
||||
--- a/src/bluetooth.service.in
|
||||
+++ b/src/bluetooth.service.in
|
||||
@@ -22,9 +22,15 @@ ProtectControlGroups=true
|
||||
ReadWritePaths=@statedir@
|
||||
ReadOnlyPaths=@confdir@
|
||||
|
||||
+# Execute Mappings
|
||||
+MemoryDenyWriteExecute=true
|
||||
+
|
||||
# Privilege escalation
|
||||
NoNewPrivileges=true
|
||||
|
||||
+# Real-time
|
||||
+RestrictRealtime=true
|
||||
+
|
||||
[Install]
|
||||
WantedBy=bluetooth.target
|
||||
Alias=dbus-org.bluez.service
|
||||
--
|
||||
2.14.1
|
||||
|
||||
33
69-btattach-bcm.rules
Normal file
33
69-btattach-bcm.rules
Normal file
@ -0,0 +1,33 @@
|
||||
# Some devices have a bluetooth HCI connected to an uart, these needs to be
|
||||
# setup by calling btattach. The systemd btattach-bcm.service takes care of
|
||||
# this. These udev rules hardware-activate that service when necessary.
|
||||
#
|
||||
# For now this only suports ACPI enumerated Broadcom BT HCIs.
|
||||
# This has been tested on Bay and Cherry Trail devices with both ACPI and
|
||||
# PCI enumerated UARTs.
|
||||
|
||||
# Note we check for the platform device not for the acpi device, because
|
||||
# some DSDTs list multiple bluetooth adapters, but only some (or none)
|
||||
# are enabled. Only enabled adapters get a platform device created.
|
||||
ACTION!="add", GOTO="btattach_bcm_rules_end"
|
||||
SUBSYSTEM!="platform", GOTO="btattach_bcm_rules_end"
|
||||
|
||||
KERNEL=="BCM2E1A:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E39:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E3A:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E3D:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E3F:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E40:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E54:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E55:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E64:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E65:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E67:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E71:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E7B:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E7C:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E7E:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E95:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
KERNEL=="BCM2E96:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
|
||||
|
||||
LABEL="btattach_bcm_rules_end"
|
||||
BIN
bluez-5.50.tar.xz
Normal file
BIN
bluez-5.50.tar.xz
Normal file
Binary file not shown.
100
bluez.gitignore
Normal file
100
bluez.gitignore
Normal file
@ -0,0 +1,100 @@
|
||||
*.o
|
||||
*.a
|
||||
*.lo
|
||||
*.la
|
||||
*.so
|
||||
.deps
|
||||
.libs
|
||||
.dirstamp
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
depcomp
|
||||
compile
|
||||
install-sh
|
||||
libtool
|
||||
ltmain.sh
|
||||
missing
|
||||
stamp-h1
|
||||
autom4te.cache
|
||||
|
||||
ylwrap
|
||||
lexer.c
|
||||
parser.h
|
||||
parser.c
|
||||
|
||||
bluez.pc
|
||||
lib/bluetooth
|
||||
src/builtin.h
|
||||
src/bluetoothd
|
||||
audio/telephony.c
|
||||
sap/sap.c
|
||||
scripts/bluetooth.rules
|
||||
scripts/97-bluetooth.rules
|
||||
scripts/97-bluetooth-hid2hci.rules
|
||||
|
||||
sbc/sbcdec
|
||||
sbc/sbcenc
|
||||
sbc/sbcinfo
|
||||
sbc/sbctester
|
||||
|
||||
attrib/gatttool
|
||||
tools/avctrl
|
||||
tools/avinfo
|
||||
tools/bccmd
|
||||
tools/ciptool
|
||||
tools/dfubabel
|
||||
tools/dfutool
|
||||
tools/hciattach
|
||||
tools/hciconfig
|
||||
tools/hcieventmask
|
||||
tools/hcisecfilter
|
||||
tools/hcitool
|
||||
tools/hid2hci
|
||||
tools/rfcomm
|
||||
tools/l2ping
|
||||
tools/ppporc
|
||||
tools/sdptool
|
||||
cups/bluetooth
|
||||
test/agent
|
||||
test/bdaddr
|
||||
test/hciemu
|
||||
test/attest
|
||||
test/hstest
|
||||
test/avtest
|
||||
test/l2test
|
||||
test/rctest
|
||||
test/scotest
|
||||
test/gaptest
|
||||
test/sdptest
|
||||
test/lmptest
|
||||
test/ipctest
|
||||
test/btiotest
|
||||
test/test-textfile
|
||||
test/uuidtest
|
||||
test/mpris-player
|
||||
compat/dund
|
||||
compat/hidd
|
||||
compat/pand
|
||||
unit/test-eir
|
||||
mgmt/btmgmt
|
||||
monitor/btmon
|
||||
emulator/btvirt
|
||||
|
||||
doc/*.bak
|
||||
doc/*.stamp
|
||||
doc/bluez.*
|
||||
doc/bluez-*.txt
|
||||
doc/*.sgml
|
||||
doc/version.xml
|
||||
doc/xml
|
||||
doc/html
|
||||
src/bluetoothd.8
|
||||
src/bluetooth.service
|
||||
161
bluez.spec
Normal file
161
bluez.spec
Normal file
@ -0,0 +1,161 @@
|
||||
Name: bluez
|
||||
Summary: Bluetooth utilities
|
||||
Version: 5.50
|
||||
Release: 4
|
||||
License: GPLv2+
|
||||
URL: http://www.bluez.org/
|
||||
Source0: http://www.kernel.org/pub/linux/bluetooth/bluez-%{version}.tar.xz
|
||||
# The following sources all come from upstream
|
||||
Source1: bluez.gitignore
|
||||
Source2: 69-btattach-bcm.rules
|
||||
Source3: btattach-bcm@.service
|
||||
Source4: btattach-bcm-service.sh
|
||||
|
||||
# The following patches all come from fedoraproject
|
||||
Patch0001: 0001-build-Enable-BIND_NOW.patch
|
||||
Patch0002: 0003-tools-csr_usb-Fix-compilation-failure.patch
|
||||
Patch0003: 0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch
|
||||
Patch0004: 0001-build-Always-define-confdir-and-statedir.patch
|
||||
Patch0005: 0002-systemd-Add-PrivateTmp-and-NoNewPrivileges-options.patch
|
||||
Patch0006: 0003-systemd-Add-more-filesystem-lockdown.patch
|
||||
Patch0007: 0004-systemd-More-lockdown.patch
|
||||
Patch0008: 0001-policy-Add-logic-to-connect-a-Sink.patch
|
||||
BuildRequires: dbus-devel >= 1.6
|
||||
BuildRequires: git-core glib2-devel libical-devel readline-devel libell-devel
|
||||
BuildRequires: json-c-devel systemd-devel cups-devel libtool automake autoconf
|
||||
Requires: dbus >= 1.6
|
||||
Requires(post): systemd
|
||||
Requires(preun): systemd
|
||||
Requires(postun): systemd
|
||||
Provides: bluez-libs bluez-hid2hci bluez-obexd
|
||||
Obsoletes: bluez-libs bluez-hid2hci bluez-obexd
|
||||
|
||||
%description
|
||||
This package provides all utilities for use in Bluetooth applications.
|
||||
The BLUETOOTH trademarks are owned by Bluetooth SIG, Inc., U.S.A.
|
||||
|
||||
%package devel
|
||||
Summary: Development libraries for Bluetooth applications
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Provides: bluez-libs-devel
|
||||
Obsoletes: bluez-libs-devel
|
||||
|
||||
%description devel
|
||||
This package provides development libraries and headers for Bluetooth related
|
||||
applications.
|
||||
|
||||
%package help
|
||||
Summary: Help manual for bluetooth application related utilities
|
||||
|
||||
%description help
|
||||
This package provides help manual function for Bluetooth utilities separately.
|
||||
|
||||
%package cups
|
||||
Summary: CUPS printer backend for Bluetooth printers
|
||||
Requires: bluez%{?_isa} = %{version}-%{release}
|
||||
Requires: cups
|
||||
|
||||
%description cups
|
||||
This package contains the CUPS backend
|
||||
|
||||
%prep
|
||||
%autosetup -S git
|
||||
|
||||
%build
|
||||
libtoolize -f
|
||||
autoreconf -f -i
|
||||
%configure --enable-tools --enable-library --enable-deprecated \
|
||||
--enable-sixaxis --enable-cups --enable-nfc --enable-mesh \
|
||||
--with-systemdsystemunitdir=%{_unitdir} \
|
||||
--with-systemduserunitdir=%{_userunitdir}
|
||||
%make_build V=1
|
||||
|
||||
%install
|
||||
%make_install
|
||||
install -m0755 attrib/gatttool $RPM_BUILD_ROOT%{_bindir}
|
||||
|
||||
# Remove autocrap and libtool related redundant items
|
||||
find $RPM_BUILD_ROOT -name '*.la' -delete
|
||||
|
||||
# Remove the cups backend from libdir, and install it in new default CUPS binary directory
|
||||
if test -d ${RPM_BUILD_ROOT}/usr/lib64/cups ; then
|
||||
install -D -m0755 ${RPM_BUILD_ROOT}/usr/lib64/cups/backend/bluetooth ${RPM_BUILD_ROOT}%_cups_serverbin/backend/bluetooth
|
||||
rm -rf ${RPM_BUILD_ROOT}%{_libdir}/cups
|
||||
fi
|
||||
|
||||
rm -f ${RPM_BUILD_ROOT}/%{_udevrulesdir}/*.rules
|
||||
install -D -p -m0644 tools/hid2hci.rules ${RPM_BUILD_ROOT}/%{_udevrulesdir}/97-hid2hci.rules
|
||||
install -d -m0755 $RPM_BUILD_ROOT/%{_localstatedir}/lib/bluetooth
|
||||
install -d $RPM_BUILD_ROOT/%{_libdir}/bluetooth/
|
||||
|
||||
# Copy bluetooth config file
|
||||
install -D -p -m0644 src/main.conf ${RPM_BUILD_ROOT}/etc/bluetooth/main.conf
|
||||
# Setup auto enable
|
||||
sed -i 's/#\[Policy\]$/\[Policy\]/; s/#AutoEnable=false/AutoEnable=true/' ${RPM_BUILD_ROOT}/%{_sysconfdir}/bluetooth/main.conf
|
||||
|
||||
# Serial port connected Broadcom HCIs scripts
|
||||
install -D -p -m0644 %{SOURCE2} ${RPM_BUILD_ROOT}/%{_udevrulesdir}/
|
||||
install -D -p -m0644 %{SOURCE3} ${RPM_BUILD_ROOT}/%{_unitdir}/
|
||||
install -D -p -m0755 %{SOURCE4} ${RPM_BUILD_ROOT}/%{_libexecdir}/bluetooth/
|
||||
|
||||
%check
|
||||
make check
|
||||
|
||||
%preun
|
||||
%systemd_preun bluetooth.service
|
||||
%systemd_user_preun obex.service
|
||||
|
||||
%post
|
||||
%systemd_post bluetooth.service
|
||||
/sbin/udevadm trigger --subsystem-match=usb
|
||||
%systemd_user_post obex.service
|
||||
/sbin/ldconfig
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart bluetooth.service
|
||||
/sbin/ldconfig
|
||||
|
||||
%files
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license COPYING
|
||||
%doc AUTHORS ChangeLog
|
||||
%config %{_sysconfdir}/dbus-1/system.d/bluetooth.conf
|
||||
%config %{_sysconfdir}/bluetooth/main.conf
|
||||
%{_bindir}/*
|
||||
%{_libexecdir}/bluetooth/bluetoothd
|
||||
%{_libexecdir}/bluetooth/btattach-bcm-service.sh
|
||||
# This is obexd relative file
|
||||
%{_libexecdir}/bluetooth/obexd
|
||||
%{_libdir}/bluetooth/
|
||||
# This is libs file
|
||||
%{_libdir}/libbluetooth.so.*
|
||||
# This is hid2hci relative file
|
||||
%{_exec_prefix}/lib/udev/hid2hci
|
||||
%{_localstatedir}/lib/bluetooth
|
||||
%{_datadir}/dbus-1/system-services/org.bluez.service
|
||||
# This is obexd relative file
|
||||
%{_datadir}/dbus-1/services/org.bluez.obex.service
|
||||
%{_unitdir}/bluetooth.service
|
||||
%{_unitdir}/btattach-bcm@.service
|
||||
%{_udevrulesdir}/69-btattach-bcm.rules
|
||||
# hid2hci relative files
|
||||
%{_udevrulesdir}/97-hid2hci.rules
|
||||
# obexd relative files
|
||||
%{_userunitdir}/obex.service
|
||||
|
||||
%files help
|
||||
%{_mandir}/man1/*
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%files devel
|
||||
%doc doc/*txt
|
||||
%{_libdir}/libbluetooth.so
|
||||
%{_includedir}/bluetooth
|
||||
%{_libdir}/pkgconfig/bluez.pc
|
||||
|
||||
%files cups
|
||||
%_cups_serverbin/backend/bluetooth
|
||||
|
||||
%changelog
|
||||
* Tue Sep 17 2019 Alex Chao <zhaolei746@huawei.com> - 5.50-4
|
||||
- Package init
|
||||
30
btattach-bcm-service.sh
Normal file
30
btattach-bcm-service.sh
Normal file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Simple shell script to wait for the tty for an uart using BT HCI to show up
|
||||
# and then invoke btattach with the right parameters, this is intended to be
|
||||
# invoked from a hardware-activated systemd service
|
||||
#
|
||||
# For now this only suports ACPI enumerated Broadcom BT HCIs.
|
||||
# This has been tested on Bay and Cherry Trail devices with both ACPI and
|
||||
# PCI enumerated UARTs.
|
||||
#
|
||||
# Note the kernel bt developers are working on solving this entirely in the
|
||||
# kernel, so it is not worth the trouble to write something better then this.
|
||||
|
||||
BT_DEV="/sys/bus/platform/devices/$1"
|
||||
BT_DEV="$(readlink -f $BT_DEV)"
|
||||
UART_DEV="$(dirname $BT_DEV)"
|
||||
|
||||
# Stupid GPD-pocket has USB BT with id 0000:0000, but still claims to have
|
||||
# an uart attached bt
|
||||
if [ "$1" = "BCM2E7E:00" ] && lsusb | grep -q "ID 0000:0000"; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while [ ! -d "$UART_DEV/tty" ]; do
|
||||
sleep .2
|
||||
done
|
||||
|
||||
TTY="$(ls $UART_DEV/tty)"
|
||||
|
||||
exec btattach --bredr "/dev/$TTY" -P bcm
|
||||
6
btattach-bcm@.service
Normal file
6
btattach-bcm@.service
Normal file
@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=btattach for Broadcom devices
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/libexec/bluetooth/btattach-bcm-service.sh %I
|
||||
Loading…
x
Reference in New Issue
Block a user