commit 9f9414866a6507c8f7c7568b21221cdf27d435d3
parent b06712cdecc23e7818f0e4300a4eec3939440acd
Author: Nicolas Thill <nico@openwrt.org>
Date: Thu, 2 Apr 2015 17:15:33 +0200
Merge branch 'bluez5_refresh' of https://github.com/plntyk/packages into plntyk-bluez5_refresh
Diffstat:
4 files changed, 46 insertions(+), 152 deletions(-)
diff --git 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))
diff --git 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
diff --git a/utils/bluez/files/bluetoothd.init 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
@@ -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
-}