]> sigrok.org Git - libsigrok.git/commitdiff
baylibre-acme: Check for power-switch presence at probe's initialization.
authorBartosz Golaszewski <redacted>
Wed, 16 Sep 2015 11:30:54 +0000 (13:30 +0200)
committerUwe Hermann <redacted>
Fri, 18 Sep 2015 17:52:38 +0000 (19:52 +0200)
Only perform a single check at initialization time to see if the probe is
equipped with a power-switch. This is done in preparation for revision B
support which has this kind of information encoded in EEPROM.

Signed-off-by: Bartosz Golaszewski <redacted>
src/hardware/baylibre-acme/protocol.c

index 413a057684da9cd50160f1623b40b68d215eb018..4b4d5e4e6575e5b26390d0e8b8f0694a89e3682c 100644 (file)
@@ -38,6 +38,7 @@ struct channel_group_priv {
        int hwmon_num;
        int probe_type;
        int index;
+       int has_pws;
 };
 
 struct channel_priv {
@@ -237,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;
 
@@ -267,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;
 }
 
 /*