X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Farachnid-labs-re-load-pro%2Fapi.c;h=3686b34854148fdd0243ad1fde405823c5c7f94f;hb=6525d819eef098a43b1f438ae4af50e67c9c4335;hp=dde8166365333c51e3e067933fac377e7b24f2d1;hpb=8501448cfe508de842c0e2206232a7a832837294;p=libsigrok.git diff --git a/src/hardware/arachnid-labs-re-load-pro/api.c b/src/hardware/arachnid-labs-re-load-pro/api.c index dde81663..3686b348 100644 --- a/src/hardware/arachnid-labs-re-load-pro/api.c +++ b/src/hardware/arachnid-labs-re-load-pro/api.c @@ -52,6 +52,8 @@ static const uint32_t devopts_cg[] = { SR_CONF_OVER_CURRENT_PROTECTION_ENABLED | SR_CONF_GET, SR_CONF_OVER_TEMPERATURE_PROTECTION | SR_CONF_GET, SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE | SR_CONF_GET, + SR_CONF_UNDER_VOLTAGE_CONDITION | SR_CONF_GET, + SR_CONF_UNDER_VOLTAGE_CONDITION_ACTIVE | SR_CONF_GET, }; SR_PRIV struct sr_dev_driver arachnid_labs_re_load_pro_driver_info; @@ -75,6 +77,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) const char *conn, *serialcomm; char buf[100]; char *bufptr; + double version; devices = NULL; drvc = di->context; @@ -123,6 +126,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) return NULL; } + version = g_ascii_strtod(buf + 8, NULL); + if (version < 1.10) { + sr_info("Firmware >= 1.10 required (got %1.2f).", version); + serial_close(serial); + return NULL; + } + sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_ACTIVE; sdi->vendor = g_strdup("Arachnid Labs"); @@ -282,6 +292,12 @@ static int config_get(uint32_t key, GVariant **data, case SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE: *data = g_variant_new_boolean(devc->otp_active); break; + case SR_CONF_UNDER_VOLTAGE_CONDITION: + *data = g_variant_new_boolean(TRUE); /* Always on. */ + break; + case SR_CONF_UNDER_VOLTAGE_CONDITION_ACTIVE: + *data = g_variant_new_boolean(devc->uvc_active); + break; default: return SR_ERR_NA; } @@ -324,19 +340,16 @@ static int config_set(uint32_t key, GVariant *data, return ret; } -static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) +static int dev_acquisition_start(const struct sr_dev_inst *sdi) { int ret; struct dev_context *devc; struct sr_serial_dev_inst *serial; - (void)cb_data; - if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; devc = sdi->priv; - serial = sdi->conn; /* Send the 'monitor ' command (doesn't have a reply). */ @@ -351,7 +364,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) serial_source_add(sdi->session, serial, G_IO_IN, 100, reloadpro_receive_data, (void *)sdi); - std_session_send_df_header(cb_data, LOG_PREFIX); + std_session_send_df_header(sdi, LOG_PREFIX); memset(devc->buf, 0, RELOADPRO_BUFSIZE); devc->buflen = 0; @@ -361,9 +374,9 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) return SR_OK; } -static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) +static int dev_acquisition_stop(struct sr_dev_inst *sdi) { - return std_serial_dev_acquisition_stop(sdi, cb_data, + return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close, sdi->conn, LOG_PREFIX); }