mirror of
git://git.9front.org/plan9front/plan9front
synced 2025-01-12 11:10:06 +00:00
aux/acpi: -H is for HALT
add -H option for acpi that halts immediately, skipping enumeration of the battery, temperature, etc.
This commit is contained in:
parent
4526b1a5dd
commit
ace62a81f4
2 changed files with 22 additions and 5 deletions
|
@ -7,6 +7,9 @@ acpi \- Advanced Configuration and Power Interface
|
|||
.PP
|
||||
.B aux/acpi
|
||||
[
|
||||
.B -H
|
||||
]
|
||||
[
|
||||
.B -m
|
||||
.I mountpoint
|
||||
]
|
||||
|
@ -27,6 +30,12 @@ posted at
|
|||
.BI /srv/ service
|
||||
as well.
|
||||
.PP
|
||||
With the
|
||||
.B -H
|
||||
option,
|
||||
.I aux/acpi
|
||||
will turn off the power immediately.
|
||||
.PP
|
||||
The directory contains the following files.
|
||||
.TP
|
||||
.B battery
|
||||
|
@ -57,7 +66,7 @@ will turn off the power.
|
|||
.SH SOURCE
|
||||
.B /sys/src/cmd/aux/acpi.c
|
||||
.SH SEE ALSO
|
||||
.IR imx8pm (8)
|
||||
.IR reform (1)
|
||||
.SH BUGS
|
||||
ACPI itself.
|
||||
.SH HISTORY
|
||||
|
|
|
@ -293,7 +293,7 @@ amlwrite(Amlio *io, int addr, int wid, uvlong v)
|
|||
(*io->write)(io, b, 1<<(wid-1), addr);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
poweroff(void)
|
||||
{
|
||||
int n;
|
||||
|
@ -302,7 +302,7 @@ poweroff(void)
|
|||
|
||||
if(facp.ok == 0){
|
||||
werrstr("no FACP");
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
wirecpu0();
|
||||
|
@ -362,6 +362,7 @@ poweroff(void)
|
|||
sleep(100);
|
||||
|
||||
werrstr("acpi failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -420,7 +421,7 @@ fswrite(Req *r)
|
|||
static void
|
||||
usage(void)
|
||||
{
|
||||
fprint(2, "usage: aux/acpi [-Dp] [-m mountpoint] [-s service]\n");
|
||||
fprint(2, "usage: aux/acpi [-DHp] [-m mountpoint] [-s service]\n");
|
||||
exits("usage");
|
||||
}
|
||||
|
||||
|
@ -436,11 +437,12 @@ threadmain(int argc, char **argv)
|
|||
{
|
||||
char *mtpt, *srv;
|
||||
void *r, **rr;
|
||||
int fd, n, l;
|
||||
int fd, n, l, halt;
|
||||
Tbl *t;
|
||||
|
||||
mtpt = "/dev";
|
||||
srv = nil;
|
||||
halt = 0;
|
||||
ARGBEGIN{
|
||||
case 'D':
|
||||
chatty9p = 1;
|
||||
|
@ -454,6 +456,9 @@ threadmain(int argc, char **argv)
|
|||
case 'p':
|
||||
amldebug++;
|
||||
break;
|
||||
case 'H':
|
||||
halt = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}ARGEND
|
||||
|
@ -550,6 +555,9 @@ threadmain(int argc, char **argv)
|
|||
}
|
||||
close(fd);
|
||||
|
||||
if(halt && poweroff() < 0)
|
||||
sysfatal("%r");
|
||||
|
||||
amlenum(amlroot, "_HID", enumec, nil);
|
||||
amlenum(amlroot, "_BIF", enumbat, nil);
|
||||
amlenum(amlroot, "_PSL", enumtmp, nil);
|
||||
|
|
Loading…
Reference in a new issue