aux/acpi: write a man page, fix usage, call threadexits

This commit is contained in:
Sigrid 2020-07-30 11:25:14 +02:00
parent 02f19713a1
commit edb6f64d35
3 changed files with 67 additions and 2 deletions

61
sys/man/8/acpi Normal file
View file

@ -0,0 +1,61 @@
.TH ACPI 8
.SH NAME
acpi \- Advanced Configuration and Power Interface
.SH SYNOPSIS
.I (in plan9.ini)
.B *acpi=
.PP
.B aux/acpi
[
.B -m
.I mountpoint
]
[
.B -s
.I service
]
.SH DESCRIPTION
.I Aux/acpi
presents at
.I mountpoint
(default
.BR /mnt/acpi )
an interface to the ACPI. If a
.I service
is specified, the interface will be
posted at
.BI /srv/ service
as well.
.PP
The directory contains the following files.
.TP
.B battery
Contains one line for each battery in the system. Each line lists 12
fields: the percent charge remaining, power unit used (mW or mA),
remaining capacity, last full charge capacity, design capacity,
warning and low capacity values,
.BR "mV"
separator, present voltage, design voltage, approximate time of charge
left as
.BR hh:mm:ss ,
and the status (a string, one of
.BR unknown ,
.BR critical ,
.BR discharging
or
.BR charging ).
.TP
.B cputemp
Each line provides a current temperature reading of a specific CPU.
.TP
.B ctl
The
.B ctl
file currently does not provide any functionality.
.SH SOURCE
.B /sys/src/cmd/aux/acpi.c
.SH BUGS
ACPI itself.
.SH HISTORY
.I Acpi
first appeared in 9front (October, 2016).

View file

@ -110,3 +110,5 @@ and
.B off
should be supported but doing so requires
nontrivial help from the kernel.
.SH "SEE ALSO"
.IR acpi (8)

View file

@ -417,7 +417,7 @@ fsattach(Req *r)
static void
usage(void)
{
fprint(2, "usage: aux/acpi [-D] [-d /dev] [-m /mnt/acpi] [-s service]\n");
fprint(2, "usage: aux/acpi [-Dp] [-m /mnt/acpi] [-s service]\n");
exits("usage");
}
@ -454,6 +454,8 @@ threadmain(int argc, char **argv)
case 's':
srv = EARGF(usage());
break;
default:
usage();
}ARGEND
if((ec = open("/dev/ec", ORDWR)) < 0)
@ -500,7 +502,7 @@ threadmain(int argc, char **argv)
amlenum(amlroot, "_PSL", enumtmp, nil);
threadpostmountsrv(&fs, srv, mtpt, MREPL);
return;
threadexits(nil);
fail:
fprint(2, "%r\n");