Use std_serial_dev_open().
This commit is contained in:
parent
23dc666166
commit
854434de0b
|
@ -169,19 +169,6 @@ static GSList *dev_list(void)
|
|||
return ((struct drv_context *)(di->priv))->instances;
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
|
||||
return SR_ERR;
|
||||
|
||||
sdi->status = SR_ST_ACTIVE;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(void)
|
||||
{
|
||||
return dev_clear();
|
||||
|
@ -290,7 +277,7 @@ SR_PRIV struct sr_dev_driver agdmm_driver_info = {
|
|||
.config_get = NULL,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_open = std_serial_dev_open,
|
||||
.dev_close = std_serial_dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
|
|
|
@ -149,19 +149,6 @@ static GSList *dev_list(void)
|
|||
return ((struct drv_context *)(di->priv))->instances;
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
|
||||
return SR_ERR;
|
||||
|
||||
sdi->status = SR_ST_ACTIVE;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(void)
|
||||
{
|
||||
return dev_clear();
|
||||
|
@ -272,7 +259,7 @@ SR_PRIV struct sr_dev_driver brymen_bm857_driver_info = {
|
|||
.config_get = NULL,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_open = std_serial_dev_open,
|
||||
.dev_close = std_serial_dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
|
|
|
@ -155,19 +155,6 @@ static GSList *dev_list(int idx)
|
|||
return ((struct drv_context *)(center_devs[idx].di->priv))->instances;
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
|
||||
return SR_ERR;
|
||||
|
||||
sdi->status = SR_ST_ACTIVE;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(int idx)
|
||||
{
|
||||
return dev_clear(idx);
|
||||
|
@ -291,7 +278,7 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
|
|||
.config_get = NULL, \
|
||||
.config_set = config_set, \
|
||||
.config_list = config_list, \
|
||||
.dev_open = dev_open, \
|
||||
.dev_open = std_serial_dev_open, \
|
||||
.dev_close = std_serial_dev_close, \
|
||||
.dev_acquisition_start = dev_acquisition_start_##ID_UPPER, \
|
||||
.dev_acquisition_stop = dev_acquisition_stop, \
|
||||
|
|
|
@ -202,19 +202,6 @@ static GSList *dev_list(void)
|
|||
return ((struct drv_context *)(di->priv))->instances;
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
|
||||
return SR_ERR;
|
||||
|
||||
sdi->status = SR_ST_ACTIVE;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(void)
|
||||
{
|
||||
return dev_clear();
|
||||
|
@ -330,7 +317,7 @@ SR_PRIV struct sr_dev_driver flukedmm_driver_info = {
|
|||
.config_get = NULL,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_open = std_serial_dev_open,
|
||||
.dev_close = std_serial_dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
|
|
|
@ -221,17 +221,6 @@ static int dev_clear_1x_2x_rs232(void)
|
|||
return std_dev_clear(&gmc_mh_1x_2x_rs232_driver_info, NULL);
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial = sdi->conn;
|
||||
if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
|
||||
return SR_ERR;
|
||||
|
||||
sdi->status = SR_ST_ACTIVE;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
@ -389,7 +378,7 @@ SR_PRIV struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info = {
|
|||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_open = std_serial_dev_open,
|
||||
.dev_close = dev_close,
|
||||
.dev_acquisition_start = dev_acq_start_1x_2x_rs232,
|
||||
.dev_acquisition_stop = dev_acq_stop,
|
||||
|
|
|
@ -157,19 +157,6 @@ static GSList *dev_list(int idx)
|
|||
return ((struct drv_context *)(mic_devs[idx].di->priv))->instances;
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
|
||||
return SR_ERR;
|
||||
|
||||
sdi->status = SR_ST_ACTIVE;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(int idx)
|
||||
{
|
||||
return dev_clear(idx);
|
||||
|
@ -293,7 +280,7 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
|
|||
.config_get = NULL, \
|
||||
.config_set = config_set, \
|
||||
.config_list = config_list, \
|
||||
.dev_open = dev_open, \
|
||||
.dev_open = std_serial_dev_open, \
|
||||
.dev_close = std_serial_dev_close, \
|
||||
.dev_acquisition_start = dev_acquisition_start_##ID_UPPER, \
|
||||
.dev_acquisition_stop = dev_acquisition_stop, \
|
||||
|
|
|
@ -168,19 +168,6 @@ static int dev_clear(void)
|
|||
return std_dev_clear(di, NULL);
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
|
||||
return SR_ERR;
|
||||
|
||||
sdi->status = SR_ST_ACTIVE;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
@ -318,7 +305,7 @@ SR_PRIV struct sr_dev_driver norma_dmm_driver_info = {
|
|||
.config_get = NULL,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_open = std_serial_dev_open,
|
||||
.dev_close = dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
|
|
|
@ -210,19 +210,6 @@ static GSList *dev_list(void)
|
|||
return ((struct drv_context *)(di->priv))->instances;
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
|
||||
return SR_ERR;
|
||||
|
||||
sdi->status = SR_ST_ACTIVE;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(void)
|
||||
{
|
||||
return dev_clear();
|
||||
|
@ -551,7 +538,7 @@ SR_PRIV struct sr_dev_driver ols_driver_info = {
|
|||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_open = std_serial_dev_open,
|
||||
.dev_close = std_serial_dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
|
|
|
@ -380,19 +380,6 @@ static GSList *dev_list(int dmm)
|
|||
return ((struct drv_context *)(dmms[dmm].di->priv))->instances;
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
|
||||
return SR_ERR;
|
||||
|
||||
sdi->status = SR_ST_ACTIVE;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(int dmm)
|
||||
{
|
||||
return dev_clear(dmm);
|
||||
|
@ -529,7 +516,7 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
|
|||
.config_get = NULL, \
|
||||
.config_set = config_set, \
|
||||
.config_list = config_list, \
|
||||
.dev_open = dev_open, \
|
||||
.dev_open = std_serial_dev_open, \
|
||||
.dev_close = std_serial_dev_close, \
|
||||
.dev_acquisition_start = dev_acquisition_start_##ID_UPPER, \
|
||||
.dev_acquisition_stop = dev_acquisition_stop, \
|
||||
|
|
|
@ -174,18 +174,6 @@ static int dev_clear(void)
|
|||
return std_dev_clear(di, NULL);
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial = sdi->conn;
|
||||
|
||||
if (serial_open(serial, SERIAL_RDONLY | SERIAL_NONBLOCK) != SR_OK)
|
||||
return SR_ERR;
|
||||
|
||||
sdi->status = SR_ST_ACTIVE;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(void)
|
||||
{
|
||||
return dev_clear();
|
||||
|
@ -293,7 +281,7 @@ SR_PRIV struct sr_dev_driver teleinfo_driver_info = {
|
|||
.dev_clear = dev_clear,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_open = std_serial_dev_open,
|
||||
.dev_close = std_serial_dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
|
|
|
@ -128,19 +128,6 @@ static GSList *dev_list(void)
|
|||
return ((struct drv_context *)(di->priv))->instances;
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
|
||||
return SR_ERR;
|
||||
|
||||
sdi->status = SR_ST_ACTIVE;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(void)
|
||||
{
|
||||
return dev_clear();
|
||||
|
@ -234,7 +221,7 @@ SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info = {
|
|||
.config_get = NULL,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_open = std_serial_dev_open,
|
||||
.dev_close = std_serial_dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
|
|
Loading…
Reference in New Issue