diff options
author | Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> | 2022-10-07 15:19:11 +0000 |
---|---|---|
committer | Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> | 2022-10-07 15:19:11 +0000 |
commit | 29468e518a88ae285a527cf0295be7be8e9ca08a (patch) | |
tree | c51760a16b815054082cb754bd01daa28980b805 /sys/src | |
parent | 59d978eeb6d9f987d2c2b17d2799f3c15655284f (diff) |
reform/pm: power off via the keyboard first
Now that we have a way to send HID reports, attempt to
power off using the keyboard first, which should work
even if LPC firmware has not been updated.
It also animates a good bye message on the OLED ♥_♥
Diffstat (limited to 'sys/src')
-rw-r--r-- | sys/src/cmd/reform/pm.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/src/cmd/reform/pm.c b/sys/src/cmd/reform/pm.c index 3b12b140e..0561d0f0e 100644 --- a/sys/src/cmd/reform/pm.c +++ b/sys/src/cmd/reform/pm.c @@ -446,8 +446,16 @@ Bad: }else if(aux == (void*)Pmctl){ p = -1; if(nf >= 2 && strcmp(f[0], "power") == 0){ - if(nf == 2 && strcmp(f[1], "off") == 0) - p = Psomoff; + if(nf == 2 && strcmp(f[1], "off") == 0){ + /* + * LPC firmware might not be up to date so try + * shutting down through the keyboard first + */ + if((kbdhidfd = openkbdhid()) >= 0){ + write(kbdhidfd, "PWR0", 4); + sleep(2000); /* give it a chance */ + } + } } if(p < 0) goto Bad; |