From: Bert Vermeulen Date: Sat, 7 Dec 2013 20:36:27 +0000 (+0100) Subject: Use std_serial_dev_open(). X-Git-Tag: libsigrok-0.3.0~449 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=854434de0bc581f16f87f85595f473ee41ca9e0c;p=libsigrok.git Use std_serial_dev_open(). --- diff --git a/hardware/agilent-dmm/api.c b/hardware/agilent-dmm/api.c index a58e57c3..cc2a4be8 100644 --- a/hardware/agilent-dmm/api.c +++ b/hardware/agilent-dmm/api.c @@ -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, diff --git a/hardware/brymen-dmm/api.c b/hardware/brymen-dmm/api.c index c9f9ba75..4b43e3d7 100644 --- a/hardware/brymen-dmm/api.c +++ b/hardware/brymen-dmm/api.c @@ -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, diff --git a/hardware/center-3xx/api.c b/hardware/center-3xx/api.c index aa1e4a7b..b85273e5 100644 --- a/hardware/center-3xx/api.c +++ b/hardware/center-3xx/api.c @@ -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, \ diff --git a/hardware/fluke-dmm/api.c b/hardware/fluke-dmm/api.c index 52c34080..0cb0c115 100644 --- a/hardware/fluke-dmm/api.c +++ b/hardware/fluke-dmm/api.c @@ -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, diff --git a/hardware/gmc-mh-1x-2x/api.c b/hardware/gmc-mh-1x-2x/api.c index 922f9fee..2938c36a 100644 --- a/hardware/gmc-mh-1x-2x/api.c +++ b/hardware/gmc-mh-1x-2x/api.c @@ -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, diff --git a/hardware/mic-985xx/api.c b/hardware/mic-985xx/api.c index cdbf70df..641ca330 100644 --- a/hardware/mic-985xx/api.c +++ b/hardware/mic-985xx/api.c @@ -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, \ diff --git a/hardware/norma-dmm/api.c b/hardware/norma-dmm/api.c index 397694ca..27a4db5e 100644 --- a/hardware/norma-dmm/api.c +++ b/hardware/norma-dmm/api.c @@ -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, diff --git a/hardware/openbench-logic-sniffer/api.c b/hardware/openbench-logic-sniffer/api.c index c189bed3..8df4a8cd 100644 --- a/hardware/openbench-logic-sniffer/api.c +++ b/hardware/openbench-logic-sniffer/api.c @@ -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, diff --git a/hardware/serial-dmm/api.c b/hardware/serial-dmm/api.c index 4af043a4..a3123b08 100644 --- a/hardware/serial-dmm/api.c +++ b/hardware/serial-dmm/api.c @@ -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, \ diff --git a/hardware/teleinfo/api.c b/hardware/teleinfo/api.c index 49a3f5ce..7728a314 100644 --- a/hardware/teleinfo/api.c +++ b/hardware/teleinfo/api.c @@ -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, diff --git a/hardware/tondaj-sl-814/api.c b/hardware/tondaj-sl-814/api.c index f9958238..2ed95402 100644 --- a/hardware/tondaj-sl-814/api.c +++ b/hardware/tondaj-sl-814/api.c @@ -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,