packages/bluez-utils: use new service functions, move checks for enabled services earlier

git-svn-id: svn://svn.openwrt.org/openwrt/packages@28956 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nico 2011-11-11 18:06:50 +00:00
parent 1ae97253ea
commit 9982f046e1
2 changed files with 22 additions and 17 deletions

View File

@ -1,5 +1,5 @@
# #
# Copyright (C) 2006-2010 OpenWrt.org # Copyright (C) 2006-2011 OpenWrt.org
# #
# This is free software, licensed under the GNU General Public License v2. # This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information. # See /LICENSE for more information.
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=bluez-utils PKG_NAME:=bluez-utils
PKG_VERSION:=3.36 PKG_VERSION:=3.36
PKG_RELEASE:=7 PKG_RELEASE:=8
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://bluez.sourceforge.net/download PKG_SOURCE_URL:=http://bluez.sourceforge.net/download

View File

@ -10,7 +10,7 @@ append_bool() {
local value="$3" local value="$3"
local _val local _val
config_get_bool _val "$section" "$option" '0' config_get_bool _val "$section" "$option" '0'
[ "$_val" -gt 0 ] && append args "$3" [ $_val -gt 0 ] && append args "$3"
} }
append_string() { append_string() {
@ -25,35 +25,40 @@ append_string() {
hcid_config() { hcid_config() {
local cfg="$1" local cfg="$1"
config_get_bool enabled "$cfg" "enabled" '1'
[ $enabled -gt 0 ] || return 1
args="" args=""
append_bool "$cfg" nodaemon "-n" append_bool "$cfg" nodaemon "-n"
append_string "$cfg" config "-f" append_string "$cfg" config "-f"
config_get_bool enabled "$cfg" "enabled" '1' service_start /usr/sbin/hcid $args
[ "$enabled" -gt 0 ] && /usr/sbin/hcid $args
} }
hciattach_config() { hciattach_config() {
local cfg="$1" local cfg="$1"
config_get_bool enabled "$cfg" "enabled" '1'
[ $enabled -gt 0 ] || return 1
args="" args=""
append_string "$cfg" initspeed "-s" "115200" append_string "$cfg" initspeed "-s" "115200"
append_string "$cfg" tty " " "ttyS1" append_string "$cfg" tty " " "ttyS1"
append_string "$cfg" type " " "csr" append_string "$cfg" type " " "csr"
append_string "$cfg" speed " " "115200" append_string "$cfg" speed " " "115200"
append_string "$cfg" flow " " "noflow" append_string "$cfg" flow " " "noflow"
config_get_bool enabled "$cfg" "enabled" '1' service_start /usr/sbin/hciattach $args
[ "$enabled" -gt 0 ] && /usr/sbin/hciattach $args
} }
rfcomm_config() { rfcomm_config() {
local cfg="$1" local cfg="$1"
config_get_bool enabled "$cfg" "enabled" '1'
[ $enabled -gt 0 ] || return 1
args="" args=""
append_string "$cfg" config "-f" append_string "$cfg" config "-f"
config_get_bool enabled "$cfg" "enabled" '1' /usr/bin/rfcomm $args bind all
[ "$enabled" -gt 0 ] && /usr/bin/rfcomm $args bind all
} }
dund_config() { dund_config() {
local cfg="$1" local cfg="$1"
config_get_bool enabled "$cfg" "enabled" '1'
[ $enabled -gt 0 ] || return 1
args="" args=""
append_bool "$cfg" listen "--listen" append_bool "$cfg" listen "--listen"
append_string "$cfg" connect "--connect" append_string "$cfg" connect "--connect"
@ -80,12 +85,13 @@ dund_config() {
[ -z "$unit" ] || append args "unit $unit ipparam $ifn linkname $ifn" [ -z "$unit" ] || append args "unit $unit ipparam $ifn linkname $ifn"
fi fi
config_get_bool enabled "$cfg" "enabled" '1' service_start /usr/bin/dund $args
[ "$enabled" -gt 0 ] && /usr/bin/dund $args
} }
pand_config() { pand_config() {
local cfg="$1" local cfg="$1"
config_get_bool enabled "$cfg" "enabled" '1'
[ $enabled -gt 0 ] || return 1
args="" args=""
append_bool "$cfg" listen "--listen" append_bool "$cfg" listen "--listen"
append_string "$cfg" connect "--connect" append_string "$cfg" connect "--connect"
@ -104,8 +110,7 @@ pand_config() {
append_bool "$cfg" persist "--persist" append_bool "$cfg" persist "--persist"
append_bool "$cfg" cache "--cache" append_bool "$cfg" cache "--cache"
append_string "$cfg" pidfile "--pidfile" append_string "$cfg" pidfile "--pidfile"
config_get_bool enabled "$cfg" "enabled" '1' service_start /usr/bin/pand $args
[ "$enabled" -gt 0 ] && /usr/bin/pand $args
} }
start() { start() {
@ -121,9 +126,9 @@ start() {
} }
stop() { stop() {
killall dund service_stop /usr/bin/dund
killall pand service_stop /usr/bin/pand
/usr/bin/rfcomm release all /usr/bin/rfcomm release all
killall hciattach service_stop /usr/sbin/hciattach
killall hcid service_stop /usr/sbin/hcid
} }