45 lines
840 B
Bash
Executable File
45 lines
840 B
Bash
Executable File
#!/bin/ash
|
|
# $1: on or off
|
|
|
|
BSA_SERVER=/usr/bin/bsa_server
|
|
LE_APP=/usr/bin/app_nevsps
|
|
WIFI_APP=/bin/app_wifi_manager
|
|
BT_SOCKET_PATH_PREFIX=/mnt/UDISK/bt/
|
|
BLE_LOCAL_KEY_FILE=ble_local_keys
|
|
bt_on()
|
|
{
|
|
if ps | grep [b]sa_server ; then
|
|
killall -q -KILL bsa_server
|
|
sleep 2
|
|
fi
|
|
|
|
echo 0 > /sys/class/rfkill/rfkill0/state
|
|
sleep 1
|
|
echo 1 > /sys/class/rfkill/rfkill0/state
|
|
sleep 1
|
|
|
|
$BSA_SERVER -all=0 -d/dev/ttyS1 -u$BT_SOCKET_PATH_PREFIX -k$BT_SOCKET_PATH_PREFIX$BLE_LOCAL_KEY_FILE -p/lib/firmware/bcm43436b0.hcd -r12 &
|
|
sleep 2
|
|
}
|
|
|
|
bt_off()
|
|
{
|
|
killall bsa_server
|
|
sleep 1
|
|
|
|
echo 0 > /sys/class/rfkill/rfkill0/state
|
|
}
|
|
|
|
if [ "$1" = "on" ]; then
|
|
echo "turn on bt"
|
|
bt_on $2
|
|
else
|
|
if [ "$1" = "off" ]; then
|
|
echo "turn off bt"
|
|
bt_off
|
|
else
|
|
echo "no paras"
|
|
exit 1
|
|
fi
|
|
fi
|