-
Notifications
You must be signed in to change notification settings - Fork 0
/
utility
executable file
·117 lines (109 loc) · 2.37 KB
/
utility
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
WrongArg () {
>&2 echo "wrong arguments!"
exit 2
}
UnknownStatus () {
>&2 echo "Unknown Status for $1!"
exit 1
}
NoModule() {
>&2 echo "Cannot load acpi_call kernel module!"
exit 127
}
[ -f /proc/acpi/call ] || modprobe acpi_call || NoModule
if [ $1 = "cleanfan" ]; then
echo 1 > /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/fan_mode
sleep 5
echo 0 > /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/fan_mode
elif [ $1 = "set" ]; then
case $2 in
"performance")
case $3 in
"extreme")
echo '\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x0012B001' > /proc/acpi/call
;;
"balance")
echo '\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x0012B001' > /proc/acpi/call
;;
"conservation")
echo '\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x0013B001' > /proc/acpi/call
;;
*)
WrongArg
;;
esac
;;
"battery")
case $3 in
"normal")
echo '\_SB.PCI0.LPC0.EC0.VPC0.SBMC 0x08' > /proc/acpi/call
echo '\_SB.PCI0.LPC0.EC0.VPC0.SBMC 0x05' > /proc/acpi/call
;;
"conservation")
echo '\_SB.PCI0.LPC0.EC0.VPC0.SBMC 0x08' > /proc/acpi/call
echo '\_SB.PCI0.LPC0.EC0.VPC0.SBMC 0x03' > /proc/acpi/call
;;
"rapidcharge")
echo '\_SB.PCI0.LPC0.EC0.VPC0.SBMC 0x05' > /proc/acpi/call
echo '\_SB.PCI0.LPC0.EC0.VPC0.SBMC 0x07' > /proc/acpi/call
;;
*)
WrongArg
;;
esac
;;
*)
WrongArg
;;
esac
elif [ $1 = "get" ]; then
case $2 in
"performance")
FCMO=$(echo '\_SB.PCI0.LPC0.EC0.FCMO' > /proc/acpi/call; cat /proc/acpi/call | tr -d '\0')
case ${FCMO} in
"0x0")
echo "Intelligent Cooling"
;;
"0x1")
echo "Extreme Performance"
;;
"0x2")
echo "Battery Saving"
;;
*)
UnknownStatus "Performance mode FCMO=${FCMO}"
;;
esac
;;
"battery")
QCHO=$(echo '\_SB.PCI0.LPC0.EC0.QCHO' > /proc/acpi/call; cat /proc/acpi/call | tr -d '\0')
BTSM=$(echo '\_SB.PCI0.LPC0.EC0.BTSM' > /proc/acpi/call; cat /proc/acpi/call | tr -d '\0')
case ${QCHO} in
"0x0")
echo "Rapid Charge Off"
;;
"0x1")
echo "Rapid Charge On"
;;
*)
UnknownStatus "Rapid Charge QCHO=${QCHO}"
esac
case ${BTSM} in
"0x0")
echo "Battery Conservation Off"
;;
"0x1")
echo "Battery Conservation On"
;;
*)
UnknownStatus "Battery Conservation BTSM=${BTSM}"
esac
;;
*)
WrongArg
;;
esac
else
WrongArg
fi