From 99148a336433ac48bd8dc1fb23f4dc7cbf8c812e Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Thu, 18 Jul 2002 01:54:04 +0000 Subject: Improved PCMCIA init script --- pcmcia/bluetooth | 65 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/pcmcia/bluetooth b/pcmcia/bluetooth index ea22ce40..b21ff04d 100755 --- a/pcmcia/bluetooth +++ b/pcmcia/bluetooth @@ -2,33 +2,58 @@ # # bluetooth # -# Initialize a PCMCIA Bluetooth device +# PCMCIA Bluetooth device initialization # Written by Maxim Krasnyanskiy # -# $1 - socket -# $2 - device -# +# This script requires new cardmgr and expects following +# environment variables FUNCTION, VENDORID, CARDNAME +# -LOG="/usr/bin/logger -i -t bluetooth -p daemon.notice" +# +# $Id$ +# -IDENT="/sbin/cardctl ident $1" +if [ -r ./shared ]; then . ./shared ; else . /etc/pcmcia/shared ; fi -# Check if card is really a Bluetooth card -if ! $IDENT | grep -i 'bluetooth' > /dev/null 2>&1; then - $LOG "$2 is not a Bluetooth device" - exit -fi +# Get device attributes +get_info $DEVICE -ID=`$IDENT | awk '/.*id/{print $2 $3}'` -TYPE=`$IDENT | awk '/.*func/{print $2}'` +# +# Serial devices +# +start_serial() { + /sbin/hciattach $DEVICE $VENDORID +} +stop_serial() { + return +} +suspend_serial() { + do_fuser -k -HUP /dev/$DEVICE > /dev/null +} +resume_serial() { + start_serial +} + +start= +stop= +suspend= +resume= +check= +cksum= -$LOG "Bluetooth device id $ID type $TYPE $2" +case "$FUNCTION" in +2) # Serial + if ! echo $CARDNAME | grep -i 'bluetooth' > /dev/null 2>&1; then + exit + fi -case "$TYPE" in - # Serial device - 2) - /sbin/hciattach $DEVICE $ID - ;; + start=start_serial + stop=stop_serial + suspend=suspend_serial + resume=resume_serial + ;; esac -unset LOG IDENT ID TYPE +eval \$$ACTION + +exit 0 -- cgit