]> sigrok.org Git - libsigrok.git/commitdiff
agilent-dmm: no need to specify a serialcomm scan parameter
authorBert Vermeulen <redacted>
Tue, 6 Nov 2012 23:46:30 +0000 (00:46 +0100)
committerBert Vermeulen <redacted>
Tue, 6 Nov 2012 23:46:30 +0000 (00:46 +0100)
It's always 9600/8n1 anyway.

hardware/agilent-dmm/agilent-dmm.h
hardware/agilent-dmm/api.c
hardware/agilent-dmm/sched.c

index b2b6ba3ba98cb25e1a99512110695bc6b5635720..d7bdbd31743453e62871beafef63cb6117a2cf04 100644 (file)
@@ -46,7 +46,6 @@ enum {
 struct agdmm_profile {
        int model;
        const char *modelname;
-       int serial_speed;
        const struct agdmm_job *jobs;
        const struct agdmm_recv *recvs;
 };
index 848e2dcf6b574db62eeb0d8a6dcc9d8f8c16133e..ddc22ee9f9d428d2ac343a063308957c3d03cfc9 100644 (file)
@@ -51,14 +51,18 @@ extern const struct agdmm_recv agdmm_recvs_u123x[];
 extern const struct agdmm_job agdmm_jobs_u125x[];
 extern const struct agdmm_recv agdmm_recvs_u125x[];
 
+/* This works on all the Agilent U12xxA series, although the
+ * U127xA can apparently also run at 19200/8n1. */
+#define SERIALCOMM "9600/8n1"
+
 static const struct agdmm_profile supported_agdmm[] = {
-       { AGILENT_U1231A, "U1231A", 9600, agdmm_jobs_u123x, agdmm_recvs_u123x },
-       { AGILENT_U1232A, "U1232A", 9600, agdmm_jobs_u123x, agdmm_recvs_u123x },
-       { AGILENT_U1233A, "U1233A", 9600, agdmm_jobs_u123x, agdmm_recvs_u123x },
-       { AGILENT_U1251A, "U1251A", 9600, agdmm_jobs_u125x, agdmm_recvs_u125x },
-       { AGILENT_U1252A, "U1252A", 9600, agdmm_jobs_u125x, agdmm_recvs_u125x },
-       { AGILENT_U1253A, "U1253A", 9600, agdmm_jobs_u125x, agdmm_recvs_u125x },
-       { 0, NULL, 0, NULL, NULL }
+       { AGILENT_U1231A, "U1231A", agdmm_jobs_u123x, agdmm_recvs_u123x },
+       { AGILENT_U1232A, "U1232A", agdmm_jobs_u123x, agdmm_recvs_u123x },
+       { AGILENT_U1233A, "U1233A", agdmm_jobs_u123x, agdmm_recvs_u123x },
+       { AGILENT_U1251A, "U1251A", agdmm_jobs_u125x, agdmm_recvs_u125x },
+       { AGILENT_U1252A, "U1252A", agdmm_jobs_u125x, agdmm_recvs_u125x },
+       { AGILENT_U1253A, "U1253A", agdmm_jobs_u125x, agdmm_recvs_u125x },
+       { 0, NULL, NULL, NULL }
 };
 
 SR_PRIV struct sr_dev_driver agdmm_driver_info;
@@ -174,7 +178,7 @@ static GSList *hw_scan(GSList *options)
                        break;
                }
        }
-       if (!conn || !serialcomm)
+       if (!conn)
                return NULL;
 
        if ((fd = serial_open(conn, O_RDWR|O_NONBLOCK)) == -1) {
@@ -182,6 +186,8 @@ static GSList *hw_scan(GSList *options)
                return NULL;
        }
 
+       if (!serialcomm)
+               serialcomm = SERIALCOMM;
        if (serial_set_paramstr(fd, serialcomm) != SR_OK) {
                sr_err("Unable to set serial parameters: %s.",
                       strerror(errno));
@@ -262,8 +268,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
                       devc->serial->port);
                return SR_ERR;
        }
-       serial_set_params(devc->serial->fd, devc->profile->serial_speed, 8,
-                       SERIAL_PARITY_NONE, 1, 0);
+       serial_set_paramstr(devc->serial->fd, SERIALCOMM);
        sdi->status = SR_ST_ACTIVE;
 
        return SR_OK;
index 5ae73aca1824796871cd92999bf15b530113fc9d..56e768dbc0ebfac1270c38b4647a755228794815 100644 (file)
@@ -241,7 +241,7 @@ static int recv_fetc(const struct sr_dev_inst *sdi, GMatchInfo *match)
                return SR_OK;
 
        if (!strcmp(g_match_info_get_string(match), "+9.90000000E+37")) {
-               /* An invalid measurement shows up on the display as "O.L, but
+               /* An invalid measurement shows up on the display as "O.L", but
                 * comes through like this. Since comparing 38-digit floats
                 * is rather problematic, we'll cut through this here. */
                fvalue = NAN;