summaryrefslogtreecommitdiff
path: root/repo/bluez
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-06-04 15:08:04 +0100
committerdavidovski <david@davidovski.xyz>2022-06-04 15:08:04 +0100
commit873665024ebfaa761ee49b508a79db7178aeb778 (patch)
tree6cd3b4ce3a9f4b0586ffa48e73a6ba4c8da2db43 /repo/bluez
parent4445f6e15185f58dc599390ab74df3ca19b437b7 (diff)
added gnupg
Diffstat (limited to 'repo/bluez')
-rw-r--r--repo/bluez/001-bcm43xx-Add-bcm43xx-3wire-variant.patch21
-rw-r--r--repo/bluez/002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch33
-rw-r--r--repo/bluez/003-Increase-firmware-load-timeout-to-30s.patch20
-rw-r--r--repo/bluez/004-Move-the-43xx-firmware-into-lib-firmware.patch20
-rw-r--r--repo/bluez/005-hostname-Use-phone-class-for-handhelds.patch51
-rw-r--r--repo/bluez/bluetooth.initd13
-rw-r--r--repo/bluez/bluez.xibuild72
-rw-r--r--repo/bluez/disable-lock-test.patch18
-rw-r--r--repo/bluez/fix-endianness.patch13
-rw-r--r--repo/bluez/fix-musl.patch12
-rw-r--r--repo/bluez/mpris-proxy.desktop8
-rw-r--r--repo/bluez/musl.patch13
-rw-r--r--repo/bluez/org.bluez.obex.service3
-rw-r--r--repo/bluez/rfcomm.confd5
-rw-r--r--repo/bluez/rfcomm.initd27
-rw-r--r--repo/bluez/test-mesh-crypto.patch14
16 files changed, 343 insertions, 0 deletions
diff --git a/repo/bluez/001-bcm43xx-Add-bcm43xx-3wire-variant.patch b/repo/bluez/001-bcm43xx-Add-bcm43xx-3wire-variant.patch
new file mode 100644
index 0000000..96e8a26
--- /dev/null
+++ b/repo/bluez/001-bcm43xx-Add-bcm43xx-3wire-variant.patch
@@ -0,0 +1,21 @@
+From b4f2b77472aeb967d3a7595e8a965785c7a37c87 Mon Sep 17 00:00:00 2001
+From: Phil Elwell <phil@raspberrypi.org>
+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/repo/bluez/002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch b/repo/bluez/002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch
new file mode 100644
index 0000000..a221861
--- /dev/null
+++ b/repo/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 <phil@raspberrypi.org>
+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/repo/bluez/003-Increase-firmware-load-timeout-to-30s.patch b/repo/bluez/003-Increase-firmware-load-timeout-to-30s.patch
new file mode 100644
index 0000000..fa0948d
--- /dev/null
+++ b/repo/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 <phil@raspberrypi.org>
+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/repo/bluez/004-Move-the-43xx-firmware-into-lib-firmware.patch b/repo/bluez/004-Move-the-43xx-firmware-into-lib-firmware.patch
new file mode 100644
index 0000000..80b052d
--- /dev/null
+++ b/repo/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 <phil@raspberrypi.org>
+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/repo/bluez/005-hostname-Use-phone-class-for-handhelds.patch b/repo/bluez/005-hostname-Use-phone-class-for-handhelds.patch
new file mode 100644
index 0000000..c5ad4bf
--- /dev/null
+++ b/repo/bluez/005-hostname-Use-phone-class-for-handhelds.patch
@@ -0,0 +1,51 @@
+From 7960816020bbd94b1c2f0ff75f73b25927717875 Mon Sep 17 00:00:00 2001
+From: Dylan Van Assche <me@dylanvanassche.be>
+Date: Fri, 11 Jun 2021 20:18:44 +0200
+Subject: [PATCH] hostname: Use phone class for handhelds
+
+Advertise devices with chassis type 'handheld'
+as phone instead of computer.
+---
+ plugins/hostname.c | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/plugins/hostname.c b/plugins/hostname.c
+index 1a9513adb..85c342d36 100644
+--- a/plugins/hostname.c
++++ b/plugins/hostname.c
+@@ -31,6 +31,7 @@
+
+ #define MAJOR_CLASS_MISCELLANEOUS 0x00
+ #define MAJOR_CLASS_COMPUTER 0x01
++#define MAJOR_CLASS_PHONE 0x02
+
+ #define MINOR_CLASS_UNCATEGORIZED 0x00
+ #define MINOR_CLASS_DESKTOP 0x01
+@@ -40,6 +41,7 @@
+ #define MINOR_CLASS_PALM_SIZED 0x05
+ #define MINOR_CLASS_WEARABLE 0x06
+ #define MINOR_CLASS_TABLET 0x07
++#define MINOR_CLASS_SMARTPHONE 0x03
+
+ static uint8_t major_class = MAJOR_CLASS_MISCELLANEOUS;
+ static uint8_t minor_class = MINOR_CLASS_UNCATEGORIZED;
+@@ -106,11 +108,11 @@ static const struct {
+ uint8_t major_class;
+ uint8_t minor_class;
+ } chassis_table[] = {
+- { "desktop", MAJOR_CLASS_COMPUTER, MINOR_CLASS_DESKTOP },
+- { "server", MAJOR_CLASS_COMPUTER, MINOR_CLASS_SERVER },
+- { "laptop", MAJOR_CLASS_COMPUTER, MINOR_CLASS_LAPTOP },
+- { "handset", MAJOR_CLASS_COMPUTER, MINOR_CLASS_HANDHELD },
+- { "tablet", MAJOR_CLASS_COMPUTER, MINOR_CLASS_TABLET },
++ { "desktop", MAJOR_CLASS_COMPUTER, MINOR_CLASS_DESKTOP },
++ { "server", MAJOR_CLASS_COMPUTER, MINOR_CLASS_SERVER },
++ { "laptop", MAJOR_CLASS_COMPUTER, MINOR_CLASS_LAPTOP },
++ { "handset", MAJOR_CLASS_PHONE, MINOR_CLASS_SMARTPHONE },
++ { "tablet", MAJOR_CLASS_COMPUTER, MINOR_CLASS_TABLET },
+ { }
+ };
+
+--
+2.31.1
+
diff --git a/repo/bluez/bluetooth.initd b/repo/bluez/bluetooth.initd
new file mode 100644
index 0000000..3e5ec98
--- /dev/null
+++ b/repo/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 udev-postmount
+ need dbus localmount hostname
+}
+
diff --git a/repo/bluez/bluez.xibuild b/repo/bluez/bluez.xibuild
new file mode 100644
index 0000000..bf7dce9
--- /dev/null
+++ b/repo/bluez/bluez.xibuild
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+NAME="bluez"
+DESC="Tools for the Bluetooth protocol stack"
+
+MAKEDEPS="dbus libusb eudev json-c libical readline glib linux-headers autoconf automake libtool python-docutils"
+
+PKG_VER=5.64
+SOURCE="https://www.kernel.org/pub/linux/bluetooth/bluez-$PKG_VER.tar.xz"
+
+ADDITIONAL="
+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
+005-hostname-Use-phone-class-for-handhelds.patch
+bluetooth.initd
+disable-lock-test.patch
+fix-endianness.patch
+fix-musl.patch
+mpris-proxy.desktop
+musl.patch
+org.bluez.obex.service
+rfcomm.confd
+rfcomm.initd
+test-mesh-crypto.patch
+"
+
+prepare() {
+ apply_patches
+ autoreconf -vif
+}
+
+build() {
+ ./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var \
+ --libexecdir=/usr/lib \
+ --disable-systemd \
+ --enable-library \
+ --enable-deprecated \
+ --enable-hid2hci \
+ --enable-mesh \
+ --enable-sixaxis \
+ --with-dbusconfdir=/usr/share
+ make
+}
+
+check() {
+ make check
+}
+
+package() {
+ make install DESTDIR="$PKG_DEST"
+ install -D -m644 src/main.conf "$PKG_DEST"/etc/bluetooth/main.conf
+
+ install -Dm755 "$BUILD_ROOT"/bluetooth.initd "$PKG_DEST"/etc/init.d/bluetooth
+ install -Dm755 "$BUILD_ROOT"/rfcomm.initd "$PKG_DEST"/etc/init.d/rfcomm
+ install -Dm644 "$BUILD_ROOT"/rfcomm.confd "$PKG_DEST"/etc/conf.d/rfcomm
+
+ # Fix shebang for the installed binary
+ sed 's|^#!/usr/bin/python$|#!/usr/bin/env python3|g' -i test/simple-agent
+ install -Dm755 test/simple-agent "$PKG_DEST"/usr/bin/bluez-simple-agent
+
+ # Autostart mpris-proxy to pass through MPRIS control over BlueZ
+ install -Dm644 "$BUILD_ROOT"/mpris-proxy.desktop -t "$PKG_DEST"/etc/xdg/autostart/
+
+ # Bluez tool for the Bluetooth Management API
+ install -Dm755 "$BUILD_ROOT"/tools/btmgmt "$PKG_DEST"/usr/bin/btmgmt
+}
diff --git a/repo/bluez/disable-lock-test.patch b/repo/bluez/disable-lock-test.patch
new file mode 100644
index 0000000..3d849a8
--- /dev/null
+++ b/repo/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/repo/bluez/fix-endianness.patch b/repo/bluez/fix-endianness.patch
new file mode 100644
index 0000000..c60e229
--- /dev/null
+++ b/repo/bluez/fix-endianness.patch
@@ -0,0 +1,13 @@
+--- a/src/shared/util.h
++++ b/src/shared/util.h
+@@ -15,6 +15,7 @@
+ #include <byteswap.h>
+ #include <string.h>
+ #include <sys/types.h>
++#include <endian.h>
+
+ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+ #define BIT(n) (1 << (n))
+--
+2.30.2
+
diff --git a/repo/bluez/fix-musl.patch b/repo/bluez/fix-musl.patch
new file mode 100644
index 0000000..436fc5d
--- /dev/null
+++ b/repo/bluez/fix-musl.patch
@@ -0,0 +1,12 @@
+diff --git a/tools/mesh-cfgtest.c b/tools/mesh-cfgtest.c
+index fa0474f..9b68314 100644
+--- a/tools/mesh-cfgtest.c
++++ b/tools/mesh-cfgtest.c
+@@ -26,6 +26,7 @@
+ #include <time.h>
+ #include <unistd.h>
+ #include <sys/stat.h>
++#include <limits.h> /* PATH_MAX */
+
+ #include <ell/ell.h>
+
diff --git a/repo/bluez/mpris-proxy.desktop b/repo/bluez/mpris-proxy.desktop
new file mode 100644
index 0000000..4995eaa
--- /dev/null
+++ b/repo/bluez/mpris-proxy.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Application
+Name=mpris-proxy
+Comment=Start mpris-proxy in daemon mode
+Exec=/usr/bin/mpris-proxy
+TryExec=/usr/bin/mpris-proxy
+Terminal=false
+X-KDE-autostart-phase=2
diff --git a/repo/bluez/musl.patch b/repo/bluez/musl.patch
new file mode 100644
index 0000000..cd8f085
--- /dev/null
+++ b/repo/bluez/musl.patch
@@ -0,0 +1,13 @@
+diff --git a/mesh/net.h b/mesh/net.h
+index 150240f..a3dec2b 100644
+--- a/mesh/net.h
++++ b/mesh/net.h
+@@ -21,6 +21,8 @@
+ #define __packed __attribute__((packed))
+ #endif
+
++#include <sys/time.h> /* for timeval */
++
+ struct mesh_io;
+ struct mesh_node;
+
diff --git a/repo/bluez/org.bluez.obex.service b/repo/bluez/org.bluez.obex.service
new file mode 100644
index 0000000..d1afc39
--- /dev/null
+++ b/repo/bluez/org.bluez.obex.service
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.bluez.obex
+Exec=/usr/lib/bluetooth/obexd -n
diff --git a/repo/bluez/rfcomm.confd b/repo/bluez/rfcomm.confd
new file mode 100644
index 0000000..d87acdb
--- /dev/null
+++ b/repo/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/repo/bluez/rfcomm.initd b/repo/bluez/rfcomm.initd
new file mode 100644
index 0000000..26c2d6d
--- /dev/null
+++ b/repo/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 $?
+}
diff --git a/repo/bluez/test-mesh-crypto.patch b/repo/bluez/test-mesh-crypto.patch
new file mode 100644
index 0000000..90fc293
--- /dev/null
+++ b/repo/bluez/test-mesh-crypto.patch
@@ -0,0 +1,14 @@
+Requires kernel option that might not be enabled on the builder
+https://bugzilla.kernel.org/show_bug.cgi?id=206815
+diff --git a/Makefile.am b/Makefile.am
+index ff0df21..a384c31 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -539,7 +539,6 @@ unit_test_midi_LDADD = src/libshared-glib.la \
+ endif
+
+ if MESH
+-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