-
-
Save dmitriysafronov/bc6784fe1a7318e611cd36458277c7d8 to your computer and use it in GitHub Desktop.
Linux Lenovo Legion 82K6 Fn+Q Power Mode Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ACPI_BALANCE="\_SB_.PC00.LPCB.EC0_.VPC0.DYTC 0x000FB001" | |
ACPI_POWER="\_SB_.PC00.LPCB.EC0_.VPC0.DYTC 0x0012B001" | |
ACPI_ECO="\_SB_.PC00.LPCB.EC0_.VPC0.DYTC 0x0013B001" | |
ACPI_MODE="\_SB_.PC00.LPCB.EC0_.SPMO" | |
MODE=$(sudo sh -c "echo '$ACPI_MODE' > /proc/acpi/call; tr -d '\0' < /proc/acpi/call") | |
MODE=${MODE:2} | |
TARGET=$(((MODE+1)%3)) | |
case $TARGET in | |
0) | |
sudo sh -c "echo '$ACPI_BALANCE'> /proc/acpi/call; cat /proc/acpi/call; printf '\n'" | |
notify-send "Power Mode" "Intelligent Cooling" | |
;; | |
1) | |
sudo sh -c "echo '$ACPI_POWER' > /proc/acpi/call; cat /proc/acpi/call; printf '\n'" | |
notify-send "Power Mode" "Extreme Performance" | |
;; | |
2) | |
sudo sh -c "echo '$ACPI_ECO' > /proc/acpi/call; cat /proc/acpi/call; printf '\n'" | |
notify-send "Power Mode" "Battery Saving " | |
;; | |
esac |
This is nice, thank you!
…On Wed, 29 Mar 2023 at 12:13, Dmitriy Safronov ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
@logical-and <https://github.com/logical-and> example:
✔ 13:12:30 ~ [master ✔] $ sudo dmesg | grep '_SB_.PC00.LPCB.EC0_'
[ 0.282919] ACPI: \_SB_.PC00.LPCB.EC0_: Boot DSDT EC used to handle transactions
[ 0.568080] ACPI: \_SB_.PC00.LPCB.EC0_: Boot DSDT EC initialization complete
[ 0.568081] ACPI: \_SB_.PC00.LPCB.EC0_: EC: Used to handle transactions and events
✔ 13:12:39 ~ [master ✔] $ sudo dmesg | grep '_SB_.PC00.LPCB'
[ 0.282919] ACPI: \_SB_.PC00.LPCB.EC0_: Boot DSDT EC used to handle transactions
[ 0.568080] ACPI: \_SB_.PC00.LPCB.EC0_: Boot DSDT EC initialization complete
[ 0.568081] ACPI: \_SB_.PC00.LPCB.EC0_: EC: Used to handle transactions and events
✔ 13:12:46 ~ [master ✔] $ sudo dmesg | grep '_SB_.PC00'
[ 0.282919] ACPI: \_SB_.PC00.LPCB.EC0_: Boot DSDT EC used to handle transactions
[ 0.287705] ACPI: \_SB_.PC00.PEG1.PG01: New power resource
[ 0.312844] ACPI: \_SB_.PC00.XHCI.RHUB.HS14.BTRT: New power resource
[ 0.319143] ACPI: \_SB_.PC00.SAT0.VOL0.V0PR: New power resource
[ 0.319223] ACPI: \_SB_.PC00.SAT0.VOL1.V1PR: New power resource
[ 0.319298] ACPI: \_SB_.PC00.SAT0.VOL2.V2PR: New power resource
[ 0.322143] ACPI: \_SB_.PC00.CNVW.WRST: New power resource
[ 0.322313] ACPI: \_SB_.PC00.TBT0: New power resource
[ 0.322351] ACPI: \_SB_.PC00.TBT1: New power resource
[ 0.322383] ACPI: \_SB_.PC00.D3C_: New power resource
[ 0.568080] ACPI: \_SB_.PC00.LPCB.EC0_: Boot DSDT EC initialization complete
[ 0.568081] ACPI: \_SB_.PC00.LPCB.EC0_: EC: Used to handle transactions and events
✔ 13:12:49 ~ [master ✔] $ sudo dmesg | grep '_SB_'
[ 0.219630] ACPI: \_SB_.PR00: _OSC native thermal LVT Acked
[ 0.282919] ACPI: \_SB_.PC00.LPCB.EC0_: Boot DSDT EC used to handle transactions
[ 0.287705] ACPI: \_SB_.PC00.PEG1.PG01: New power resource
[ 0.312844] ACPI: \_SB_.PC00.XHCI.RHUB.HS14.BTRT: New power resource
[ 0.319143] ACPI: \_SB_.PC00.SAT0.VOL0.V0PR: New power resource
[ 0.319223] ACPI: \_SB_.PC00.SAT0.VOL1.V1PR: New power resource
[ 0.319298] ACPI: \_SB_.PC00.SAT0.VOL2.V2PR: New power resource
[ 0.322143] ACPI: \_SB_.PC00.CNVW.WRST: New power resource
[ 0.322313] ACPI: \_SB_.PC00.TBT0: New power resource
[ 0.322351] ACPI: \_SB_.PC00.TBT1: New power resource
[ 0.322383] ACPI: \_SB_.PC00.D3C_: New power resource
[ 0.568080] ACPI: \_SB_.PC00.LPCB.EC0_: Boot DSDT EC initialization complete
[ 0.568081] ACPI: \_SB_.PC00.LPCB.EC0_: EC: Used to handle transactions and events
[ 0.615287] ACPI: \_SB_.PR00: Found 3 idle states
✔ 13:12:54 ~ [master ✔] $
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/DmitriySafronov/bc6784fe1a7318e611cd36458277c7d8#gistcomment-4519473>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKWRZK7CAY4IXWCCD75CDDW6P4NBBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTEMBRGQYDQMRYU52HE2LHM5SXFJTDOJSWC5DF>
.
You are receiving this email because you were mentioned.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@logical-and example: