blob: ace4503c0b4da587466b6a011f3a5d1f1ff6d2c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include <common.h>
#include <command.h>
#include <getopt.h>
#include <linux/err.h>
#include <linux/ctype.h>
#include <string.h>
#include <environment.h>
#include <aiodev.h>
static int do_hwmon(int argc, char *argv[])
{
int i;
struct aiodevice *aiodev;
for_each_aiodevice(aiodev) {
for (i = 0; i < aiodev->num_channels; i++) {
struct aiochannel *chan = aiodev->channels[i];
int value;
int ret = aiochannel_get_value(chan, &value);
if (!ret)
printf("%s: %d %s\n", chan->name, value, chan->unit);
else
printf("%s: failed to read (%d)\n", chan->name, ret);
}
}
return 0;
}
BAREBOX_CMD_START(hwmon)
.cmd = do_hwmon,
BAREBOX_CMD_DESC("query hardware sensors (HWMON)")
BAREBOX_CMD_GROUP(CMD_GRP_HWMANIP)
BAREBOX_CMD_END
|