shithub: riscv

Download patch

ref: 7b8c6ae432dafda5dcc36967b9c122fb547b4e55
parent: 1f3600c83fd0bd02a5db23f9be508baed743862d
author: ftrvxmtrx <ftrvxmtrx@gmail.com>
date: Mon Oct 24 19:51:16 EDT 2016

stats: alternatively read battery and temp from aux/acpi

--- a/sys/src/cmd/stats.c
+++ b/sys/src/cmd/stats.c
@@ -598,6 +598,10 @@
 
 	snprint(buf, sizeof buf, "%s/mnt/apm/battery", mpt);
 	m->batteryfd = open(buf, OREAD);
+	if(m->batteryfd < 0){
+		snprint(buf, sizeof buf, "%s/mnt/acpi/battery", mpt);
+		m->batteryfd = open(buf, OREAD);
+	}
 	m->bitsybatfd = -1;
 	if(m->batteryfd >= 0){
 		if(loadbuf(m, &m->batteryfd) && readnums(m, nelem(m->batterystats), a, 0))
@@ -610,6 +614,10 @@
 	}
 	snprint(buf, sizeof buf, "%s/dev/cputemp", mpt);
 	m->tempfd = open(buf, OREAD);
+	if(m->tempfd < 0){
+		snprint(buf, sizeof buf, "%s/mnt/acpi/cputemp", mpt);
+		m->tempfd = open(buf, OREAD);
+	}
 	if(loadbuf(m, &m->tempfd))
 		for(n=0; n < nelem(m->temp) && readnums(m, 2, a, 0); n++)
 			 m->temp[n] = a[0];