From 334b4410113eda461113cc51cae3d200b6439d47 Mon Sep 17 00:00:00 2001 From: Dirk Neukirchen Date: Thu, 2 Apr 2015 01:30:45 +0200 Subject: [PATCH 1/3] bluez: fix bluez5 init with procd - remove deprecated daemons - bluetoothd is managed via /etc/bluetooth/*.conf files and dbus Signed-off-by: Dirk Neukirchen --- utils/bluez/files/bluetoothd.init | 13 +++ utils/bluez/files/bluez-utils.init | 131 ----------------------------- 2 files changed, 13 insertions(+), 131 deletions(-) create mode 100644 utils/bluez/files/bluetoothd.init delete mode 100644 utils/bluez/files/bluez-utils.init diff --git a/utils/bluez/files/bluetoothd.init b/utils/bluez/files/bluetoothd.init new file mode 100644 index 000000000..75f4d9664 --- /dev/null +++ b/utils/bluez/files/bluetoothd.init @@ -0,0 +1,13 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2007 OpenWrt.org + +#start after dbus (60) +START=62 +USE_PROCD=1 +PROG=/usr/bin/bluetoothd + +start_service() { + procd_open_instance + procd_set_param command "$PROG" -n + procd_close_instance +} diff --git a/utils/bluez/files/bluez-utils.init b/utils/bluez/files/bluez-utils.init deleted file mode 100644 index e9320aed2..000000000 --- a/utils/bluez/files/bluez-utils.init +++ /dev/null @@ -1,131 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2007 OpenWrt.org - -#start after dbus (60) -START=62 - -append_bool() { - local section="$1" - local option="$2" - local value="$3" - local _val - config_get_bool _val "$section" "$option" '0' - [ $_val -gt 0 ] && append args "$3" -} - -append_string() { - local section="$1" - local option="$2" - local value="$3" - local default="$4" - local _val - config_get _val "$section" "$option" "$default" - [ -n "$_val" ] && append args "$3 $_val" -} - -hcid_config() { - local cfg="$1" - config_get_bool enabled "$cfg" "enabled" '1' - [ $enabled -gt 0 ] || return 1 - args="" - append_bool "$cfg" nodaemon "-n" - append_string "$cfg" config "-f" - service_start /usr/sbin/hcid $args -} - -hciattach_config() { - local cfg="$1" - config_get_bool enabled "$cfg" "enabled" '1' - [ $enabled -gt 0 ] || return 1 - args="" - append_string "$cfg" initspeed "-s" "115200" - append_string "$cfg" tty " " "ttyS1" - append_string "$cfg" type " " "csr" - append_string "$cfg" speed " " "115200" - append_string "$cfg" flow " " "noflow" - service_start /usr/sbin/hciattach $args -} - -rfcomm_config() { - local cfg="$1" - config_get_bool enabled "$cfg" "enabled" '1' - [ $enabled -gt 0 ] || return 1 - args="" - append_string "$cfg" config "-f" - /usr/bin/rfcomm $args bind all -} - -dund_config() { - local cfg="$1" - config_get_bool enabled "$cfg" "enabled" '1' - [ $enabled -gt 0 ] || return 1 - args="" - append_bool "$cfg" listen "--listen" - append_string "$cfg" connect "--connect" - append_string "$cfg" mrouter "--mrouter" - append_bool "$cfg" search "--search" - append_string "$cfg" channel "--channel" - append_string "$cfg" device "--device" - append_bool "$cfg" nosdp "--nosdp" - append_bool "$cfg" auth "--auth" - append_bool "$cfg" encrypt "--encrypt" - append_bool "$cfg" secure "--secure" - append_bool "$cfg" master "--master" - append_bool "$cfg" nodetach "--nodetach" - append_bool "$cfg" persist "--persist" - append_string "$cfg" pppd "--pppd" - append_bool "$cfg" msdun "--msdun" - append_bool "$cfg" activesync "--activesync" - append_bool "$cfg" cache "--cache" - - append_string "$cfg" pppdopts "" - config_get ifn "$cfg" interface - if [ -n "$ifn" ]; then - config_get unit "$cfg" unit - [ -z "$unit" ] || append args "unit $unit ipparam $ifn linkname $ifn" - fi - - service_start /usr/bin/dund $args -} - -pand_config() { - local cfg="$1" - config_get_bool enabled "$cfg" "enabled" '1' - [ $enabled -gt 0 ] || return 1 - args="" - append_bool "$cfg" listen "--listen" - append_string "$cfg" connect "--connect" - append_bool "$cfg" autozap "--autozap" - append_bool "$cfg" search "--search" - append_string "$cfg" role "--role" - append_string "$cfg" service "--service" - append_string "$cfg" ethernet "--ethernet" - append_string "$cfg" device "--device" - append_bool "$cfg" nosdp "-D" - append_bool "$cfg" auth "-A" - append_bool "$cfg" encrypt "-E" - append_bool "$cfg" secure "-S" - append_bool "$cfg" master "-M" - append_bool "$cfg" nodetach "-n" - append_bool "$cfg" persist "--persist" - append_bool "$cfg" cache "--cache" - append_string "$cfg" pidfile "--pidfile" - service_start /usr/bin/pand $args -} - -start() { - config_load bluetooth - config_foreach hcid_config hcid - config_foreach hciattach_config hciattach - config_foreach rfcomm_config rfcomm - config_foreach dund_config dund - config_foreach pand_config pand -} - -stop() { - service_stop /usr/bin/dund - service_stop /usr/bin/pand - /usr/bin/rfcomm release all - service_stop /usr/sbin/hciattach - service_stop /usr/sbin/hcid -} From 734a8518760044b1fef60a718c60d2a56d7fdf0d Mon Sep 17 00:00:00 2001 From: Dirk Neukirchen Date: Thu, 2 Apr 2015 01:32:49 +0200 Subject: [PATCH 2/3] bluez: remove legacy stuff from /etc/config/bluetooth pand/dund removed upstream: commit: Move hidd pand and dund into compat directory commit: (2012-07-04) remove compat daemons Signed-off-by: Dirk Neukirchen --- utils/bluez/files/bluetooth.config | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/utils/bluez/files/bluetooth.config b/utils/bluez/files/bluetooth.config index 42f390c67..6f23617a4 100644 --- a/utils/bluez/files/bluetooth.config +++ b/utils/bluez/files/bluetooth.config @@ -1,5 +1,5 @@ -config hcid -# option config /etc/bluetooth/hcid.conf +config bluetoothd +# option config /etc/bluetooth/main.conf option enabled 1 config hciattach @@ -13,20 +13,3 @@ config hciattach config rfcomm # option config /etc/bluetooth/rfcomm.conf option enabled 0 - -config dund - option listen true - option persist true - option msdun true - option interface dund - option unit 1 - option pppdopts "ktune proxyarp 192.168.1.1:192.168.1.2 ms-dns 192.168.1.1" - option enabled 0 - -config pand - option listen true - option autozap true - option role "NAP" - option master true - option persist true - option enabled 0 From bcc6516a9b7c8bce6b7c25a8473028f295c2d1fc Mon Sep 17 00:00:00 2001 From: Dirk Neukirchen Date: Thu, 2 Apr 2015 09:58:22 +0200 Subject: [PATCH 3/3] bluez: refresh for bluez5 bluez is craply documented contains changes needed for bluetooth audio playback bluetooth playback tested successfully with android mobile (source) to TI omap BeagleBoard (A2DP sink) - install .conf files according to source code - package bluetoothd - new package examples for python commandline tools that might provide functionality without dbus - other changes are needed (pulseaudio,sbc,uinput) Signed-off-by: Dirk Neukirchen --- utils/bluez/Makefile | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/utils/bluez/Makefile b/utils/bluez/Makefile index 8e394e351..e3c0924c5 100644 --- a/utils/bluez/Makefile +++ b/utils/bluez/Makefile @@ -29,6 +29,18 @@ define Package/bluez/Default URL:=http://www.bluez.org/ endef +define Package/bluez-examples +$(call Package/bluez/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE+= python example apps + DEPENDS:=+python +endef + +define Package/bluez-examples/description + contains many examples apps for bluetooth, requiring python +endef + define Package/bluez-libs $(call Package/bluez/Default) SECTION:=libs @@ -42,10 +54,14 @@ $(call Package/bluez/Default) SECTION:=utils CATEGORY:=Utilities TITLE+= utilities - DEPENDS:=+bluez-libs +libpthread +dbus +glib2 +libical +libncurses +libreadline $(INTL_DEPENDS) $(ICONV_DEPENDS) + DEPENDS:=+bluez-libs +libpthread +librt +dbus +glib2 +libical +libncurses +libreadline $(INTL_DEPENDS) $(ICONV_DEPENDS) endef define Package/bluez-utils/conffiles +/etc/bluetooth/main.conf +/etc/bluetooth/network.conf +/etc/bluetooth/input.conf +/etc/bluetooth/proximity.conf /etc/config/bluetooth endef @@ -80,6 +96,11 @@ define Build/InstallDev $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/bluez.pc $(1)/usr/lib/pkgconfig/ endef +define Package/bluez-examples/install + $(INSTALL_DIR) $(1)/usr/bin/bluez/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/* $(1)/usr/bin/bluez/ +endef + define Package/bluez-libs/install $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbluetooth.so.* $(1)/usr/lib/ @@ -88,13 +109,21 @@ endef define Package/bluez-utils/install $(INSTALL_DIR) $(1)/usr/bin $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/bluetooth/bluetoothd $(1)/usr/bin + $(INSTALL_BIN) $(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/ $(INSTALL_DATA) ./files/bluetooth.dbus $(1)/etc/dbus-1/system.d/bluetooth.conf + $(INSTALL_DIR) $(1)/etc/bluetooth + $(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_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/bluez-utils.init $(1)/etc/init.d/bluez-utils + $(INSTALL_BIN) ./files/bluetoothd.init $(1)/etc/init.d/bluetoothd endef +$(eval $(call BuildPackage,bluez-examples)) $(eval $(call BuildPackage,bluez-libs)) $(eval $(call BuildPackage,bluez-utils))