From 1e78a7b5661a3c11302066262cd250776c83c656 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Fri, 13 Jul 2018 02:45:38 -0500 Subject: user/bluez: pull in, bump, fix up --- .../001-bcm43xx-Add-bcm43xx-3wire-variant.patch | 21 ++++ ...-UART-speed-must-be-reset-after-the-firmw.patch | 33 ++++++ ...003-Increase-firmware-load-timeout-to-30s.patch | 20 ++++ ...-Move-the-43xx-firmware-into-lib-firmware.patch | 20 ++++ user/bluez/APKBUILD | 116 +++++++++++++++++++++ user/bluez/bluetooth.initd | 13 +++ .../bluez/bluez-5.40-obexd_without_systemd-1.patch | 61 +++++++++++ user/bluez/disable-lock-test.patch | 18 ++++ user/bluez/fix-endianness.patch | 10 ++ user/bluez/rfcomm.confd | 5 + user/bluez/rfcomm.initd | 27 +++++ 11 files changed, 344 insertions(+) create mode 100644 user/bluez/001-bcm43xx-Add-bcm43xx-3wire-variant.patch create mode 100644 user/bluez/002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch create mode 100644 user/bluez/003-Increase-firmware-load-timeout-to-30s.patch create mode 100644 user/bluez/004-Move-the-43xx-firmware-into-lib-firmware.patch create mode 100644 user/bluez/APKBUILD create mode 100644 user/bluez/bluetooth.initd create mode 100644 user/bluez/bluez-5.40-obexd_without_systemd-1.patch create mode 100644 user/bluez/disable-lock-test.patch create mode 100644 user/bluez/fix-endianness.patch create mode 100644 user/bluez/rfcomm.confd create mode 100644 user/bluez/rfcomm.initd diff --git a/user/bluez/001-bcm43xx-Add-bcm43xx-3wire-variant.patch b/user/bluez/001-bcm43xx-Add-bcm43xx-3wire-variant.patch new file mode 100644 index 000000000..96e8a26c5 --- /dev/null +++ b/user/bluez/001-bcm43xx-Add-bcm43xx-3wire-variant.patch @@ -0,0 +1,21 @@ +From b4f2b77472aeb967d3a7595e8a965785c7a37c87 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 16 Feb 2016 16:40:46 +0000 +Subject: [PATCH 1/4] bcm43xx: Add bcm43xx-3wire variant + +--- + tools/hciattach.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -1144,6 +1144,9 @@ struct uart_t uart[] = { + { "bcm43xx", 0x0000, 0x0000, HCI_UART_H4, 115200, 3000000, + FLOW_CTL, DISABLE_PM, NULL, bcm43xx, NULL }, + ++ { "bcm43xx-3wire", 0x0000, 0x0000, HCI_UART_3WIRE, 115200, 3000000, ++ 0, DISABLE_PM, NULL, bcm43xx, NULL }, ++ + { "ath3k", 0x0000, 0x0000, HCI_UART_ATH3K, 115200, 115200, + FLOW_CTL, DISABLE_PM, NULL, ath3k_ps, ath3k_pm }, + diff --git a/user/bluez/002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch b/user/bluez/002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch new file mode 100644 index 000000000..a221861d2 --- /dev/null +++ b/user/bluez/002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch @@ -0,0 +1,33 @@ +From e145c9621f976063e5c573db1f2053d906f63427 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 16 Feb 2016 16:39:09 +0000 +Subject: [PATCH 2/4] bcm43xx: The UART speed must be reset after the firmware + download + +--- + tools/hciattach_bcm43xx.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/tools/hciattach_bcm43xx.c ++++ b/tools/hciattach_bcm43xx.c +@@ -366,11 +366,8 @@ int bcm43xx_init(int fd, int def_speed, + return -1; + + if (bcm43xx_locate_patch(FIRMWARE_DIR, chip_name, fw_path)) { +- fprintf(stderr, "Patch not found, continue anyway\n"); ++ fprintf(stderr, "Patch not found for %s, continue anyway\n", chip_name); + } else { +- if (bcm43xx_set_speed(fd, ti, speed)) +- return -1; +- + if (bcm43xx_load_firmware(fd, fw_path)) + return -1; + +@@ -380,6 +377,7 @@ int bcm43xx_init(int fd, int def_speed, + return -1; + } + ++ sleep(1); + if (bcm43xx_reset(fd)) + return -1; + } diff --git a/user/bluez/003-Increase-firmware-load-timeout-to-30s.patch b/user/bluez/003-Increase-firmware-load-timeout-to-30s.patch new file mode 100644 index 000000000..fa0948d92 --- /dev/null +++ b/user/bluez/003-Increase-firmware-load-timeout-to-30s.patch @@ -0,0 +1,20 @@ +From d41dc2046dd08d8c95197f677e224506f5b39bdd Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 20 Jan 2016 16:00:37 +0000 +Subject: [PATCH 3/4] Increase firmware load timeout to 30s + +--- + tools/hciattach.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -1293,7 +1293,7 @@ int main(int argc, char *argv[]) + { + struct uart_t *u = NULL; + int detach, printpid, raw, opt, i, n, ld, err; +- int to = 10; ++ int to = 30; + int init_speed = 0; + int send_break = 0; + pid_t pid; diff --git a/user/bluez/004-Move-the-43xx-firmware-into-lib-firmware.patch b/user/bluez/004-Move-the-43xx-firmware-into-lib-firmware.patch new file mode 100644 index 000000000..80b052d5b --- /dev/null +++ b/user/bluez/004-Move-the-43xx-firmware-into-lib-firmware.patch @@ -0,0 +1,20 @@ +From 76681284b0ea49852041fdb97a35175089a08781 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 23 Feb 2016 17:52:29 +0000 +Subject: [PATCH 4/4] Move the 43xx firmware into /lib/firmware + +--- + tools/hciattach_bcm43xx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/hciattach_bcm43xx.c ++++ b/tools/hciattach_bcm43xx.c +@@ -43,7 +43,7 @@ + #include "hciattach.h" + + #ifndef FIRMWARE_DIR +-#define FIRMWARE_DIR "/etc/firmware" ++#define FIRMWARE_DIR "/lib/firmware/brcm" + #endif + + #define FW_EXT ".hcd" diff --git a/user/bluez/APKBUILD b/user/bluez/APKBUILD new file mode 100644 index 000000000..02cdf5995 --- /dev/null +++ b/user/bluez/APKBUILD @@ -0,0 +1,116 @@ +# Maintainer: A. Wilcox +pkgname=bluez +pkgver=5.50 +pkgrel=0 +pkgdesc="Linux Bluetooth protocol stack" +url="http://www.bluez.org/" +arch="all" +license="GPL-2.0+" +depends="consolekit2 dbus" +makedepends="alsa-lib-dev dbus-dev eudev-dev glib-dev libical-dev + linux-headers" +subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-bccmd + $pkgname-btmon $pkgname-cups $pkgname-deprecated $pkgname-hid2hci + $pkgname-obexd $pkgname-openrc" +source="https://www.kernel.org/pub/linux/bluetooth/bluez-$pkgver.tar.xz + bluetooth.initd + rfcomm.initd + rfcomm.confd + 001-bcm43xx-Add-bcm43xx-3wire-variant.patch + 002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch + 003-Increase-firmware-load-timeout-to-30s.patch + 004-Move-the-43xx-firmware-into-lib-firmware.patch + bluez-5.40-obexd_without_systemd-1.patch + disable-lock-test.patch + fix-endianness.patch + " + +build() { + cd "$builddir" + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --localstatedir=/var \ + --libexecdir=/usr/lib \ + --disable-systemd \ + --disable-client \ + --enable-library \ + --enable-deprecated + make +} + +check() { + cd "$builddir" + make check +} + +package() { + cd "$builddir" + make install DESTDIR="$pkgdir" + install -D -m644 src/main.conf "$pkgdir"/etc/bluetooth/main.conf + + install -Dm755 "$srcdir"/bluetooth.initd "$pkgdir"/etc/init.d/bluetooth + install -Dm755 "$srcdir"/rfcomm.initd "$pkgdir"/etc/init.d/rfcomm + install -Dm644 "$srcdir"/rfcomm.confd "$pkgdir"/etc/conf.d/rfcomm + install -Dm755 test/simple-agent "$pkgdir"/usr/bin/bluez-simple-agent +} + +bccmd() { + pkgdesc="Bluez utility for the CSR BCCMD interface" + mkdir -p "$subpkgdir"/usr/bin + mv "$pkgdir"/usr/bin/bccmd "$subpkgdir"/usr/bin/ +} + +btmon() { + pkgdesc="Bluez bluetooth monitor" + mkdir -p "$subpkgdir"/usr/bin + mv "$pkgdir"/usr/bin/btmon "$subpkgdir"/usr/bin/ +} + +cups() { + pkgdesc="Bluez backend for CUPS" + depends="cups" + mkdir -p "$subpkgdir"/usr/lib/ + mv "$pkgdir"/usr/lib/cups "$subpkgdir"/usr/lib/ +} + +hid2hci() { + pkgdesc="Put HID proxying bluetooth HCI's into HCI mode" + replaces="bluez" + mkdir -p "$subpkgdir" + mv "$pkgdir"/lib "$subpkgdir"/ +} + +deprecated() { + pkgdesc="Deprecated bluetooth tools" + mkdir -p "$subpkgdir"/usr/bin + mv "$pkgdir"/usr/bin/ciptool \ + "$pkgdir"/usr/bin/hciattach \ + "$pkgdir"/usr/bin/hciconfig \ + "$pkgdir"/usr/bin/hcidump \ + "$pkgdir"/usr/bin/hcitool \ + "$pkgdir"/usr/bin/rfcomm \ + "$pkgdir"/usr/bin/sdptool \ + "$subpkgdir"/usr/bin/ +} + +obexd() { + pkgdesc="Bluez OBEX daemon" + mkdir -p "$subpkgdir"/usr/lib/bluetooth + mv "$pkgdir"/usr/lib/bluetooth/obexd "$subpkgdir"/usr/lib/bluetooth +} + +sha512sums="64a680e4b3c270bc2439610c91ad2aef36131d84401e4bbdf6c2b7ec8708a19dfc942b31b9189c38a97ca072c761c669ae1aace5f4ff5d06de3ccbf33184be45 bluez-5.50.tar.xz +fc43c78ed248ea412529eed5ae8bb47bacca9bf5b3b10de121ddd4e792c85893561a88be4aa2c6318106e5d2146a721445152d44fa60ca257ca0b4eb87318c1e bluetooth.initd +8d7b7c8938a2316ce0a855e9bdf1ef8fcdf33d23f4011df828270a088b88b140a19c432e83fef15355d0829e3c86be05b63e7718fef88563254ea239b8dc12ac rfcomm.initd +a70aa0dbbabe7e29ee81540a6f98bf191a850da55a28f678975635caf34b363cf4d461a801b3484120ee28fdd21240bd456a4f5d706262700924bd2e9a0972fb rfcomm.confd +73202915fda01d420b2864da77b1c25af5a55c815e9be6546400a0940bfb6097d83322790bc22a80ec0fcd557144fdd1877e243a79285a7f040ff96ba3600b94 001-bcm43xx-Add-bcm43xx-3wire-variant.patch +d5fd1c962bd846eaa6fff879bab85f753eb367d514f82d133b5d3242e1da989af5eddd942c60a87d5b67783e060f91bfa0f74fb1e8e6699cdee6e5bbe6a431ea 002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch +784e9644c8de4e2693e2eeed988a245608b8cb14e1fc0dff8795c60c527b2e8d0c87862cfbfd6b850b47ae80cdf993a5ed3f477078ea1068fd7374899c7a1a77 003-Increase-firmware-load-timeout-to-30s.patch +42ac04044a8c66e07487598b3a75ef52efc32999ebce4e7c63f6198e2f603f4a1442e74600e43a0938cb4f52d4db0298aa99050b18144b84990cda71748e9de5 004-Move-the-43xx-firmware-into-lib-firmware.patch +41ce7ccf78cca97563f0ef31e01dac6eb4484c24fe57be360b5e8de8c5bff5845e9d395766f891bd3f123788344456c88c9fc00cd1bb7c6a1dca89d09f19172b bluez-5.40-obexd_without_systemd-1.patch +04c4889372c8e790bb338dde7ffa76dc32fcf7370025c71b9184fcf17fd01ade4a6613d84d648303af3bbc54043ad489f29fc0cd4679ec8c9029dcb846d7e026 disable-lock-test.patch +118d55183860f395fc4bdc93efffb13902ebf7388cad722b9061cd2860d404333e500af521741c3d92c0f8a161f6810348fbeb6682e49c372383f417aed8c76a fix-endianness.patch" diff --git a/user/bluez/bluetooth.initd b/user/bluez/bluetooth.initd new file mode 100644 index 000000000..ee40153ec --- /dev/null +++ b/user/bluez/bluetooth.initd @@ -0,0 +1,13 @@ +#!/sbin/openrc-run + +name="Bluetooth" +command="/usr/lib/bluetooth/bluetoothd" +pidfile="/var/run/bluetoothd.pid" +start_stop_daemon_args="--background --make-pidfile" + + +depend() { + after coldplug + need dbus localmount hostname +} + diff --git a/user/bluez/bluez-5.40-obexd_without_systemd-1.patch b/user/bluez/bluez-5.40-obexd_without_systemd-1.patch new file mode 100644 index 000000000..749787c5b --- /dev/null +++ b/user/bluez/bluez-5.40-obexd_without_systemd-1.patch @@ -0,0 +1,61 @@ +Submitted By: Armin K. +Date: 2013-04-29 +Initial Package Version: 5.17 +Upstream Status: unknown +Origin: Arch Linux (Giovanni Campagna) +Description: 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. +--- + 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 3760867..142e7c3 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 a538088..0000000 +--- 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 0000000..9c815f2 +--- /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 +-- +1.8.3.1 + + diff --git a/user/bluez/disable-lock-test.patch b/user/bluez/disable-lock-test.patch new file mode 100644 index 000000000..3d849a83e --- /dev/null +++ b/user/bluez/disable-lock-test.patch @@ -0,0 +1,18 @@ +This test locks up. + +--- bluez-5.47/unit/test-gatt.c.old 2017-07-14 04:12:22.000000000 -0500 ++++ bluez-5.47/unit/test-gatt.c 2017-09-28 03:03:00.678738581 -0500 +@@ -4459,11 +4459,11 @@ + raw_pdu(0x18, 0x01), + raw_pdu(0x01, 0x18, 0x25, 0x00, 0x06)); + +- define_test_server("/robustness/unkown-request", ++ /*define_test_server("/robustness/unkown-request", + test_server, service_db_1, NULL, + raw_pdu(0x03, 0x00, 0x02), + raw_pdu(0xbf, 0x00), +- raw_pdu(0x01, 0xbf, 0x00, 0x00, 0x06)); ++ raw_pdu(0x01, 0xbf, 0x00, 0x00, 0x06));*/ + + define_test_server("/robustness/unkown-command", + test_server, service_db_1, NULL, diff --git a/user/bluez/fix-endianness.patch b/user/bluez/fix-endianness.patch new file mode 100644 index 000000000..ee0e0d1e3 --- /dev/null +++ b/user/bluez/fix-endianness.patch @@ -0,0 +1,10 @@ +--- bluez-5.47/src/shared/util.h.old 2016-09-26 07:29:00.000000000 -0500 ++++ bluez-5.47/src/shared/util.h 2017-12-27 22:49:50.538716424 -0600 +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + #if __BYTE_ORDER == __LITTLE_ENDIAN + #define le16_to_cpu(val) (val) diff --git a/user/bluez/rfcomm.confd b/user/bluez/rfcomm.confd new file mode 100644 index 000000000..d87acdb28 --- /dev/null +++ b/user/bluez/rfcomm.confd @@ -0,0 +1,5 @@ +# Bind rfcomm devices (allowed values are "true" and "false") +RFCOMM_ENABLE=true + +# Config file for rfcomm +RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf" diff --git a/user/bluez/rfcomm.initd b/user/bluez/rfcomm.initd new file mode 100644 index 000000000..26c2d6d9d --- /dev/null +++ b/user/bluez/rfcomm.initd @@ -0,0 +1,27 @@ +#!/sbin/openrc-run +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/files/rfcomm-init.d,v 1.1 2011/12/31 21:09:18 pacho Exp $ + +depend() { + after coldplug + need dbus localmount hostname +} + +start() { + if [ "${RFCOMM_ENABLE}" = "true" -a -x /usr/bin/rfcomm ]; then + if [ -f "${RFCOMM_CONFIG}" ]; then + ebegin "Starting rfcomm" + /usr/bin/rfcomm -f "${RFCOMM_CONFIG}" bind all + eend $? + else + ewarn "Not enabling rfcomm because RFCOMM_CONFIG does not exists" + fi + fi +} + +stop() { + ebegin "Shutting down rfcomm" + /usr/bin/rfcomm release all + eend $? +} -- cgit v1.2.3-70-g09d2