X-Git-Url: https://git.xandkar.net/?p=khatus.git;a=blobdiff_plain;f=x2%2Fsrc%2Fbash%2Fexe%2Fkhatus_sensor_bluetooth.sh;fp=x2%2Fsrc%2Fbash%2Fexe%2Fkhatus_sensor_bluetooth.sh;h=af84abd40152313cbb537e669f56ea5481822979;hp=4e696c8f3a7ca7b9c632757ad379c2a868972d33;hb=1cae185ecebc4fd362099a229638c84a29b3bf4d;hpb=fd50daef4faaadd8c6ca57a59f906ef4f7ff61a5 diff --git a/x2/src/bash/exe/khatus_sensor_bluetooth.sh b/x2/src/bash/exe/khatus_sensor_bluetooth.sh index 4e696c8..af84abd 100644 --- a/x2/src/bash/exe/khatus_sensor_bluetooth.sh +++ b/x2/src/bash/exe/khatus_sensor_bluetooth.sh @@ -7,13 +7,14 @@ FS1='|' # Fields separator, level 1 (a record's fields) FS2=':' # Fields separator, level 2 (a field's subfields) count_powered_controllers() { - bluetoothctl -- show | grep -c 'Powered: yes' + echo show | bluetoothctl | grep -c 'Powered: yes' } count_connected_devices() { - bluetoothctl -- paired-devices \ - | awk '{print $2}' \ - | xargs -I % bluetoothctl -- info % \ + echo paired-devices \ + | bluetoothctl \ + | awk '/^Device +[0-9a-zA-Z][0-9a-zA-Z]:/ {print $2}' \ + | xargs -I % sh -c 'echo info % | bluetoothctl' \ | grep -c 'Connected: yes' }