forked from linrunner/TLP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tlp-rf.in
57 lines (45 loc) · 1.18 KB
/
tlp-rf.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
# tlp - switch bluetooth/wifi/wwan on/off
#
# Copyright (c) 2021 Thomas Koch <linrunner at gmx.net> and others.
# This software is licensed under the GPL v2 or later.
# shellcheck disable=SC2086,SC2154
# --- Source libraries
for lib in @TLP_TLIB@/tlp-func-base @TLP_FLIB@/25-tlp-func-rf @TLP_FLIB@/30-tlp-func-rf-sw; do
# shellcheck disable=SC1090
. $lib
done
# --- MAIN
# read configuration: quit on error, trace allowed
read_config 1 0
carg1=$1
parse_args4config "$@"
add_sbin2path
self=${0##*/}
case $self in
bluetooth|wifi|wwan)
case $carg1 in
on)
device_switch $self on
echo_device_state $self $_devs
;;
off)
device_switch $self off
echo_device_state $self $_devs
;;
toggle)
device_switch $self toggle
echo_device_state $self $_devs
;;
*)
device_state $self
echo_device_state $self $_devs
;;
esac
;;
*)
echo "Error: unknown device type \"$self\"." 1>&2
do_exit 1
;;
esac
do_exit 0