bluez-utils: Added startup script and configuration file. Set bluetooth identifier...
authorRod Whitby <rod@whitby.id.au>
Wed, 19 Sep 2007 15:53:33 +0000 (15:53 +0000)
committerRod Whitby <rod@whitby.id.au>
Wed, 19 Sep 2007 15:53:33 +0000 (15:53 +0000)
SVN-Revision: 8842

utils/bluez-utils/Makefile
utils/bluez-utils/files/bluetooth.conf [new file with mode: 0644]
utils/bluez-utils/files/bluez-utils.init [new file with mode: 0644]
utils/bluez-utils/patches/002-hcid_pin_helper.patch

index 745f29cc0e24ca9beb6217ba242d453376c97807..f39fc8ba8a60293b56f8d06843a502ace10c2af1 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=bluez-utils
 PKG_VERSION:=2.24
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://bluez.sourceforge.net/download
@@ -34,6 +34,7 @@ define Package/bluez-utils/conffiles
 /etc/bluetooth/givepin
 /etc/bluetooth/hcid.conf
 /etc/bluetooth/rfcomm.conf
+/etc/config/bluetooth
 endef
 
 define Build/Configure
@@ -71,6 +72,10 @@ define Package/bluez-utils/install
        $(CP) $(PKG_INSTALL_DIR)/../hcid/hcid.conf $(1)/etc/bluetooth/
        $(CP) $(PKG_INSTALL_DIR)/../rfcomm/rfcomm.conf $(1)/etc/bluetooth/
        install -m0700 ./files/givepin $(1)/etc/bluetooth/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/bluetooth.conf $(1)/etc/config/bluetooth
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/bluez-utils.init $(1)/etc/init.d/bluez-utils
 endef
 
 $(eval $(call BuildPackage,bluez-utils))
diff --git a/utils/bluez-utils/files/bluetooth.conf b/utils/bluez-utils/files/bluetooth.conf
new file mode 100644 (file)
index 0000000..7365ea7
--- /dev/null
@@ -0,0 +1,24 @@
+config hcid
+#      option config   /etc/bluetooth/hcid.conf
+       option enabled  1
+
+config sdpd
+       option enabled  0
+
+config rfcomm
+#      option config   /etc/bluetooth/rfcomm.conf
+       option enabled  0
+
+config dund
+       option listen   true
+       option persist  true
+       option msdun    true
+       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-utils/files/bluez-utils.init b/utils/bluez-utils/files/bluez-utils.init
new file mode 100644 (file)
index 0000000..b064a47
--- /dev/null
@@ -0,0 +1,116 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007 OpenWrt.org
+
+START=60
+
+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 _val
+       config_get _val "$section" "$option"
+       [ -n "$_val" ] && append args "$3 $_val"
+}
+
+hcid_config() {
+       local cfg="$1"
+       args=""
+       append_bool "$cfg" nodaemon "-n"
+       append_string "$cfg" config "-f"
+       config_get_bool enabled "$cfg" "enabled" '1'
+       [ "$enabled" -gt 0 ] && /usr/sbin/hcid $args
+}
+
+sdpd_config() {
+       local cfg="$1"
+       args=""
+       append_bool "$cfg" nodaemon "-n"
+       append_bool "$cfg" something "-m"
+       config_get_bool enabled "$cfg" "enabled" '1'
+       [ "$enabled" -gt 0 ] && /usr/sbin/sdpd $args
+}
+
+rfcomm_config() {
+       local cfg="$1"
+       args=""
+       append_string "$cfg" config "-f"
+       config_get_bool enabled "$cfg" "enabled" '1'
+       [ "$enabled" -gt 0 ] && /usr/bin/rfcomm $args bind all
+}
+
+dund_config() {
+       local cfg="$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"
+       config_get_bool enabled "$cfg" "enabled" '1'
+       [ "$enabled" -gt 0 ] && /usr/bin/dund $args
+}
+
+pand_config() {
+       local cfg="$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"
+       config_get_bool enabled "$cfg" "enabled" '1'
+       [ "$enabled" -gt 0 ] && /usr/bin/pand $args
+}
+
+start() {
+       include /lib/network
+       scan_interfaces
+       config_load bluetooth
+
+       config_foreach hcid_config hcid
+       config_foreach sdpd_config sdpd
+       config_foreach rfcomm_config rfcomm
+       config_foreach dund_config dund
+       config_foreach pand_config pand
+}
+
+stop() {
+       killall dund
+       killall pand
+       /usr/bin/rfcomm release all
+       killall sdpd
+       killall hcid
+}
index 17a7f364038537ba34389558c8691848f26a3583..f8c94543e06624ef6f99c01d2b9a557957e01b6f 100644 (file)
@@ -15,7 +15,7 @@ diff -ur bluez-utils-2.17.orig/hcid/hcid.conf bluez-utils-2.17/hcid/hcid.conf
        #   %d - device id
        #   %h - host name
 -      name "BlueZ (%d)";
-+      name "OpenWRT";
++      name "%h";
  
        # Local device class
        class 0x3e0100;