-
Notifications
You must be signed in to change notification settings - Fork 132
/
tlp-rf.in
61 lines (50 loc) · 1.3 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
58
59
60
61
#!/bin/sh
# tlp - switch bluetooth/nfc/wifi/wwan on/off
#
# Copyright (c) 2024 Thomas Koch <linrunner at gmx.net> and others.
# SPDX-License-Identifier: GPL-2.0-or-later
# --- 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
carg1="$1"
if [ "$carg1" = "--version" ]; then
print_version
exit 0
fi
# read configuration: quit on error, trace allowed
read_config 1 0
parse_args4config "$@"
cprintf_init
add_sbin2path
self=${0##*/}
case $self in
bluetooth|nfc|wifi|wwan)
case $carg1 in
on)
device_switch "$self" on
# shellcheck disable=SC2154
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
;;
*)
cecho "Error: unknown device type \"$self\"." 1>&2
do_exit 1
;;
esac
do_exit 0