diff --git a/utils/bluez/Makefile b/utils/bluez/Makefile index 4865698f2a..1bff16ca1b 100644 --- a/utils/bluez/Makefile +++ b/utils/bluez/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006-2015 OpenWrt.org +# Copyright (C) 2006-2016 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bluez -PKG_VERSION:=5.30 +PKG_VERSION:=5.47 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=http://www.kernel.org/pub/linux/bluetooth/ -PKG_MD5SUM:=24ba1d1e8e7ef5b8f4033a3059d7600e +PKG_SOURCE_URL:=@KERNEL/linux/bluetooth/ +PKG_MD5SUM:=783e15f65e70cdb8f721c659e140dd56 PKG_LICENSE:=GPL-2.0+ PKG_LICENSE_FILES:=COPYING @@ -47,7 +47,7 @@ $(call Package/bluez/Default) SECTION:=libs CATEGORY:=Libraries TITLE+= library - DEPENDS:=+libpthread + DEPENDS:=+libpthread +kmod-bluetooth endef define Package/bluez-utils @@ -55,14 +55,22 @@ $(call Package/bluez/Default) SECTION:=utils CATEGORY:=Utilities TITLE+= utilities - DEPENDS:=+bluez-libs +libpthread +librt +dbus +glib2 +libical +libncurses +libreadline $(INTL_DEPENDS) $(ICONV_DEPENDS) + DEPENDS:=+bluez-libs +libpthread +librt +glib2 +libncurses +libreadline $(INTL_DEPENDS) $(ICONV_DEPENDS) endef -define Package/bluez-utils/conffiles +define Package/bluez-daemon +$(call Package/bluez/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE+= daemon + DEPENDS:=+bluez-libs +bluez-utils +dbus +libical $(INTL_DEPENDS) $(ICONV_DEPENDS) +endef + +define Package/bluez-daemon/conffiles /etc/bluetooth/main.conf /etc/bluetooth/network.conf /etc/bluetooth/input.conf -/etc/bluetooth/proximity.conf +/etc/bluetooth/audio.conf /etc/config/bluetooth endef @@ -84,6 +92,7 @@ CONFIGURE_ARGS += \ --disable-systemd \ --disable-test \ --disable-udev \ + --enable-deprecated TARGET_CPPFLAGS += \ -D_GNU_SOURCE @@ -109,10 +118,29 @@ endef define Package/bluez-utils/install $(INSTALL_DIR) $(1)/usr/bin - $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/bluetooth/bluetoothd $(1)/usr/bin/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/bluetooth/obexd $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/bccmd $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/bluemoon $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/btmon $(1)/usr/bin/ + $(CP) $(PKG_BUILD_DIR)/tools/btmgmt $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ciptool $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/hciattach $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/hciconfig $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/hcidump $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/hcitool $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/hex2hcd $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/l2ping $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/l2test $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/rctest $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/rfcomm $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/sdptool $(1)/usr/bin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/attrib/gatttool $(1)/usr/bin/ +endef + +define Package/bluez-daemon/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/lib/bluetooth/bluetoothd $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/bluetoothctl $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/bluetooth/obexd $(1)/usr/bin/ $(INSTALL_DIR) $(1)/etc/config $(INSTALL_DATA) ./files/bluetooth.config $(1)/etc/config/bluetooth $(INSTALL_DIR) $(1)/etc/dbus-1/system.d/ @@ -121,7 +149,7 @@ define Package/bluez-utils/install $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/main.conf $(1)/etc/bluetooth/main.conf $(INSTALL_DATA) $(PKG_BUILD_DIR)/profiles/network/network.conf $(1)/etc/bluetooth/network.conf $(INSTALL_DATA) $(PKG_BUILD_DIR)/profiles/input/input.conf $(1)/etc/bluetooth/input.conf - $(INSTALL_DATA) $(PKG_BUILD_DIR)/profiles/proximity/proximity.conf $(1)/etc/bluetooth/proximity.conf + $(INSTALL_DATA) ./files/audio.conf $(1)/etc/bluetooth/audio.conf $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/bluetoothd.init $(1)/etc/init.d/bluetoothd endef @@ -129,3 +157,4 @@ endef $(eval $(call BuildPackage,bluez-examples)) $(eval $(call BuildPackage,bluez-libs)) $(eval $(call BuildPackage,bluez-utils)) +$(eval $(call BuildPackage,bluez-daemon)) diff --git a/utils/bluez/files/audio.conf b/utils/bluez/files/audio.conf new file mode 100644 index 0000000000..0455c6c01b --- /dev/null +++ b/utils/bluez/files/audio.conf @@ -0,0 +1 @@ +Enable=Source,Sink,Media,Socket diff --git a/utils/bluez/patches/001-bcm43xx-Add-bcm43xx-3wire-variant.patch b/utils/bluez/patches/001-bcm43xx-Add-bcm43xx-3wire-variant.patch new file mode 100644 index 0000000000..15eb6e1da8 --- /dev/null +++ b/utils/bluez/patches/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 +@@ -1090,6 +1090,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/utils/bluez/patches/002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch b/utils/bluez/patches/002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch new file mode 100644 index 0000000000..a221861d2c --- /dev/null +++ b/utils/bluez/patches/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/utils/bluez/patches/003-Increase-firmware-load-timeout-to-30s.patch b/utils/bluez/patches/003-Increase-firmware-load-timeout-to-30s.patch new file mode 100644 index 0000000000..74911d3cab --- /dev/null +++ b/utils/bluez/patches/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 +@@ -1239,7 +1239,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/utils/bluez/patches/004-Move-the-43xx-firmware-into-lib-firmware.patch b/utils/bluez/patches/004-Move-the-43xx-firmware-into-lib-firmware.patch new file mode 100644 index 0000000000..80b052d5b7 --- /dev/null +++ b/utils/bluez/patches/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/utils/bluez/patches/200-uart-speed.patch b/utils/bluez/patches/200-uart-speed.patch deleted file mode 100644 index ebe0153e25..0000000000 --- a/utils/bluez/patches/200-uart-speed.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/tools/hciattach.c -+++ b/tools/hciattach.c -@@ -101,20 +101,37 @@ int uart_speed(int s) - return B230400; - case 460800: - return B460800; -+/* FIX: Not all platform support this high serial speed -+ claudyus84 @gamil.com -+*/ -+#ifdef B500000 - case 500000: - return B500000; -+#endif -+#ifdef B576000 - case 576000: - return B576000; -+#endif -+#ifdef B921600 - case 921600: - return B921600; -+#endif -+#ifdef B1000000 - case 1000000: - return B1000000; -+#endif -+#ifdef B1152000 - case 1152000: - return B1152000; -+#endif -+#ifdef B1500000 - case 1500000: - return B1500000; -+#endif -+#ifdef B2000000 - case 2000000: - return B2000000; -+#endif - #ifdef B2500000 - case 2500000: - return B2500000; diff --git a/utils/bluez/patches/201-readline.patch b/utils/bluez/patches/201-readline.patch index 58396dcb01..5794371620 100644 --- a/utils/bluez/patches/201-readline.patch +++ b/utils/bluez/patches/201-readline.patch @@ -1,31 +1,24 @@ ---- a/Makefile.in -+++ b/Makefile.in -@@ -2055,7 +2055,7 @@ unit_tests = $(am__append_32) unit/test- +--- a/Makefile.in 2017-09-14 11:47:06.000000000 +0200 ++++ b/Makefile.in 2017-09-15 02:52:39.315926972 +0200 +@@ -2447,7 +2447,7 @@ @CLIENT_TRUE@ monitor/uuid.h monitor/uuid.c - @CLIENT_TRUE@client_bluetoothctl_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@ \ --@CLIENT_TRUE@ -lreadline -+@CLIENT_TRUE@ -lreadline -lncurses + @CLIENT_TRUE@client_bluetoothctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \ +-@CLIENT_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline ++@CLIENT_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline -lncurses + + @MESH_TRUE@mesh_meshctl_SOURCES = mesh/main.c \ + @MESH_TRUE@ mesh/mesh-net.h \ +@@ -2468,7 +2468,7 @@ + + @MESH_TRUE@mesh_meshctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \ + @MESH_TRUE@ lib/libbluetooth-internal.la \ +-@MESH_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -ljson-c -lreadline ++@MESH_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -ljson-c -lreadline -lncurses @MONITOR_TRUE@monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \ @MONITOR_TRUE@ monitor/display.h monitor/display.c \ -@@ -2226,7 +2226,7 @@ unit_tests = $(am__append_32) unit/test- - @EXPERIMENTAL_TRUE@tools_hcieventmask_LDADD = lib/libbluetooth-internal.la - @EXPERIMENTAL_TRUE@tools_btmgmt_SOURCES = tools/btmgmt.c src/uuid-helper.c client/display.c - @EXPERIMENTAL_TRUE@tools_btmgmt_LDADD = lib/libbluetooth-internal.la src/libshared-mainloop.la \ --@EXPERIMENTAL_TRUE@ -lreadline -+@EXPERIMENTAL_TRUE@ -lreadline -lncurses - - @EXPERIMENTAL_TRUE@tools_btinfo_SOURCES = tools/btinfo.c monitor/bt.h - @EXPERIMENTAL_TRUE@tools_btinfo_LDADD = src/libshared-mainloop.la -@@ -2266,13 +2266,13 @@ unit_tests = $(am__append_32) unit/test- - @READLINE_TRUE@ client/display.h - - @READLINE_TRUE@attrib_gatttool_LDADD = lib/libbluetooth-internal.la \ --@READLINE_TRUE@ src/libshared-glib.la @GLIB_LIBS@ -lreadline -+@READLINE_TRUE@ src/libshared-glib.la @GLIB_LIBS@ -lreadline -lncurses - - @READLINE_TRUE@tools_obex_client_tool_SOURCES = $(gobex_sources) $(btio_sources) \ +@@ -2724,7 +2724,7 @@ @READLINE_TRUE@ tools/obex-client-tool.c @READLINE_TRUE@tools_obex_client_tool_LDADD = lib/libbluetooth-internal.la \ @@ -34,7 +27,7 @@ @READLINE_TRUE@tools_obex_server_tool_SOURCES = $(gobex_sources) $(btio_sources) \ @READLINE_TRUE@ tools/obex-server-tool.c -@@ -2282,13 +2282,13 @@ unit_tests = $(am__append_32) unit/test- +@@ -2734,17 +2734,17 @@ @READLINE_TRUE@ client/display.h client/display.c @READLINE_TRUE@tools_bluetooth_player_LDADD = gdbus/libgdbus-internal.la \ @@ -48,5 +41,19 @@ -@READLINE_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline +@READLINE_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline -lncurses - @EXPERIMENTAL_TRUE@tools_gatt_service_SOURCES = tools/gatt-service.c - @EXPERIMENTAL_TRUE@tools_gatt_service_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ gdbus/libgdbus-internal.la + @READLINE_TRUE@tools_btmgmt_SOURCES = tools/btmgmt.c src/uuid-helper.c client/display.c + @READLINE_TRUE@tools_btmgmt_LDADD = lib/libbluetooth-internal.la src/libshared-mainloop.la \ +-@READLINE_TRUE@ -lreadline ++@READLINE_TRUE@ -lreadline -lncurses + + @DEPRECATED_TRUE@@READLINE_TRUE@attrib_gatttool_SOURCES = attrib/gatttool.c attrib/att.c attrib/gatt.c \ + @DEPRECATED_TRUE@@READLINE_TRUE@ attrib/gattrib.c btio/btio.c \ +@@ -2753,7 +2753,7 @@ + @DEPRECATED_TRUE@@READLINE_TRUE@ client/display.h + + @DEPRECATED_TRUE@@READLINE_TRUE@attrib_gatttool_LDADD = lib/libbluetooth-internal.la \ +-@DEPRECATED_TRUE@@READLINE_TRUE@ src/libshared-glib.la @GLIB_LIBS@ -lreadline ++@DEPRECATED_TRUE@@READLINE_TRUE@ src/libshared-glib.la @GLIB_LIBS@ -lreadline -lncurses + + @CUPS_TRUE@cupsdir = $(libdir)/cups/backend + @CUPS_TRUE@profiles_cups_bluetooth_SOURCES = profiles/cups/main.c \