From 5940c73d10772a2562564f3abbe114e5f0642461 Mon Sep 17 00:00:00 2001 From: hcg Date: Tue, 10 Aug 2010 08:36:08 +0000 Subject: [PATCH] [packages] bluez-utils: Add configuration and init scripts for hci serial devices git-svn-id: svn://svn.openwrt.org/openwrt/packages@22573 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- utils/bluez-utils/files/bluetooth.conf | 8 ++++++++ utils/bluez-utils/files/bluez-utils.init | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/utils/bluez-utils/files/bluetooth.conf b/utils/bluez-utils/files/bluetooth.conf index dad576e9d..42f390c67 100644 --- a/utils/bluez-utils/files/bluetooth.conf +++ b/utils/bluez-utils/files/bluetooth.conf @@ -2,6 +2,14 @@ config hcid # option config /etc/bluetooth/hcid.conf option enabled 1 +config hciattach + option initspeed 115200 + option tty ttyS1 + option type csr + option speed 115200 + option flow noflow + option enabled 0 + config rfcomm # option config /etc/bluetooth/rfcomm.conf option enabled 0 diff --git a/utils/bluez-utils/files/bluez-utils.init b/utils/bluez-utils/files/bluez-utils.init index 13dadeee9..0b326280b 100644 --- a/utils/bluez-utils/files/bluez-utils.init +++ b/utils/bluez-utils/files/bluez-utils.init @@ -17,8 +17,9 @@ append_string() { local section="$1" local option="$2" local value="$3" + local default="$4" local _val - config_get _val "$section" "$option" + config_get _val "$section" "$option" "$default" [ -n "$_val" ] && append args "$3 $_val" } @@ -31,6 +32,18 @@ hcid_config() { [ "$enabled" -gt 0 ] && /usr/sbin/hcid $args } +hciattach_config() { + local cfg="$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" + config_get_bool enabled "$cfg" "enabled" '1' + [ "$enabled" -gt 0 ] && /usr/sbin/hciattach $args +} + rfcomm_config() { local cfg="$1" args="" @@ -101,6 +114,7 @@ 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 @@ -110,5 +124,6 @@ stop() { killall dund killall pand /usr/bin/rfcomm release all + killall hciattach killall hcid } -- 2.11.0