libsigrok.h: Don't store subdriver in sr_dev_driver
Not all drivers use subdrivers. The only reason the subdriver field was introduced was to accomodate the model of serial-dmm. The sr_dev_driver struct is available to the frontend. Exposing the subdriver field creates the problem of exposing knowledge of libsigrok's internal driver layout, even though the drivers are designed to be a flat list to the frontend. Store the subdriver in the dev_context struct of serial-dmm. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
This commit is contained in:
parent
d128bf12b2
commit
c69049091e
|
@ -255,6 +255,7 @@ static GSList *scan(const char *conn, const char *serialcomm, int dmm)
|
|||
}
|
||||
|
||||
devc->serial = serial;
|
||||
devc->subdriver = dmm;
|
||||
|
||||
sdi->priv = devc;
|
||||
sdi->driver = dmms[dmm].di;
|
||||
|
@ -446,7 +447,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
|||
|
||||
/* Poll every 50ms, or whenever some data comes in. */
|
||||
sr_source_add(devc->serial->fd, G_IO_IN, 50,
|
||||
dmms[sdi->driver->subdriver].receive_data, (void *)sdi);
|
||||
dmms[devc->subdriver].receive_data, (void *)sdi);
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
@ -512,7 +513,6 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
|
|||
.dev_acquisition_start = hw_dev_acquisition_start, \
|
||||
.dev_acquisition_stop = hw_dev_acquisition_stop, \
|
||||
.priv = NULL, \
|
||||
.subdriver = ID_UPPER, \
|
||||
};
|
||||
|
||||
DRV(digitek_dt4000zc, DIGITEK_DT4000ZC, "digitek-dt4000zc", "Digitek DT4000ZC")
|
||||
|
|
|
@ -81,6 +81,7 @@ struct dev_context {
|
|||
uint8_t buf[DMM_BUFSIZE];
|
||||
int bufoffset;
|
||||
int buflen;
|
||||
int subdriver;
|
||||
};
|
||||
|
||||
SR_PRIV int receive_data_DIGITEK_DT4000ZC(int fd, int revents, void *cb_data);
|
||||
|
|
|
@ -631,8 +631,6 @@ struct sr_dev_driver {
|
|||
|
||||
/* Dynamic */
|
||||
void *priv;
|
||||
|
||||
int subdriver;
|
||||
};
|
||||
|
||||
struct sr_session {
|
||||
|
|
Loading…
Reference in New Issue