diff options
Diffstat (limited to 'meta/recipes-connectivity/bluez/bluez-dtl1-workaround')
-rw-r--r-- | meta/recipes-connectivity/bluez/bluez-dtl1-workaround/02dtl1_cs.sh | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/bluez/bluez-dtl1-workaround/02dtl1_cs.sh b/meta/recipes-connectivity/bluez/bluez-dtl1-workaround/02dtl1_cs.sh new file mode 100644 index 0000000000..fefc72e07a --- /dev/null +++ b/meta/recipes-connectivity/bluez/bluez-dtl1-workaround/02dtl1_cs.sh | |||
@@ -0,0 +1,57 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | case "$1" in | ||
4 | suspend) | ||
5 | if [ "`/sbin/hciconfig`" != "" ]; then | ||
6 | #If hciconfig outputs anything then there's probably a Bluetooth | ||
7 | # CF card in the slot so shut it down. | ||
8 | hcitool dc `hcitool con | grep ACL | sed 's/^.*\([0-9A-F]\{2\}\(:[0-9A-F]\{2\}\)\{5\}\).*$/\1/'` | ||
9 | hciconfig hci0 down | ||
10 | killall hciattach > /dev/null 2>&1 | ||
11 | fi | ||
12 | ;; | ||
13 | |||
14 | resume) | ||
15 | #check for kernel version | ||
16 | if [ "`uname -r | grep 2.4.`" != "" ]; then | ||
17 | k="o" | ||
18 | elif [ "`uname -r | grep 2.6.`" != "" ]; then | ||
19 | k="ko" | ||
20 | else | ||
21 | exit 0 | ||
22 | fi | ||
23 | |||
24 | if test -e /sbin/cardctl; then | ||
25 | CARDCTL=/sbin/cardctl | ||
26 | elif test -e /sbin/pccardctl; then | ||
27 | CARDCTL=/sbin/pccardctl | ||
28 | else | ||
29 | exit 0 | ||
30 | fi | ||
31 | |||
32 | if [ "`lsmod | grep hci_uart`" != "" ]; then | ||
33 | #If the hci_usb module is still loaded then there's a serial based | ||
34 | # Bluetooth CF card in the slot, which only needs a resume to get it going | ||
35 | # again. | ||
36 | rfcomm bind all | ||
37 | $CARDCTL resume | ||
38 | hciconfig hci0 up | ||
39 | else | ||
40 | # only works for nokia dtl1 cards | ||
41 | for f in /lib/modules/`uname -r`/kernel/drivers/bluetooth/dtl1_cs.$k | ||
42 | do | ||
43 | #Enumerate all the self-contained Bluetooth CF card drivers | ||
44 | f=`echo $f | sed 's/\.'$k'$//'` | ||
45 | f=`basename $f` | ||
46 | if [ "`lsmod | grep $f`" != "" ]; then | ||
47 | #If one of these drivers is still loaded, then there is probably | ||
48 | #a non-serial based Bluetooth CF card in the slot that needs | ||
49 | #ejecting and reinserting to get it going again | ||
50 | rfcomm bind all | ||
51 | $CARDCTL eject | ||
52 | $CARDCTL insert | ||
53 | hciconfig hci0 up | ||
54 | fi | ||
55 | done | ||
56 | fi | ||
57 | esac | ||