Fix bluetooth sense bug.
This commit is contained in:
parent
95843ae8a3
commit
6a21a10041
2 changed files with 8 additions and 7 deletions
|
@ -8,16 +8,16 @@
|
|||
|
||||
while true
|
||||
do
|
||||
if [ "$(bluetoothctl show | awk '/Powered:/ {print $2}' 2>/dev/null})" = "yes" ]
|
||||
if [ "$(/usr/bin/bluetoothctl show | awk '/Powered:/ {print $2}' 2>/dev/null)" = "yes" ]
|
||||
then
|
||||
for DEVICE in $(bluetoothctl devices Paired | awk '{print $2}' 2>/dev/null)
|
||||
for DEVICE in $(/usr/bin/bluetoothctl devices Paired 2>&1 | awk '{print $2}' 2>/dev/null)
|
||||
do
|
||||
CONNECTED=$(bluetoothctl devices Connected | grep ${DEVICE} >/dev/null 2>&1)
|
||||
if [ ! $? = 0 ]
|
||||
CONNECTED=$(/usr/bin/bluetoothctl devices Connected 2>&1 | grep ${DEVICE} 2>/dev/null)
|
||||
if [ -z "${CONNECTED}" ]
|
||||
then
|
||||
echo "connect ${DEVICE}" | bluetoothctl --timeout 5 >/dev/null 2>&1
|
||||
/usr/bin/bluetoothctl --timeout 5 connect ${DEVICE} >/dev/null 2>&1
|
||||
fi
|
||||
sleep .2
|
||||
sleep .5
|
||||
done
|
||||
fi
|
||||
sleep 5
|
||||
|
|
|
@ -3,10 +3,11 @@ Description=Bluetooth Sense
|
|||
Before=jelos.target
|
||||
|
||||
[Service]
|
||||
Environment=XDG_RUNTIME_DIR=/var/run/0-runtime-dir
|
||||
Environment=HOME=/storage
|
||||
EnvironmentFile=/etc/profile
|
||||
ExecStart=/usr/bin/bluetooth_sense
|
||||
Restart=on-failure
|
||||
Type=simple
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
Loading…
Reference in a new issue