|
1 | 1 | #!/bin/sh |
2 | 2 |
|
3 | 3 | start() { |
4 | | - echo -n "Running bluetooth startup script" |
5 | | - if [ -f /usr/bin/hciattach ]; then |
6 | | - echo -n "Flashing Blutooth firmware" |
7 | | - /usr/bin/hciattach /dev/ttyAMA0 bcm43xx 921600 noflow |
8 | | - if [ ! -d "/sys/class/bluetooth/hci0" ]; then |
9 | | - sleep 3 |
10 | | - /usr/bin/hciattach /dev/ttyAMA0 bcm43xx 921600 noflow |
11 | | - [ $? == 0 ] && echo "OK" || echo "FAIL" |
12 | | - else |
13 | | - echo "OK" |
14 | | - fi |
15 | | - fi |
16 | | - |
17 | | - if [ -f /usr/libexec/bluetooth/bluetoothd ]; then |
18 | | - echo -n "Starting bluetoothd daemon" |
19 | | - /usr/libexec/bluetooth/bluetoothd & |
20 | | - [ $? == 0 ] && echo "OK" || echo "FAIL" |
21 | | - fi |
22 | | - |
23 | | - if [ -f /usr/bin/bluealsa ]; then |
24 | | - echo -n "Starting bluealsa daemon" |
25 | | - /usr/bin/bluealsa & |
26 | | - [ $? == 0 ] && echo "OK" || echo "FAIL" |
27 | | - fi |
| 4 | + if [ -f /usr/bin/hciattach ]; then |
| 5 | + echo -n "Flashing Blutooth firmware" |
| 6 | + /usr/bin/hciattach /dev/ttyAMA0 bcm43xx 921600 noflow |
| 7 | + if [ ! -d "/sys/class/bluetooth/hci0" ]; then |
| 8 | + sleep 3 |
| 9 | + /usr/bin/hciattach /dev/ttyAMA0 bcm43xx 921600 noflow |
| 10 | + [ $? == 0 ] && echo "OK" || echo "FAIL" |
| 11 | + else |
| 12 | + echo "OK" |
| 13 | + fi |
| 14 | + fi |
| 15 | + if [ -f /usr/libexec/bluetooth/bluetoothd ]; then |
| 16 | + echo -n "Starting bluetoothd daemon" |
| 17 | + /usr/libexec/bluetooth/bluetoothd & |
| 18 | + [ $? == 0 ] && echo "OK" || echo "FAIL" |
| 19 | + fi |
| 20 | + if [ -f /usr/bin/bluealsa ]; then |
| 21 | + echo -n "Starting bluealsa daemon" |
| 22 | + /usr/bin/bluealsa & |
| 23 | + [ $? == 0 ] && echo "OK" || echo "FAIL" |
| 24 | + fi |
28 | 25 | } |
29 | 26 | stop() { |
30 | | - echo -n "Stopping bluetoothd daemon" |
31 | | - killall -9 bluetoothd |
32 | | - [ $? == 0 ] && echo "OK" || echo "FAIL" |
33 | | - |
34 | | - echo -n "Stopping bluealsa daemon" |
35 | | - killall -9 bluealsa |
36 | | - [ $? == 0 ] && echo "OK" || echo "FAIL" |
| 27 | + if [ -f /usr/libexec/bluetooth/bluetoothd ]; then |
| 28 | + echo -n "Stopping bluetoothd daemon" |
| 29 | + killall -9 bluetoothd |
| 30 | + [ $? == 0 ] && echo "OK" || echo "FAIL" |
| 31 | + fi |
| 32 | + if [ -f /usr/bin/bluealsa ]; then |
| 33 | + echo -n "Stopping bluealsa daemon" |
| 34 | + killall -9 bluealsa |
| 35 | + [ $? == 0 ] && echo "OK" || echo "FAIL" |
| 36 | + fi |
| 37 | + if [ -f /usr/bin/hciattach ]; then |
| 38 | + echo -n "Stopping hci0 bluetooth interface" |
| 39 | + /usr/bin/hciconfig hci0 down |
| 40 | + fi |
37 | 41 | } |
38 | 42 | restart() { |
39 | 43 | stop |
|
0 commit comments