X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhardware%2Fbaylibre-acme%2Fprotocol.c;h=4b4d5e4e6575e5b26390d0e8b8f0694a89e3682c;hb=8f1961209b399eb29933168e8126e59b5943f854;hp=a50c221993bd31852a57bd5ddac404c14fcea41e;hpb=7237e91262251a138cf150f9fcfe7b05d0e5904b;p=libsigrok.git
diff --git a/src/hardware/baylibre-acme/protocol.c b/src/hardware/baylibre-acme/protocol.c
index a50c2219..4b4d5e4e 100644
--- a/src/hardware/baylibre-acme/protocol.c
+++ b/src/hardware/baylibre-acme/protocol.c
@@ -17,6 +17,7 @@
* along with this program. If not, see .
*/
+#include
#include
#include
#include
@@ -25,10 +26,19 @@
#include "protocol.h"
#include "gpio.h"
+enum channel_type {
+ ENRG_PWR = 1,
+ ENRG_CURR,
+ ENRG_VOL,
+ TEMP_IN,
+ TEMP_OUT,
+};
+
struct channel_group_priv {
int hwmon_num;
int probe_type;
int index;
+ int has_pws;
};
struct channel_priv {
@@ -228,6 +238,7 @@ SR_PRIV gboolean bl_acme_register_probe(struct sr_dev_inst *sdi, int type,
cgp->hwmon_num = hwmon;
cgp->probe_type = type;
cgp->index = prb_num - 1;
+ cgp->has_pws = sr_gpio_getval_export(pws_info_gpios[cgp->index]);
cg->name = g_strdup_printf("Probe_%d", prb_num);
cg->priv = cgp;
@@ -258,7 +269,7 @@ SR_PRIV int bl_acme_probe_has_pws(const struct sr_channel_group *cg)
{
struct channel_group_priv *cgp = cg->priv;
- return sr_gpio_getval_export(pws_info_gpios[cgp->index]);
+ return cgp->has_pws;
}
/*
@@ -507,7 +518,7 @@ static float read_sample(struct sr_channel *ch)
len = read(fd, buf, sizeof(buf));
if (len < 0) {
- sr_err("Error reading from channel %s (hwmon: %s): %s",
+ sr_err("Error reading from channel %s (hwmon: %d): %s",
ch->name, chp->probe->hwmon_num, g_strerror(errno));
ch->enabled = FALSE;
return -1.0;