PERFORCE change 222669 for review
Robert Watson
rwatson at FreeBSD.org
Wed Mar 6 15:30:27 UTC 2013
http://p4web.freebsd.org/@@222669?ac=10
Change 222669 by rwatson at rwatson_zenith_cl_cam_ac_uk on 2013/03/06 15:30:23
Fan/temperature-control device is little-endian, so byte swap as
needed.
Implement "-q" so that you can request just the numeric value
without a label.
Affected files ...
.. //depot/projects/ctsrd/beribsd/src/ctsrd/de4ctl/de4ctl.c#2 edit
Differences ...
==== //depot/projects/ctsrd/beribsd/src/ctsrd/de4ctl/de4ctl.c#2 (text+ko) ====
@@ -31,6 +31,7 @@
*/
#include <sys/types.h>
+#include <sys/endian.h>
#include <err.h>
#include <fcntl.h>
@@ -50,8 +51,7 @@
usage(void)
{
- fprintf(stderr, "usage: de4ctl temp\n");
- fprintf(stderr, "usage: de4ctl fan\n");
+ fprintf(stderr, "usage: de4ctl [-q] fan | temp\n");
exit(0);
}
@@ -71,7 +71,7 @@
err(1, "%s", PATH_TEMPFANCTL);
if (len != sizeof(temp))
errx(1, "%s: short read", PATH_TEMPFANCTL);
- printf("temp: %u\n", temp);
+ printf("%s%u\n", qflag ? "" : "temp:\t", le32toh(temp));
close(fd);
}
@@ -91,7 +91,7 @@
err(1, "%s", PATH_TEMPFANCTL);
if (len != sizeof(fan))
errx(1, "%s: short read", PATH_TEMPFANCTL);
- printf("fan: %u\n", fan);
+ printf("%s%u\n", qflag ? "" : "fan:\t", le32toh(fan));
close(fd);
}
More information about the p4-projects
mailing list