serial-dmm: add support for default connections (USB cables)
Some meters which are supported by the serial-dmm driver don't strictly require the user's COM port specification. When a known (usually bundled, or even builtin) cable type is used, we can provide a default conn= spec and thus improve usability. Prepare the DMM_CONN() macro, accept user overrides.
This commit is contained in:
parent
09c650d5e9
commit
0527cc3ad7
|
@ -61,7 +61,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
||||||
dmm = (struct dmm_info *)di;
|
dmm = (struct dmm_info *)di;
|
||||||
|
|
||||||
conn = NULL;
|
conn = dmm->conn;
|
||||||
serialcomm = dmm->serialcomm;
|
serialcomm = dmm->serialcomm;
|
||||||
for (l = options; l; l = l->next) {
|
for (l = options; l; l = l->next) {
|
||||||
src = l->data;
|
src = l->data;
|
||||||
|
@ -194,8 +194,9 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DMM(ID, CHIPSET, VENDOR, MODEL, SERIALCOMM, PACKETSIZE, TIMEOUT, \
|
#define DMM_CONN(ID, CHIPSET, VENDOR, MODEL, \
|
||||||
DELAY, REQUEST, VALID, PARSE, DETAILS) \
|
CONN, SERIALCOMM, PACKETSIZE, TIMEOUT, DELAY, \
|
||||||
|
REQUEST, VALID, PARSE, DETAILS) \
|
||||||
&((struct dmm_info) { \
|
&((struct dmm_info) { \
|
||||||
{ \
|
{ \
|
||||||
.name = ID, \
|
.name = ID, \
|
||||||
|
@ -215,10 +216,15 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
.dev_acquisition_stop = std_serial_dev_acquisition_stop, \
|
.dev_acquisition_stop = std_serial_dev_acquisition_stop, \
|
||||||
.context = NULL, \
|
.context = NULL, \
|
||||||
}, \
|
}, \
|
||||||
VENDOR, MODEL, SERIALCOMM, PACKETSIZE, TIMEOUT, DELAY, \
|
VENDOR, MODEL, CONN, SERIALCOMM, PACKETSIZE, TIMEOUT, DELAY, \
|
||||||
REQUEST, 1, NULL, VALID, PARSE, DETAILS, sizeof(struct CHIPSET##_info) \
|
REQUEST, 1, NULL, VALID, PARSE, DETAILS, sizeof(struct CHIPSET##_info) \
|
||||||
}).di
|
}).di
|
||||||
|
|
||||||
|
#define DMM(ID, CHIPSET, VENDOR, MODEL, SERIALCOMM, PACKETSIZE, TIMEOUT, \
|
||||||
|
DELAY, REQUEST, VALID, PARSE, DETAILS) \
|
||||||
|
DMM_CONN(ID, CHIPSET, VENDOR, MODEL, NULL, SERIALCOMM, PACKETSIZE, \
|
||||||
|
TIMEOUT, DELAY, REQUEST, VALID, PARSE, DETAILS)
|
||||||
|
|
||||||
SR_REGISTER_DEV_DRIVER_LIST(serial_dmm_drivers,
|
SR_REGISTER_DEV_DRIVER_LIST(serial_dmm_drivers,
|
||||||
/*
|
/*
|
||||||
* The items are sorted by chipset first and then model name.
|
* The items are sorted by chipset first and then model name.
|
||||||
|
|
|
@ -29,6 +29,8 @@ struct dmm_info {
|
||||||
const char *vendor;
|
const char *vendor;
|
||||||
/** Model. */
|
/** Model. */
|
||||||
const char *device;
|
const char *device;
|
||||||
|
/** conn string. */
|
||||||
|
const char *conn;
|
||||||
/** serialcomm string. */
|
/** serialcomm string. */
|
||||||
const char *serialcomm;
|
const char *serialcomm;
|
||||||
/** Packet size in bytes. */
|
/** Packet size in bytes. */
|
||||||
|
|
Loading…
Reference in New Issue