diff options
author | Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> | 2022-08-20 13:39:49 +0000 |
---|---|---|
committer | Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> | 2022-08-20 13:39:49 +0000 |
commit | 95206ac7e54cbc7a0c913c0ab73b509896ff27a5 (patch) | |
tree | 195dc163024bec38ef80e289959c4f8c2706e31a | |
parent | 0986cc7a9275c06ea337d04edf2092d0f3657a0d (diff) |
aux/imx8pm: add relative brightness setting (-+N), useful for key bindings
-rw-r--r-- | sys/man/8/imx8pm | 22 | ||||
-rw-r--r-- | sys/src/cmd/aux/imx8pm.c | 10 |
2 files changed, 25 insertions, 7 deletions
diff --git a/sys/man/8/imx8pm b/sys/man/8/imx8pm index 2b97cc14d..1c7630658 100644 --- a/sys/man/8/imx8pm +++ b/sys/man/8/imx8pm @@ -14,6 +14,11 @@ imx8pm \- power management for MNT Reform 2 .B -s .I service ] +.nf +.sp 0.3v +.B /mnt/pm/cputemp +.B /mnt/pm/ctl +.fi .SH DESCRIPTION .I Aux/imx8pm presents at @@ -26,13 +31,22 @@ is specified, the interface will be posted at .BI /srv/ service as well. .PP -The directory contains the following files. -.TP .B cputemp Exposes the current temperature reading of the CPU. -.TP +.PP +.B ctl +Provides a way to control the brightness of the built-in LCD by +writing +.IP +.I brightness [-+]N +.PP +.B N +is expressed in percentage, either as an absolute value (0-100) or +relative to the current brightness - by prefixing with a sign. +.PP +Reading .B ctl -Provides a way to control the brightness of the built-in LCD. +returns the current brightness. .SH SOURCE .B /sys/src/cmd/aux/imx8pm.c .SH SEE ALSO diff --git a/sys/src/cmd/aux/imx8pm.c b/sys/src/cmd/aux/imx8pm.c index 697d3c56a..edcd81bb7 100644 --- a/sys/src/cmd/aux/imx8pm.c +++ b/sys/src/cmd/aux/imx8pm.c @@ -174,7 +174,7 @@ static void fswrite(Req *r) { char msg[256], *f[4]; - int nf; + int nf, v; if(r->fid->file->aux == (void*)Ctl){ snprint(msg, sizeof(msg), "%.*s", @@ -184,8 +184,12 @@ fswrite(Req *r) respond(r, "invalid ctl message"); return; } - if(strcmp(f[0], "brightness") == 0) - setbrightness(atoi(f[1])); + if(strcmp(f[0], "brightness") == 0){ + v = atoi(f[1]); + if(*f[1] == '+' || *f[1] == '-') + v += getbrightness(); + setbrightness(v); + } } r->ofcall.count = r->ifcall.count; |