X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Farachnid-labs-re-load-pro%2Fapi.c;h=c14c20d400d05db58c3c55b32680f91893666b8e;hb=0523befd4214cd8e0e6dcc61a8ed19e6d66377e4;hp=17cf45ee75b86152746e04570f72533ae3f7bcc3;hpb=b3e715e528aa41e14100e3b5aae73248a34ab335;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 17cf45ee..c14c20d4 100644 --- a/src/hardware/arachnid-labs-re-load-pro/api.c +++ b/src/hardware/arachnid-labs-re-load-pro/api.c @@ -99,8 +99,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) if (serial_open(serial, SERIAL_RDWR) != SR_OK) return NULL; - serial_flush(serial); - /* * First stop potentially running monitoring and wait for 50ms before * next command can be sent. @@ -148,14 +146,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sdi->inst_type = SR_INST_SERIAL; sdi->conn = serial; - cg = g_malloc0(sizeof(struct sr_channel_group)); - cg->name = g_strdup("1"); - sdi->channel_groups = g_slist_append(sdi->channel_groups, cg); + cg = sr_channel_group_new(sdi, "1", NULL); ch = sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "V"); cg->channels = g_slist_append(cg->channels, ch); - ch = sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "I"); + ch = sr_channel_new(sdi, 1, SR_CHANNEL_ANALOG, TRUE, "I"); cg->channels = g_slist_append(cg->channels, ch); devc = g_malloc0(sizeof(struct dev_context)); @@ -247,12 +243,8 @@ static int config_get(uint32_t key, GVariant **data, *data = g_variant_new_boolean(devc->otp_active); break; case SR_CONF_UNDER_VOLTAGE_CONDITION: - if (reloadpro_get_under_voltage_threshold(sdi, &fvalue) == SR_OK) { - if (fvalue == .0) - *data = g_variant_new_boolean(FALSE); - else - *data = g_variant_new_boolean(TRUE); - } + if (reloadpro_get_under_voltage_threshold(sdi, &fvalue) == SR_OK) + *data = g_variant_new_boolean(fvalue != 0.0); break; case SR_CONF_UNDER_VOLTAGE_CONDITION_ACTIVE: *data = g_variant_new_boolean(devc->uvc_active); @@ -351,7 +343,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) g_mutex_clear(&devc->acquisition_mutex); return ret; - } static struct sr_dev_driver arachnid_labs_re_load_pro_driver_info = {