]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/gwinstek-gpd/api.c
scpi-pps: add R&S HMP2000 model specs
[libsigrok.git] / src / hardware / gwinstek-gpd / api.c
index 7406460623fe4d55d53542106c60f68629398e6d..aff3a7a2faf4d2885c05db94b513d64448a4ecf5 100644 (file)
@@ -60,6 +60,16 @@ static const struct gpd_model models[] = {
                        { { 0, 30, 0.001 }, { 0, 3, 0.001 } },
                },
        },
+       { GPD_3303S, "GPD-3303S",
+               CHANMODE_INDEPENDENT,
+               2,
+               {
+                       /* Channel 1 */
+                       { { 0, 32, 0.001 }, { 0, 3.2, 0.001 } },
+                       /* Channel 2 */
+                       { { 0, 32, 0.001 }, { 0, 3.2, 0.001 } },
+               },
+       },
 };
 
 static GSList *scan(struct sr_dev_driver *di, GSList *options)
@@ -72,7 +82,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        GSList *l;
        struct sr_serial_dev_inst *serial;
        struct sr_dev_inst *sdi;
-       char reply[50];
+       char reply[100];
        unsigned int i;
        struct dev_context *devc;
        char channel[10];
@@ -169,8 +179,16 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        if (sscanf(reply, "%1u%1u%1u%1u%1u%1u%1u%1u", &cc_cv_ch1,
                        &cc_cv_ch2, &track1, &track2, &beep,
                        &devc->output_enabled, &baud1, &baud2) != 8) {
-               sr_err("Invalid reply to STATUS: '%s'.", reply);
-               goto error;
+               /* old firmware (< 2.00?) responds with different format */
+               if (sscanf(reply, "%1u %1u %1u %1u %1u X %1u X", &cc_cv_ch1,
+                          &cc_cv_ch2, &track1, &track2, &beep,
+                          &devc->output_enabled) != 6) {
+                       sr_err("Invalid reply to STATUS: '%s'.", reply);
+                       goto error;
+               }
+               /* ignore remaining two lines of status message */
+               gpd_receive_reply(serial, reply, sizeof(reply));
+               gpd_receive_reply(serial, reply, sizeof(reply));
        }
 
        for (i = 0; i < model->num_channels; ++i) {
@@ -230,6 +248,9 @@ static int config_get(uint32_t key, GVariant **data,
 
        if (!cg) {
                switch (key) {
+               case SR_CONF_LIMIT_SAMPLES:
+               case SR_CONF_LIMIT_MSEC:
+                       return sr_sw_limits_config_get(&devc->limits, key, data);
                case SR_CONF_CHANNEL_CONFIG:
                        *data = g_variant_new_string(
                                channel_modes[devc->channel_mode]);