]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/manson-hcs-3xxx/api.c
lecroy-xstream: fix several compiler warnings (assignment, memory)
[libsigrok.git] / src / hardware / manson-hcs-3xxx / api.c
index 6eaef2d025a0806df1c72a70dcbe65b3d45e6fbb..92240cea30dc78251f86c6b7dd7516f8c3a609c4 100644 (file)
@@ -53,6 +53,7 @@ static const struct hcs_model models[] = {
        { MANSON_HCS_3300, "HCS-3300-USB", "3300", { 1, 16, 0.1 }, { 0, 30,   0.10 } },
        { MANSON_HCS_3302, "HCS-3302-USB", "3302", { 1, 32, 0.1 }, { 0, 15,   0.10 } },
        { MANSON_HCS_3304, "HCS-3304-USB", "3304", { 1, 60, 0.1 }, { 0,  8,   0.10 } },
+       { MANSON_HCS_3304, "HCS-3304-USB", "HCS-3304", { 1, 60, 0.1 }, { 0,  8,   0.10 } },
        { MANSON_HCS_3400, "HCS-3400-USB", "3400", { 1, 16, 0.1 }, { 0, 40,   0.10 } },
        { MANSON_HCS_3402, "HCS-3402-USB", "3402", { 1, 32, 0.1 }, { 0, 20,   0.10 } },
        { MANSON_HCS_3404, "HCS-3404-USB", "3404", { 1, 60, 0.1 }, { 0, 10,   0.10 } },
@@ -172,8 +173,8 @@ exit_err:
        return NULL;
 }
 
-static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
-               const struct sr_channel_group *cg)
+static int config_get(uint32_t key, GVariant **data,
+       const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
 
@@ -210,8 +211,8 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
        return SR_OK;
 }
 
-static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
-               const struct sr_channel_group *cg)
+static int config_set(uint32_t key, GVariant *data,
+       const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
        gboolean bval;
@@ -249,11 +250,15 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
                break;
        case SR_CONF_ENABLED:
                bval = g_variant_get_boolean(data);
-               if (bval == devc->output_enabled) /* Nothing to do. */
-                       break;
-               if ((hcs_send_cmd(sdi->conn, "SOUT%1d\r", !bval) < 0) ||
-                   (hcs_read_reply(sdi->conn, 1, devc->buf, sizeof(devc->buf)) < 0))
+
+               if (hcs_send_cmd(sdi->conn, "SOUT%1d\r", !bval) < 0) {
+                       sr_err("Could not send SR_CONF_ENABLED command.");
                        return SR_ERR;
+               }
+               if (hcs_read_reply(sdi->conn, 1, devc->buf, sizeof(devc->buf)) < 0) {
+                       sr_err("Could not read SR_CONF_ENABLED reply.");
+                       return SR_ERR;
+               }
                devc->output_enabled = bval;
                break;
        default:
@@ -263,8 +268,8 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        return SR_OK;
 }
 
-static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
-               const struct sr_channel_group *cg)
+static int config_list(uint32_t key, GVariant **data,
+       const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
        const double *a;
        struct dev_context *devc;