ref: 3b769173dbfe2dfb548e432499cfe86c3a349bd8
parent: e05630b951b3997d32c02a5c641de5cfad17d110
author: Matthew Veety <mveety@gmail.com>
date: Thu Dec 12 21:20:29 EST 2013
Added in /dev/cputemp for bcm kernel (Thanks Krystian!)
--- a/sys/src/9/bcm/devarch.c
+++ b/sys/src/9/bcm/devarch.c
@@ -156,8 +156,17 @@
return readstr(offset, a, n, str);
}
+static long
+cputempread(Chan*, void *a, long n, vlong offset)
+{+ char str[128];
+ snprint(str, sizeof str, "%d±%d\n", gettemp(0) / 1000, 1);
+ return readstr(offset, a, n, str);
+}
+
void
archinit(void)
{ addarchfile("cputype", 0444, cputyperead, nil);+ addarchfile("cputemp", 0444, cputempread, nil);}
--- a/sys/src/9/bcm/vcore.c
+++ b/sys/src/9/bcm/vcore.c
@@ -288,3 +288,14 @@
return 0;
return buf[1];
}
+
+uint
+gettemp(int tempid)
+{+ u32int buf[2];
+ buf[0] = tempid;
+ if(vcreq(0x00030006, buf, sizeof(buf[0]), sizeof(buf)) != sizeof buf)
+ return 0;
+
+ return buf[1];
+}
--
⑨