forked from l29ah/x210-ec
-
Notifications
You must be signed in to change notification settings - Fork 4
/
menu.sh
executable file
·48 lines (48 loc) · 3.03 KB
/
menu.sh
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
#!/bin/bash
set -x
dialog --checklist 'Choose the desired patches' 0 0 0 \
fn-swap 'Swap Fn and Ctrl keys' off \
fix-ec-debug 'Allow hot-patching of EC.' on \
default-lcd-brightness 'Set default LCD backlight brightness behaviour' off \
lcd-brightness 'Allow lowering LCD backlight brightness to 1% (1%,2%,4%,8%,16%,32%,44%,48%,55%,60%,65%,70%,78%,84%,94%,99%)' on \
improved-lcd-brightness 'Allow lowering LCD backlight brightness to 1% (1%,2%,4%,8%,14%,21%,30%,44%,48%,55%,61%,66%,73%,80%,92%,99%)' off \
lcd-backlight-925hz 'LCD backlight to 925Hz' off \
true-battery-reading 'Fix battery reading above 70%' on \
battery-current 'Fix battery current measurement' on \
backlight-os-only 'EC only changes backlight by ACPI control (see ./acpi for /etc/acpi configuration)' on \
fast-charge 'Fast charge 6C (3A) and 9C (4A) batteries, and limit input power to 80W (65W adapters drop charging regularly)' off \
input-current-45w 'Input current 45W' off \
input-current-65w 'Input current 65W' off \
input-current-80w 'Input current 80W' off \
enable-hotkeys 'Generate scancodes for hotkeys' off \
enable-hotkey-f3 'Generate scancodes for F3 hotkey (interferes with built-in screen off)' off \
default-fan-pwm-table 'Set default fan pwm table' off \
direct-fan-pwm-values 'Set direct fan values 5 and 15' off \
silent-fan-pwm-table 'Set silent fan pwm table' off \
silent2-fan-pwm-table 'Set silent 2 fan pwm table' off \
silent3-fan-pwm-table 'Set silent 3 fan pwm table' off \
fix-other-keys 'Fix some Blender issues with Enter, 7 and enable ThinkVantage button' off \
remove-temperature-changed 'Remove temperature changed event' off \
remove-battery-spam 'Remove battery ACPI event spam' off \
usb-c 'USB-C charging check' off \
vlad00 'Unknown vladisslav2021 patch port (most likely fix to swap Fn/Ctrl and Ctrl+Wheel functionality' off \
brightness 'Brightness' off \
2> selected
for p in $(cat selected); do
fn="patches/$p.rapatch"
if [ ! -e "$fn" ]; then
echo "The patch \"$fn\" doesn't exist!"
exit 1
fi
if [[ "$p" =~ .*fan-pwm-table$ ]]; then
set +x
echo -e "PWM FAN TABLE:\n in out pwm"; cat patches/$p.rapatch | cut -d" " -f2 | sed "s/\([0-9a-f][0-9a-f]\)/\1 /g" | awk '{ print sprintf("%4d", strtonum("0x" $1)), sprintf("%4d", strtonum("0x" $2)), sprintf("%4d", strtonum("0x" $3)) }'
set -x
fi
if [[ "$p" =~ .*lcd-brightness$ ]]; then
set +x
echo -e "PWM BRIGHTNESS TABLE:\n acc bat"; cat patches/$p.rapatch | cut -d" " -f2 | sed "s/.\{4\}/&\n/g" | head -n -1 | sed "s/\([0-9a-f][0-9a-f]\)/\1 /g" | awk '{ print sprintf("%4d%", strtonum("0x" $1)), sprintf("%4d%", strtonum("0x" $2)) }'
set -x
fi
r2 -w -q -P "$fn" ec.bin || true # see https://github.com/radare/radare2/issues/15002
done