#!/bin/bash . /etc/rc.d/init.d/functions PATH=$PATH:/usr/sbin:/usr/bin #SERVICES="SP DUN LAN FAX OPUSH FTRN NAP GN HID CIP CTP" SERVICES="LAN NAP" hcistart() { /etc/rc.d/init.d/bluetooth start hciattach /dev/ttyS2 csr 115200 } hciwait() { for i in `hciconfig | grep ^hci | cut -f1 -d":"`; do echo -n waiting $i COUNTER=0 while [ $COUNTER -lt 10 ]; do hciconfig -a $i | grep "Class: 0x000000" > /dev/null if [ $? == 0 ]; then break fi echo -n . sleep 1 let COUNTER=COUNTER+1 done done echo " Done." } hcireset() { hciconfig $i down hciconfig $i up } hcistop() { /etc/rc.d/init.d/bluetooth stop } start() { hcistart hciwait hcireset modprobe bnep daemon pand --listen --persist --master --role NAP daemon dund --listen --persist --msdun --pppd /usr/sbin.rom/pppd call dun for i in $SERVICES; do sdptool add $i done } stop() { pand --killall killproc pand rmmod bnep dund --killall killproc dund hcistop } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; reset) hcireset ;; *) echo $"Usage: $0 {start|stop|restart|reset}" exit 1 esac exit 0