X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fhameg-hmo%2Fapi.c;h=1b36f04e396e126819fbbeb2ba3d79da221c2373;hb=9cfc695ffe5f04622f61acb98ea4ac91c3f4ffc3;hp=f1c271c895619c641768147354b9f87f7ca8a2c2;hpb=5a1afc0907abfee5848484f944789213d6be9752;p=libsigrok.git
diff --git a/src/hardware/hameg-hmo/api.c b/src/hardware/hameg-hmo/api.c
index f1c271c8..1b36f04e 100644
--- a/src/hardware/hameg-hmo/api.c
+++ b/src/hardware/hameg-hmo/api.c
@@ -17,6 +17,7 @@
* along with this program. If not, see .
*/
+#include
#include
#include "scpi.h"
#include "protocol.h"
@@ -54,7 +55,7 @@ static int check_manufacturer(const char *manufacturer)
{
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(manufacturers); ++i)
+ for (i = 0; i < ARRAY_SIZE(manufacturers); i++)
if (!strcmp(manufacturer, manufacturers[i]))
return SR_OK;
@@ -80,7 +81,6 @@ static struct sr_dev_inst *hmo_probe_serial_device(struct sr_scpi_dev_inst *scpi
goto fail;
sdi = g_malloc0(sizeof(struct sr_dev_inst));
- sdi->status = SR_ST_ACTIVE;
sdi->vendor = g_strdup(hw_info->manufacturer);
sdi->model = g_strdup(hw_info->model);
sdi->version = g_strdup(hw_info->firmware_version);
@@ -99,10 +99,6 @@ static struct sr_dev_inst *hmo_probe_serial_device(struct sr_scpi_dev_inst *scpi
if (hmo_init_device(sdi) != SR_OK)
goto fail;
- sr_scpi_close(sdi->conn);
-
- sdi->status = SR_ST_INACTIVE;
-
return sdi;
fail:
@@ -187,11 +183,11 @@ static int check_channel_group(struct dev_context *devc,
if (!cg)
return CG_NONE;
- for (i = 0; i < model->analog_channels; ++i)
+ for (i = 0; i < model->analog_channels; i++)
if (cg == devc->analog_groups[i])
return CG_ANALOG;
- for (i = 0; i < model->digital_pods; ++i)
+ for (i = 0; i < model->digital_pods; i++)
if (cg == devc->digital_groups[i])
return CG_DIGITAL;
@@ -234,7 +230,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
sr_err("No channel group specified.");
return SR_ERR_CHANNEL_GROUP;
} else if (cg_type == CG_ANALOG) {
- for (i = 0; i < model->analog_channels; ++i) {
+ for (i = 0; i < model->analog_channels; i++) {
if (cg != devc->analog_groups[i])
continue;
*data = g_variant_new_int32(model->num_ydivs);
@@ -251,7 +247,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
sr_err("No channel group specified.");
return SR_ERR_CHANNEL_GROUP;
} else if (cg_type == CG_ANALOG) {
- for (i = 0; i < model->analog_channels; ++i) {
+ for (i = 0; i < model->analog_channels; i++) {
if (cg != devc->analog_groups[i])
continue;
*data = g_variant_new("(tt)",
@@ -282,7 +278,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
sr_err("No channel group specified.");
return SR_ERR_CHANNEL_GROUP;
} else if (cg_type == CG_ANALOG) {
- for (i = 0; i < model->analog_channels; ++i) {
+ for (i = 0; i < model->analog_channels; i++) {
if (cg != devc->analog_groups[i])
continue;
*data = g_variant_new_string((*model->coupling_options)[state->analog_channels[i].coupling]);
@@ -381,7 +377,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
if (p != (*model->vdivs)[i][0] ||
q != (*model->vdivs)[i][1])
continue;
- for (j = 1; j <= model->analog_channels; ++j) {
+ for (j = 1; j <= model->analog_channels; j++) {
if (cg != devc->analog_groups[j - 1])
continue;
state->analog_channels[j - 1].vdiv = i;
@@ -463,7 +459,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
for (i = 0; (*model->coupling_options)[i]; i++) {
if (strcmp(tmp, (*model->coupling_options)[i]) != 0)
continue;
- for (j = 1; j <= model->analog_channels; ++j) {
+ for (j = 1; j <= model->analog_channels; j++) {
if (cg != devc->analog_groups[j - 1])
continue;
state->analog_channels[j-1].coupling = i;
@@ -693,7 +689,7 @@ static int hmo_setup_channels(const struct sr_dev_inst *sdi)
}
}
- for (i = 1; i <= model->digital_pods; ++i) {
+ for (i = 1; i <= model->digital_pods; i++) {
if (state->digital_pods[i - 1] == pod_enabled[i - 1])
continue;
g_snprintf(command, sizeof(command),