agilent-dmm: no need to specify a serialcomm scan parameter

It's always 9600/8n1 anyway.
This commit is contained in:
Bert Vermeulen 2012-11-07 00:46:30 +01:00
parent 33e8a3c525
commit 74ac7d7f73
3 changed files with 16 additions and 12 deletions

View 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;
};

View 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;

View 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;