forked from linrunner/TLP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tlp-rf.in
56 lines (47 loc) · 1.15 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
#!/bin/sh
# tlp - switch bluetooth/wifi/wwan on/off
#
# Copyright (c) 2016 Thomas Koch <linrunner at gmx.net>
# This software is licensed under the GPL v2 or later.
# --- Constants
readonly LIBDIR="@TLP_TLIB@"
readonly LIBS="tlp-functions tlp-rf-func"
# --- Source libraries
for lib in $LIBS; do
if [ ! -f $LIBDIR/$lib ]; then
echo "Error: missing function library \'$LIBDIR/$lib\'." 1>&2
exit 1
fi
. $LIBDIR/$lib
done
# --- MAIN
read_defaults
add_sbin2path
self=${0##*/}
case $self in
bluetooth|wifi|wwan)
case $1 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
exit 1
;;
esac
exit 0