Date: Wed, 6 Mar 2013 15:30:27 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 222669 for review Message-ID: <201303061530.r26FURoT030252@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@222669?ac=10 Change 222669 by rwatson@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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303061530.r26FURoT030252>