summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--69-btattach-bcm.rules33
-rw-r--r--backport-bluez-disable-test-mesh-crypto.patch14
-rw-r--r--bluez-5.79-sw.patch25
-rw-r--r--bluez.gitignore100
-rw-r--r--bluez.spec310
-rw-r--r--btattach-bcm-service.sh30
-rw-r--r--btattach-bcm@.service6
-rw-r--r--sources1
9 files changed, 520 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..3d170c6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/bluez-5.80.tar.xz
diff --git a/69-btattach-bcm.rules b/69-btattach-bcm.rules
new file mode 100644
index 0000000..dfe8d1e
--- /dev/null
+++ b/69-btattach-bcm.rules
@@ -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"
diff --git a/backport-bluez-disable-test-mesh-crypto.patch b/backport-bluez-disable-test-mesh-crypto.patch
new file mode 100644
index 0000000..144b6dd
--- /dev/null
+++ b/backport-bluez-disable-test-mesh-crypto.patch
@@ -0,0 +1,14 @@
+Index: b/Makefile.am
+===================================================================
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -537,7 +539,7 @@ unit_test_midi_LDADD = src/libshared-gli
+ endif
+
+ if MESH
+-unit_tests += unit/test-mesh-crypto
++#unit_tests += unit/test-mesh-crypto
+ unit_test_mesh_crypto_CPPFLAGS = $(ell_cflags)
+ unit_test_mesh_crypto_SOURCES = unit/test-mesh-crypto.c \
+ mesh/crypto.h ell/internal ell/ell.h
+
diff --git a/bluez-5.79-sw.patch b/bluez-5.79-sw.patch
new file mode 100644
index 0000000..93ad959
--- /dev/null
+++ b/bluez-5.79-sw.patch
@@ -0,0 +1,25 @@
+--- bluez-5.79/ell/missing.h.orig 2023-09-27 17:03:04.000000000 +0800
++++ bluez-5.79/ell/missing.h 2024-11-02 18:15:00.035804200 +0800
+@@ -13,6 +13,8 @@
+ # define __NR_getrandom 318
+ # elif defined(__i386__)
+ # define __NR_getrandom 355
++# elif defined(__sw_64__)
++# define __NR_getrandom 511
+ # elif defined(__arm__)
+ # define __NR_getrandom 384
+ # elif defined(__aarch64__)
+--- bluez-5.79/profiles/network/bnep.c.orig 2022-01-06 05:53:58.000000000 +0800
++++ bluez-5.79/profiles/network/bnep.c 2024-11-02 18:15:00.046665600 +0800
+@@ -256,7 +256,11 @@
+
+ memset(&timeo, 0, sizeof(timeo));
+ timeo.tv_sec = 0;
++#if defined(__sw_64__)
++ if (setsockopt(sk, SOL_SOCKET, SO_RCVTIMEO_OLD, &timeo,
++#else
+ if (setsockopt(sk, SOL_SOCKET, SO_RCVTIMEO, &timeo,
++#endif
+ sizeof(timeo)) < 0) {
+ error("bnep: Set setsockopt failed: %s", strerror(errno));
+ goto failed;
diff --git a/bluez.gitignore b/bluez.gitignore
new file mode 100644
index 0000000..137d2e5
--- /dev/null
+++ b/bluez.gitignore
@@ -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
diff --git a/bluez.spec b/bluez.spec
new file mode 100644
index 0000000..42cbedd
--- /dev/null
+++ b/bluez.spec
@@ -0,0 +1,310 @@
+Name: bluez
+Summary: Bluetooth utilities
+Version: 5.80
+Release: 1
+License: GPL-2.0-or-later
+URL: https://www.bluez.org/
+Source0: https://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
+
+# workaround for broken tests (reported upstream but not yet fixed)
+# upstream:https://github.com/bluez/bluez/commit/5fc60b2ce7c4370ff8d9bc3d3c3434b212465f40
+Patch6000: backport-bluez-disable-test-mesh-crypto.patch
+Patch6013: bluez-5.79-sw.patch
+
+BuildRequires: gcc make
+BuildRequires: autoconf automake libtool
+BuildRequires: pkgconfig(cups)
+BuildRequires: pkgconfig(dbus-1) >= 1.10
+BuildRequires: pkgconfig(glib-2.0) >= 2.28
+BuildRequires: pkgconfig(gthread-2.0) >= 2.16
+BuildRequires: pkgconfig(json-c) >= 0.13
+BuildRequires: pkgconfig(libical)
+BuildRequires: pkgconfig(libudev) >= 196
+BuildRequires: pkgconfig(systemd)
+BuildRequires: readline-devel
+BuildRequires: python3-docutils python3-pygments
+
+Requires: dbus >= 1.10
+Requires: %{name}-libs = %{version}-%{release}
+%{?systemd_requires}
+Provides: bluez-hid2hci = %{version}-%{release}
+Provides: bluez-obexd = %{version}-%{release}
+Provides: bluez-mesh = %{version}-%{release}
+Obsoletes: bluez-hid2hci < %{version}-%{release}
+Obsoletes: bluez-obexd < %{version}-%{release}
+Obsoletes: bluez-mesh < %{version}-%{release}
+
+%description
+This package provides all utilities for use in Bluetooth applications.
+The BLUETOOTH trademarks are owned by Bluetooth SIG, Inc., U.S.A.
+
+%package libs
+Summary: Libraries for bluez
+
+%description libs
+Libraries forbluez.
+
+%package devel
+Summary: Development libraries for Bluetooth applications
+Requires: %{name}-libs = %{version}-%{release}
+Provides: bluez-libs-devel = %{version}-%{release}
+Obsoletes: bluez-libs-devel < %{version}-%{release}
+
+%description devel
+This package provides development libraries and headers for Bluetooth related
+applications.
+
+%package_help
+
+%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 -p1
+
+%build
+libtoolize -f
+autoreconf -f -i
+%configure --enable-tools --enable-library --enable-deprecated \
+ --enable-sixaxis --enable-cups --enable-nfc --enable-mesh \
+ --enable-hid2hci --enable-testing \
+ --with-systemdsystemunitdir=%{_unitdir} \
+ --with-systemduserunitdir=%{_userunitdir}
+%make_build V=1
+
+%install
+%make_install
+install -m0755 attrib/gatttool $RPM_BUILD_ROOT%{_bindir}
+
+%delete_la
+
+# 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 %{buildroot}/%{_sysconfdir}/udev/*.rules %{buildroot}/usr/lib/udev/rules.d/*.rules
+install -D -p -m 0644 tools/hid2hci.rules %{buildroot}/%{_udevrulesdir}/97-hid2hci.rules
+install -d -m 0755 %{buildroot}/%{_localstatedir}/lib/bluetooth
+install -d -m 0755 %{buildroot}/%{_localstatedir}/lib/bluetooth/mesh
+install -d %{buildroot}/%{_libdir}/bluetooth/
+
+# Copy bluetooth config file
+install -D -p -m0644 src/main.conf %{buildroot}/etc/bluetooth/main.conf
+install -D -p -m0644 mesh/mesh-main.conf %{buildroot}/etc/bluetooth/mesh-main.conf
+install -D -p -m0644 profiles/input/input.conf %${buildroot}/etc/bluetooth/input.conf
+install -D -p -m0644 profiles/network/network.conf %${buildroot}/etc/bluetooth/network.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 %{S:2} ${RPM_BUILD_ROOT}/%{_udevrulesdir}/
+install -D -p -m0644 %{S:3} ${RPM_BUILD_ROOT}/%{_unitdir}/
+install -D -p -m0755 %{S:4} ${RPM_BUILD_ROOT}/%{_libexecdir}/bluetooth/
+
+%check
+# fails test-vcp due to lto - https://github.com/bluez/bluez/issues/683
+%make_build check || /bin/true
+
+%preun
+%systemd_preun bluetooth.service
+%systemd_user_preun obex.service
+%systemd_preun bluetooth-mesh.service
+
+%post
+%systemd_post bluetooth.service
+/sbin/udevadm trigger --subsystem-match=usb
+%systemd_user_post obex.service
+%systemd_post bluetooth-mesh.service
+
+%postun
+%systemd_postun_with_restart bluetooth.service
+
+%files
+%doc AUTHORS ChangeLog
+%license COPYING
+%config %{_sysconfdir}/bluetooth/main.conf
+%config %{_sysconfdir}/bluetooth/input.conf
+%config %{_sysconfdir}/bluetooth/network.conf
+%config %{_sysconfdir}/bluetooth/mesh-main.conf
+%{_datadir}/dbus-1/system.d/bluetooth.conf
+%{_datadir}/dbus-1/system.d/bluetooth-mesh.conf
+%{_bindir}/*
+%{_libdir}/bluetooth/
+%{_prefix}/lib/udev/hid2hci
+%{_libexecdir}/bluetooth/obexd
+%{_libexecdir}/bluetooth/bluetoothd
+%{_libexecdir}/bluetooth/bluetooth-meshd
+%{_libexecdir}/bluetooth/btattach-bcm-service.sh
+%{_localstatedir}/lib/bluetooth
+%{_unitdir}/bluetooth.service
+%{_unitdir}/btattach-bcm@.service
+%{_unitdir}/bluetooth-mesh.service
+%{_datadir}/zsh/site-functions/_bluetoothctl
+%{_datadir}/dbus-1/services/org.bluez.obex.service
+%{_userunitdir}/dbus-org.bluez.obex.service
+%{_userunitdir}/mpris-proxy.service
+%{_datadir}/dbus-1/system-services/org.bluez.service
+%{_datadir}/dbus-1/system-services/org.bluez.mesh.service
+%{_userunitdir}/obex.service
+%{_udevrulesdir}/97-hid2hci.rules
+%{_udevrulesdir}/69-btattach-bcm.rules
+
+%files libs
+%{_libdir}/libbluetooth.so.*
+
+%files devel
+%doc doc/*txt
+%{_libdir}/libbluetooth.so
+%{_includedir}/bluetooth
+%{_libdir}/pkgconfig/bluez.pc
+
+%files cups
+%_cups_serverbin/backend/bluetooth
+
+%files help
+%{_mandir}/man1/*
+%{_mandir}/man5/*
+%{_mandir}/man8/*
+%{_mandir}/man7/*
+
+%changelog
+* Mon Mar 17 2025 Funda Wang <fundawang@yeah.net> - 5.80-1
+- update to 5.80
+
+* Sat Nov 02 2024 Funda Wang <fundawang@yeah.net> - 5.79-1
+- update to 5.79
+- rediff sw64 patch
+
+* Tue Sep 10 2024 Funda Wang <fundawang@yeah.net> - 5.78-1
+- update to 5.78
+
+* Tue Jul 16 2024 dillon chen <dillon.chen@gmail.com> - 5.77-1
+- update to 5.77
+
+* Thu Jul 11 2024 dillon chen <dillon.chen@gmail.com> - 5.76-1
+- update to 5.76
+
+* Tue Jun 4 2024 xuchenchen <xuchenchen@kylinos.cn> - 5.71-3
+- sync patches from community, shared/csip: Fix memory leak
+
+* Sun Apr 28 2024 xuchenchen <xuchenchen@kylinos.cn> - 5.71-2
+- mgmt: Fix crash after pair command
+
+* Tue Jan 23 2024 zhangpan <zhangpan103@h-partners.com> - 5.71-1
+- update to 5.71
+
+* Fri Dec 22 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 5.54-19
+- fix CVE-2023-50229,CVE-2023-50230
+
+* Fri Dec 08 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 5.54-18
+- fix CVE-2023-45866
+
+* Tue Apr 18 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 5.54-17
+- DESC:fix CVE-2023-27349
+
+* Thu Dec 08 2022 zhangzhixin <zhixin.zhang@i-soft.com.cn> - 5.54-16
+- add sw64 patch
+
+* Wed Sep 07 2022 wangkerong <wangkerong@h-partners.com> - 5.54-15
+- DESC:fix CVE-2022-39176,CVE-2022-39177
+
+* Wed Jul 13 2022 wangkerong <wangkerong@h-partners.com> - 5.54-14
+- DESC:fix CVE-2021-41229
+
+* Fri Mar 18 2022 xingxing <xingxing9@h-partners.com> - 5.54-13
+- Type:CVE
+- CVE:CVE-2022-0204
+- SUG:NA
+- DESC:fix CVE-2022-0204 and add prefix for CVE-2021-0129
+
+* Tue Mar 1 2022 xingxing <xingxing9@h-partners.com> - 5.54-12
+- Type:CVE
+- CVE:CVE-2021-0129
+- SUG:NA
+- DESC:fix CVE-2021-0129
+
+* Fri Feb 11 2022 xingxing <xingxing9@h-partners.com> - 5.54-11
+- Type:CVE
+- CVE:CVE-2021-43400
+- SUG:NA
+- DESC:fix CVE-2021-43400
+
+* Thu Jan 13 2022 wangkerong <wangkerong@huawei.com> - 5.54-10
+- DESC:fix an error in logs during bluez installation or uninstallation
+
+* Fri Sep 24 2021 yanan <yanan@huawei.com> - 5.54-9
+- DESC:fix CVE-2021-3658
+
+* Tue Aug 10 2021 zhanzhimin <zhanzhimin@huawei.com> - 5.54-8
+- Type:CVE
+- ID:CVE-2020-27153
+- SUG:NA
+- DESC:fix CVE-2020-27153
+
+* Tue Aug 10 2021 yanan <yanan@huawei.com> - 5.54-7
+- DESC: fix conflict with unistd.h
+
+* Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 5.54-6
+- DESC: delete -S git from %autosetup, and delete BuildRequires git-core
+
+* Mon Jun 28 2021 hanhui <hanhui15@huawei.com> - 5.54-5
+- DESC:disable test-mesh-crypto
+
+* Sat Jun 26 2021 zhanzhimin <zhanzhimin@huawei.com> - 5.54-4
+- Type:CVE
+- ID:CVE-2021-3588
+- SUG:NA
+- DESC:fix CVE-2021-3588
+
+* Wed Sep 16 2020 orange-snn <songnannan2@huawei.com> - 5.54-3
+- bugfix test-mesh-crypto faild
+
+* Mon Aug 10 2020 shixuantong <shixuantong@huawei.com> - 5.54-2
+- update yaml file
+
+* Wed Jul 22 2020 songnannan <songnannan2@huawei.com> - 5.54-1
+- update to 5.54
+
+* Wed May 20 2020 songnannan <songnannan2@huawei.com> - 5.50-9
+- delete the check temporarily
+
+* Wed Apr 22 2020 openEuler Buildteam <buildteam@openeuler.org> - 5.50-8
+- Type:cves
+- ID:CVE-2020-0556
+- SUG:NA
+- DESC:fix CVE-2020-0556
+
+* Wed Mar 18 2020 chenzhen <chenzhen44@huawei.com> - 5.50-7
+- Type:cves
+- ID:CVE-2018-10910
+- SUG:NA
+- DESC:fix CVE-2018-10910
+
+* Mon Feb 17 2020 hexiujun <hexiujun1@huawei.com> - 5.50-6
+- Type:enhancement
+- ID:NA
+- SUG:NA
+- DESC:unpack libs subpackage
+
+* Sat Jan 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 5.50-5
+- Type:enhancement
+- ID:NA
+- SUG:NA
+- DESC: delete patches
+
+* Tue Sep 17 2019 Alex Chao <zhaolei746@huawei.com> - 5.50-4
+- Package init
diff --git a/btattach-bcm-service.sh b/btattach-bcm-service.sh
new file mode 100644
index 0000000..c7f8b17
--- /dev/null
+++ b/btattach-bcm-service.sh
@@ -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
diff --git a/btattach-bcm@.service b/btattach-bcm@.service
new file mode 100644
index 0000000..1e7c7db
--- /dev/null
+++ b/btattach-bcm@.service
@@ -0,0 +1,6 @@
+[Unit]
+Description=btattach for Broadcom devices
+
+[Service]
+Type=simple
+ExecStart=/usr/libexec/bluetooth/btattach-bcm-service.sh %I
diff --git a/sources b/sources
new file mode 100644
index 0000000..e76e9ac
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+9c408deafeccb400690e340d0abfe864 bluez-5.80.tar.xz