serial-dmm: fixup 'conn' vs 'serialcomm' confusion
The 'conn' field in the device context and the CONN values in the declarations of supported DMM models seemed inappropriate. They specify the communication parameters (UART frame format and bitrate), not the connection (port name). Adjust the respective identifiers. Also rephrase the evaluation logic. Instead of checking for the absence of user specs and optionally assigning a fallback value, just preset from defaults and override from user specs when present. This simplifies the logic (eliminates a check).
This commit is contained in:
parent
db3aac1a29
commit
09c650d5e9
|
@ -61,7 +61,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
|
||||
dmm = (struct dmm_info *)di;
|
||||
|
||||
conn = serialcomm = NULL;
|
||||
conn = NULL;
|
||||
serialcomm = dmm->serialcomm;
|
||||
for (l = options; l; l = l->next) {
|
||||
src = l->data;
|
||||
switch (src->key) {
|
||||
|
@ -76,9 +77,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
if (!conn)
|
||||
return NULL;
|
||||
|
||||
if (!serialcomm)
|
||||
serialcomm = dmm->conn;
|
||||
|
||||
serial = sr_serial_dev_inst_new(conn, serialcomm);
|
||||
|
||||
if (serial_open(serial, SERIAL_RDWR) != SR_OK)
|
||||
|
@ -196,7 +194,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
#define DMM(ID, CHIPSET, VENDOR, MODEL, CONN, PACKETSIZE, TIMEOUT, \
|
||||
#define DMM(ID, CHIPSET, VENDOR, MODEL, SERIALCOMM, PACKETSIZE, TIMEOUT, \
|
||||
DELAY, REQUEST, VALID, PARSE, DETAILS) \
|
||||
&((struct dmm_info) { \
|
||||
{ \
|
||||
|
@ -217,7 +215,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
|||
.dev_acquisition_stop = std_serial_dev_acquisition_stop, \
|
||||
.context = NULL, \
|
||||
}, \
|
||||
VENDOR, MODEL, CONN, PACKETSIZE, TIMEOUT, DELAY, \
|
||||
VENDOR, MODEL, SERIALCOMM, PACKETSIZE, TIMEOUT, DELAY, \
|
||||
REQUEST, 1, NULL, VALID, PARSE, DETAILS, sizeof(struct CHIPSET##_info) \
|
||||
}).di
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ struct dmm_info {
|
|||
const char *vendor;
|
||||
/** Model. */
|
||||
const char *device;
|
||||
/** serialconn string. */
|
||||
const char *conn;
|
||||
/** serialcomm string. */
|
||||
const char *serialcomm;
|
||||
/** Packet size in bytes. */
|
||||
int packet_size;
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue