Git init
[framework/connectivity/bluez.git] / scripts / bluetooth_serial
1 #!/bin/sh
2 #
3 # bluetooth_serial
4 #
5 # Bluetooth serial PCMCIA card initialization
6 #
7
8 start_serial()
9 {
10         if [ ! -x /bin/setserial -o ! -x /usr/sbin/hciattach ]; then
11                 logger "$0: setserial or hciattach not executable, cannot start $DEVNAME"
12                 return 1
13         fi
14
15         if [ "$BAUDBASE" != "" ]; then
16                 /bin/setserial $DEVNAME baud_base $BAUDBASE
17         fi
18
19         /usr/sbin/hciattach $DEVNAME $HCIOPTS 2>&1 | logger -t hciattach
20 }
21
22 stop_serial()
23 {
24         [ -x /bin/fuser ] || return 1 
25
26         /bin/fuser -k -HUP $DEVNAME > /dev/null
27 }
28
29 case "$ACTION" in
30    add)
31         start_serial
32         ;;
33    remove)
34         stop_serial
35         ;;
36    *)
37         logger "Unknown action received $0: $ACTION"
38         ;;
39 esac