summaryrefslogtreecommitdiffstats
path: root/scripts/bluetooth_serial
blob: 6461e78d4a55982c0310303d0bb970a27613ad18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
#
# bluetooth_serial
#
# Bluetooth serial PCMCIA card initialization
#

start_serial()
{
	if [ ! -x /bin/setserial -o ! -x /usr/sbin/hciattach ]; then
		logger "$0: setserial or hciattach not executable, cannot start $DEVNAME"
		return 1
	fi

	IRQ=`/bin/setserial $DEVNAME | sed -e 's/.*IRQ: //'`
	/bin/setserial $DEVNAME irq 0 ; /bin/setserial $DEVNAME irq $IRQ

	MANF_CARD_ID="${MANF_ID},${CARD_ID}"
	# I don't have a generic solution, sorry
	if [ $MANF_CARD_ID = "0x0160,0x0002" ]; then
		/usr/sbin/hciattach $DEVNAME $MANF_CARD_ID 115200
	else
		/usr/sbin/hciattach $DEVNAME $MANF_CARD_ID
	fi
}

stop_serial()
{
	[ -x /bin/fuser ] || return 1 

	/bin/fuser -k -HUP $DEVNAME > /dev/null
}

case "$ACTION" in
   add)
	start_serial
	;;
   remove)
	stop_serial
	;;
   *)
	logger "Unknown action received $0: $ACTION"
	;;
esac