From 6a21a1004126364bc20a149931754ffb3bbd34d0 Mon Sep 17 00:00:00 2001 From: fewtarius Date: Fri, 11 Aug 2023 00:13:00 +0000 Subject: [PATCH] Fix bluetooth sense bug. --- .../system-utils/sources/scripts/bluetooth_sense | 12 ++++++------ .../system-utils/system.d/bluetoothsense.service | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/sysutils/system-utils/sources/scripts/bluetooth_sense b/packages/sysutils/system-utils/sources/scripts/bluetooth_sense index 502080bd6..28c66074d 100755 --- a/packages/sysutils/system-utils/sources/scripts/bluetooth_sense +++ b/packages/sysutils/system-utils/sources/scripts/bluetooth_sense @@ -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 diff --git a/packages/sysutils/system-utils/system.d/bluetoothsense.service b/packages/sysutils/system-utils/system.d/bluetoothsense.service index d1e6f64b0..d72917aee 100644 --- a/packages/sysutils/system-utils/system.d/bluetoothsense.service +++ b/packages/sysutils/system-utils/system.d/bluetoothsense.service @@ -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