From: Bert Vermeulen Date: Tue, 6 Nov 2012 23:46:30 +0000 (+0100) Subject: agilent-dmm: no need to specify a serialcomm scan parameter X-Git-Tag: dsupstream~580 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=74ac7d7f735011012fb942577e38ddfe64738c8d;p=libsigrok.git agilent-dmm: no need to specify a serialcomm scan parameter It's always 9600/8n1 anyway. --- diff --git a/hardware/agilent-dmm/agilent-dmm.h b/hardware/agilent-dmm/agilent-dmm.h index b2b6ba3b..d7bdbd31 100644 --- a/hardware/agilent-dmm/agilent-dmm.h +++ b/hardware/agilent-dmm/agilent-dmm.h @@ -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; }; diff --git a/hardware/agilent-dmm/api.c b/hardware/agilent-dmm/api.c index 848e2dcf..ddc22ee9 100644 --- a/hardware/agilent-dmm/api.c +++ b/hardware/agilent-dmm/api.c @@ -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; diff --git a/hardware/agilent-dmm/sched.c b/hardware/agilent-dmm/sched.c index 5ae73aca..56e768db 100644 --- a/hardware/agilent-dmm/sched.c +++ b/hardware/agilent-dmm/sched.c @@ -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;