1 | 1 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,41 @@ |
1 |
+#!/bin/sh |
|
2 |
+set -euC |
|
3 |
+ |
|
4 |
+action="${1:-"info"}" |
|
5 |
+devices="68:D6:ED:1F:49:EF 41:42:96:48:5F:1F" |
|
6 |
+ |
|
7 |
+info() |
|
8 |
+{ |
|
9 |
+ for device in $devices |
|
10 |
+ do |
|
11 |
+ bluetoothctl info "$device" | awk '/^\s*(Device|Name|Paired|Connected)/' |
|
12 |
+ done |
|
13 |
+} |
|
14 |
+ |
|
15 |
+pair() |
|
16 |
+{ |
|
17 |
+ bluetoothctl scan on |
|
18 |
+ bluetoothctl pair "$1" || true |
|
19 |
+ bluetoothctl scan off |
|
20 |
+} |
|
21 |
+ |
|
22 |
+on() |
|
23 |
+{ |
|
24 |
+ bluetoothctl power on |
|
25 |
+ for device in $devices |
|
26 |
+ do |
|
27 |
+ bluetoothctl connect "$device" & |
|
28 |
+ done |
|
29 |
+} |
|
30 |
+ |
|
31 |
+off() |
|
32 |
+{ |
|
33 |
+ for device in $devices |
|
34 |
+ do |
|
35 |
+ bluetoothctl disconnect "$device" & |
|
36 |
+ done |
|
37 |
+ bluetoothctl power off |
|
38 |
+} |
|
39 |
+ |
|
40 |
+"$action" |
|
41 |
+wait |