]> sigrok.org Git - libsigrok.git/commitdiff
Add sr_dev_acquisition_start(), factor out SR_ERR_DEV_CLOSED check.
authorUwe Hermann <redacted>
Wed, 5 Jul 2017 20:37:10 +0000 (22:37 +0200)
committerUwe Hermann <redacted>
Fri, 7 Jul 2017 19:51:16 +0000 (21:51 +0200)
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.

62 files changed:
src/hardware/agilent-dmm/api.c
src/hardware/appa-55ii/api.c
src/hardware/arachnid-labs-re-load-pro/api.c
src/hardware/asix-sigma/api.c
src/hardware/atten-pps3xxx/api.c
src/hardware/baylibre-acme/api.c
src/hardware/beaglelogic/api.c
src/hardware/brymen-bm86x/api.c
src/hardware/brymen-dmm/api.c
src/hardware/cem-dt-885x/api.c
src/hardware/center-3xx/api.c
src/hardware/chronovu-la/api.c
src/hardware/colead-slm/api.c
src/hardware/conrad-digi-35-cpu/api.c
src/hardware/demo/api.c
src/hardware/dreamsourcelab-dslogic/protocol.c
src/hardware/fluke-dmm/api.c
src/hardware/ftdi-la/api.c
src/hardware/fx2lafw/protocol.c
src/hardware/gmc-mh-1x-2x/api.c
src/hardware/gwinstek-gds-800/api.c
src/hardware/hameg-hmo/api.c
src/hardware/hantek-6xxx/api.c
src/hardware/hantek-dso/api.c
src/hardware/hp-3457a/api.c
src/hardware/hung-chang-dso-2100/api.c
src/hardware/ikalogic-scanalogic2/api.c
src/hardware/ikalogic-scanaplus/api.c
src/hardware/kecheng-kc-330b/api.c
src/hardware/kern-scale/api.c
src/hardware/korad-kaxxxxp/api.c
src/hardware/lascar-el-usb/api.c
src/hardware/lecroy-logicstudio/api.c
src/hardware/lecroy-xstream/api.c
src/hardware/link-mso19/api.c
src/hardware/manson-hcs-3xxx/api.c
src/hardware/maynuo-m97/api.c
src/hardware/mic-985xx/api.c
src/hardware/motech-lps-30x/api.c
src/hardware/norma-dmm/api.c
src/hardware/openbench-logic-sniffer/api.c
src/hardware/pce-322a/api.c
src/hardware/pipistrello-ols/api.c
src/hardware/rigol-ds/api.c
src/hardware/rohde-schwarz-sme-0x/api.c
src/hardware/saleae-logic-pro/api.c
src/hardware/saleae-logic16/api.c
src/hardware/scpi-pps/api.c
src/hardware/serial-dmm/api.c
src/hardware/sysclk-lwla/api.c
src/hardware/teleinfo/api.c
src/hardware/testo/api.c
src/hardware/tondaj-sl-814/api.c
src/hardware/uni-t-ut32x/api.c
src/hardware/victor-dmm/api.c
src/hardware/yokogawa-dlm/api.c
src/hardware/zeroplus-logic-cube/api.c
src/hwdriver.c
src/lcr/es51919.c
src/libsigrok-internal.h
src/session.c
src/std.c

index aaba328192789dcc575ac7a595cea14c4e6ef998..ea67039dfce7da8305a04d7ab76fe54e89d3453c 100644 (file)
@@ -311,9 +311,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc = sdi->priv;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc->cur_channel = sr_next_enabled_channel(sdi, NULL);
        devc->cur_conf = sr_next_enabled_channel(sdi, NULL);
        devc->cur_sample = 1;
index 27fb992a67307c658038540bba4d069dea63e50e..c287134f63173f3105c10c2104b91c5867f8d389 100644 (file)
@@ -200,9 +200,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
 
        serial = sdi->conn;
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        sr_sw_limits_acquisition_start(&devc->limits);
index 1a5281f80185e0cabf678f7a6978cafdc3761297..88e8f52e01e30c4489047e89268ee26cac5ee4aa 100644 (file)
@@ -308,9 +308,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        serial = sdi->conn;
 
index 4e3d32beb99f1f934e37a36af306883628d94373..30d32da4e343c5eb5b697da4e28cd0c64c40b9f0 100644 (file)
@@ -299,9 +299,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        uint8_t clock_bytes[sizeof(clockselect)];
        size_t clock_idx;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        if (sigma_convert_trigger(sdi) != SR_OK) {
index 1768f842969c5d072a8fd0c04133b8402c167cdd..9c43a78cc6b5d3f2acfda10b63153e9c9dcbf1ff 100644 (file)
@@ -439,9 +439,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct sr_serial_dev_inst *serial;
        uint8_t packet[PACKET_SIZE];
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        memset(devc->packet, 0x44, PACKET_SIZE);
        devc->packet_size = 0;
index 8e0af46df9bfc3147f5759fe9ab3cf9f71e2bf0a..a1f149fc8b7aa91b5103bfbd0d41b3c6231e2d31 100644 (file)
@@ -316,9 +316,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
                .it_value = { 0, 0 }
        };
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        if (dev_acquisition_open(sdi))
                return SR_ERR;
 
index c8e43730a3fb6ddf11a3e1ab3afad5f95fd63370..734f477f9f62cdb48d42fac7febfffda71d78265 100644 (file)
@@ -294,9 +294,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc = sdi->priv;
        struct sr_trigger *trigger;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        /* Clear capture state */
        devc->bytes_read = 0;
        devc->offset = 0;
index 484e1476707da7f1a1556140d80e455f3bbbbd29..2edade93d28688b87821c1d7cff5f67eb3048413 100644 (file)
@@ -210,9 +210,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        sr_sw_limits_acquisition_start(&devc->sw_limits);
index 00ff6cf110783be92707c3e42c8d53183b069a91..9c7b273e9410dca1b11e42c929ef077c22cc80ae 100644 (file)
@@ -160,9 +160,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        sr_sw_limits_acquisition_start(&devc->sw_limits);
index 5b8bb94cab9132e29cea329b25a8677cd97ccf1e..7ad8e610a83940b4c42adaeb87e45be3e523685e 100644 (file)
@@ -346,9 +346,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        devc->state = ST_INIT;
        devc->num_samples = 0;
index 44f07f4d542b79f8aeb2eb40646f93f2d2f82a72..e826c59dabfc220fd106fbfa8e3c48fe785db608 100644 (file)
@@ -165,9 +165,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, int idx)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        sr_sw_limits_acquisition_start(&devc->sw_limits);
index 3ccac06b8e9ef30cc7f91c007ee9756e539a6a0f..e8a4afc38d9892078aaa4af4e276f548d912205c 100644 (file)
@@ -484,9 +484,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        uint8_t buf[8];
        int bytes_to_write, bytes_written;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        if (!devc->ftdic) {
index 762cda19df7809a859c4aadc5ce82693debf8b29..f7a1c16ffc20ce8343f0a1fa5c3b74f428851e73 100644 (file)
@@ -123,9 +123,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc = sdi->priv;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        sr_sw_limits_acquisition_start(&devc->limits);
        std_session_send_df_header(sdi);
 
index 022e53304a2b5cdcb0cbf689d4f62bf53128bbcb..ec134d308b32aa1eedea958afcda6de2b183d56c 100644 (file)
@@ -163,8 +163,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
 
 static int dev_acquisition_start(const struct sr_dev_inst *sdi)
 {
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
+       (void)sdi;
 
        return SR_OK;
 }
index 5ab1f4afdfe9dc213e0d6b1de1d68d7ce30cc1ee..92de2ce1492e40ebadcad726a7c0abfbac33a95d 100644 (file)
@@ -464,9 +464,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        GHashTableIter iter;
        void *value;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        devc->sent_samples = 0;
 
index b5ca61b77e36efc80fabb17398bebd99fcc20fc1..0818e23f2fb7703bbab483b39a9c45042fe88c5e 100644 (file)
@@ -1056,9 +1056,6 @@ SR_PRIV int dslogic_acquisition_start(const struct sr_dev_inst *sdi)
        struct libusb_transfer *transfer;
        int ret;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        di = sdi->driver;
        drvc = di->context;
        devc = sdi->priv;
index 0ee6c7fa64dea886e134bdca996395cfb888fb32..a706675a771bd4eb7121dcef7fd86fd4f8cd2906 100644 (file)
@@ -221,9 +221,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        sr_sw_limits_acquisition_start(&devc->limits);
index 240aa7ad2597eed0a81145c24bf901b7e5ee6f4f..7adbb7a3796d23a6c69740879f733b8f1ff681fa 100644 (file)
@@ -439,9 +439,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
 
        devc = sdi->priv;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        if (!devc->ftdic)
                return SR_ERR_BUG;
 
index 95ce4bd3bd581e18459294b0e5ed011c3fa3a52d..a31231fd41a22813ae3e4f23a69e1c5aa2c71a7d 100644 (file)
@@ -683,9 +683,6 @@ SR_PRIV int fx2lafw_start_acquisition(const struct sr_dev_inst *sdi)
        int timeout, ret;
        size_t size;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        di = sdi->driver;
        drvc = di->context;
        devc = sdi->priv;
index 801429ce65c942dc8ba1bbb15f3bf12ab60d836c..71ab57d097a3e1e8b76ac0d4272f1f1431c74ad1 100644 (file)
@@ -427,9 +427,6 @@ static int dev_acquisition_start_1x_2x_rs232(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        devc->settings_ok = FALSE;
        devc->buflen = 0;
@@ -450,9 +447,6 @@ static int dev_acquisition_start_2x_bd232(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        devc->settings_ok = FALSE;
        devc->buflen = 0;
index 7e947466b784276f61d528a43fa8e8b7b0405768..d8b00f9abcf86af42a34248e3c01e3f0d4aa5602 100644 (file)
@@ -199,9 +199,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        scpi = sdi->conn;
        devc = sdi->priv;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc->state = START_ACQUISITION;
        devc->cur_acq_frame = 0;
 
index 8a4212af096d7610209f7419de1a36135405dee2..7b5a71db1c42e3fa5075f2b730b5f4d4a3bb9bb8 100644 (file)
@@ -727,9 +727,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct sr_scpi_dev_inst *scpi;
        int ret;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        scpi = sdi->conn;
        devc = sdi->priv;
 
index 025695e1df41cf1b913664be95e5e38e85752545..e4e20e0a84da803a6adc9cc22cfcaa8add5e66a6 100644 (file)
@@ -784,9 +784,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct sr_dev_driver *di = sdi->driver;
        struct drv_context *drvc = di->context;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        if (configure_channels(sdi) != SR_OK) {
index f5e7383d9c439d97297c855d85c9396eb60a01f5..119e8274e517b5804b4ce9c1f0dea423bb1f6120 100644 (file)
@@ -954,9 +954,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct sr_dev_driver *di = sdi->driver;
        struct drv_context *drvc = di->context;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        if (configure_channels(sdi) != SR_OK) {
index 3bcc723bd59742438c4e7c9889162077e56610e0..b3a91353131c31bb74c3b4ea93690c645b2ef202 100644 (file)
@@ -367,9 +367,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        GArray *ch_list;
        GSList *channels;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        scpi = sdi->conn;
        devc = sdi->priv;
 
index 0ed7995962f4bb8aa87f6288db08458ec43ab3b1..70b094a605e023b0fa71ef8ac063f9f881a1a992 100644 (file)
@@ -664,9 +664,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc = sdi->priv;
        int ret;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        if (devc->channel) {
                static const float res_array[] = {0.5, 1, 2, 5};
                static const uint8_t relays[] = {100, 10, 10, 1};
index 9ffd60da8672ca81ee009ebf8563b2ff2fbc843d..6acf435237ad5b02a943527191244884db198114 100644 (file)
@@ -361,9 +361,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        unsigned int i, j;
        int ret;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        drvc = di->context;
 
index 439116cc69dc757c9b69cf1fee0c0ed6087ccef9..2105bce130ed937ef4a9da75070a0c2c7f3b750f 100644 (file)
@@ -325,9 +325,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        int ret;
        struct dev_context *devc;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        if (!devc->ftdic)
index 2d1f97df79725a2f844d067696c889db0fc054fa..e99e0b19d612133d9cd65a5226904a738cd0563d 100644 (file)
@@ -380,9 +380,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        int req_len, buf_len, len, ret;
        unsigned char buf[9];
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        drvc = di->context;
        devc = sdi->priv;
        usb = sdi->conn;
index 167bf1bc9958c8180b83908c2c47f95c5f27ae17..0f7b8709016febe4df42797d9818a25dfb69e804 100644 (file)
@@ -152,9 +152,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        serial = sdi->conn;
 
index fc57725cbf8f47c64546ea2c83b4507d73ca3279..c9b677661311de01f25ebaa16f4ada4dae5f02ed 100644 (file)
@@ -344,9 +344,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        sr_sw_limits_acquisition_start(&devc->limits);
index 5ee1d22a838db6874be5d27b569d4f3caa1b8588..4a58f2804370c9893e7b25a62954fa8b666a99c5 100644 (file)
@@ -293,9 +293,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        int ret;
        unsigned char cmd[3], resp[4], *buf;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        drvc = di->context;
        devc = sdi->priv;
        usb = sdi->conn;
index 95c044f1f3de52ebfe33f4948cf81027600ca6ff..ebb92e1eac18d15c0fd6f611d901446b5f4c067c 100644 (file)
@@ -472,9 +472,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct drv_context *drvc;
        int ret;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        drvc = sdi->driver->context;
 
        if ((ret = lls_start_acquisition(sdi)) < 0)
index 2d4acf97485f6a16533691b90a76945c2355e2ab..748fbd1e03bf155290783a157262c782acbf31e0 100644 (file)
@@ -553,9 +553,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        int ret;
        struct sr_scpi_dev_inst *scpi;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        scpi = sdi->conn;
        /* Preset empty results. */
index 7924b2311a2b1a4f72b056f37253682454243a8d..cf6514fb0ece71ccbb11f831e288b6c0aaa990f1 100644 (file)
@@ -330,9 +330,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        int ret = SR_ERR;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        if (mso_configure_channels(sdi) != SR_OK) {
index ee478033f3cd2b16fa25e0a59c7409d3fc5d2e3d..1808e033bb6b4c2c584ea958129ee698ca77f283 100644 (file)
@@ -353,9 +353,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        sr_sw_limits_acquisition_start(&devc->limits);
index 127830cd634367261c3135c7be88f6fdec766b52..5c3a73c72b38b6ac476703dc90f3764a1d8aaeb3 100644 (file)
@@ -435,9 +435,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct sr_modbus_dev_inst *modbus;
        int ret;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        modbus = sdi->conn;
        devc = sdi->priv;
 
index d755bea7e8d6e104afac3f8728f87a3d4edcf02f..3a924072557f25c9dd1b4e8116ad65e6763188bd 100644 (file)
@@ -178,9 +178,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, int idx)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        sr_sw_limits_acquisition_start(&devc->limits);
index 4ec35ff58f35b3a203c7edfd2b7928e7e399bb67..d5b55a81b9b97f476481ab9fc541b585de31addd 100644 (file)
@@ -764,9 +764,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        devc->acq_running = TRUE;
index eb2ba25cf81bb3a8116b130b2c4bfb5bc86283c4..1d1247e309422b51e3ea92f5c05b21f4b3d12c30 100644 (file)
@@ -203,9 +203,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        sr_sw_limits_acquisition_start(&devc->limits);
index 5e74a5236e745b56de2bfde26e3baa8ebebf212f..5cf87c2380392157befe9298ce9a96554e47ab25 100644 (file)
@@ -439,9 +439,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        int num_ols_changrp;
        int ret, i;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        serial = sdi->conn;
 
index b0f62505d5cdb9ca63b91a49616b76281e4a0153..e6c6fda04bf004531c26529022127295b786e23f 100644 (file)
@@ -328,9 +328,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        devc->buffer_len = 0;
        devc->memory_state = MEM_STATE_REQUEST_MEMORY_USAGE;
index bf7436065254ddd6564e4279373b120d33723a52..33d965e58c9abf36d3e589994f43cc2201f35f24 100644 (file)
@@ -523,9 +523,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        int num_pols_changrp, samplespercount;
        int ret, i;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        pols_channel_mask(sdi);
index 296d86776fc9295d991d9c2493fa34cae98f9911..a2e32297ca25450ea2fb493278c1a5590a9871a9 100644 (file)
@@ -997,9 +997,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        gboolean some_digital;
        GSList *l;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        scpi = sdi->conn;
        devc = sdi->priv;
 
index 7b971b2b4231c3ac1cc3aa13d8392d169bb4ebd0..68c57ea9077c88e77d9c0526c1c6aca67ade97a0 100644 (file)
@@ -265,8 +265,7 @@ static int config_list(uint32_t key, GVariant **data,
 
 static int dev_acquisition_start(const struct sr_dev_inst *sdi)
 {
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
+       (void)sdi;
 
        return SR_OK;
 }
index 1648c95268ba7441426b284d4fb67ac85f5be216..f448533ef9be8b6a2c7242f44c477eda2ff66006 100644 (file)
@@ -348,9 +348,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        uint8_t *buf;
        unsigned int i, ret;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        ret = saleae_logic_pro_init(sdi);
        if (ret != SR_OK)
                return ret;
index f7430c212aec28e036a105f0f7a3783f41b6f88f..6538b75fe04806d535ddfa0c5a134950b5707d67 100644 (file)
@@ -674,9 +674,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        unsigned char *buf;
        size_t size, convsize;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        drvc = di->context;
        devc = sdi->priv;
        usb = sdi->conn;
index c6bd3e591925d87d0dc117e944b5829e7091751e..bdf4bffe55233c0fe0e582517e43c3ad54d7170c 100644 (file)
@@ -642,9 +642,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct pps_channel *pch;
        int cmd, ret;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        scpi = sdi->conn;
 
index 4749646525c69633db1ffbf128a8d57f97a3ddee..a11a9b365d51bc5a230754f99559d29b1ad45261 100644 (file)
@@ -179,9 +179,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        sr_sw_limits_acquisition_start(&devc->limits);
index 1da4b00eb86698e4707996e0695a816f85701064..439d71f27b2d02896b12979c76d6526cefd32d66 100644 (file)
@@ -743,11 +743,6 @@ static int config_list(uint32_t key, GVariant **data,
  */
 static int dev_acquisition_start(const struct sr_dev_inst *sdi)
 {
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
-       sr_info("Starting acquisition.");
-
        return lwla_start_acquisition(sdi);
 }
 
index 4cfadf4b3e43678e333b4c34e56252b285250101..41537f1bb53f0852cf4bb50fdea560cf9c783d3d 100644 (file)
@@ -163,9 +163,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct sr_serial_dev_inst *serial = sdi->conn;
        struct dev_context *devc;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        sr_sw_limits_acquisition_start(&devc->sw_limits);
index d04cce6f3ca8b87a8b6289d664e1466ece80d600..0ebab5d7dd8be85eafda66672383402740cb0470 100644 (file)
@@ -372,10 +372,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        unsigned char *buf;
 
        drvc = di->context;
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
-
        devc = sdi->priv;
        usb = sdi->conn;
        devc->reply_size = 0;
index 445b4274863a57b9fccae4dea75e0fcdee731624..804b57b31f64306ba907a71d7d80edcef9f191de 100644 (file)
@@ -133,9 +133,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc = sdi->priv;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        std_session_send_df_header(sdi);
 
        sr_sw_limits_acquisition_start(&devc->limits);
index 2df113c322f3e6017777d51a343f99cc5b4f0476..a4d906d0e41945217235e15c69aa7348e61f804c 100644 (file)
@@ -241,9 +241,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        int len, ret;
        unsigned char cmd[2];
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        drvc = di->context;
        devc = sdi->priv;
        usb = sdi->conn;
index 1ea102ced9c81ef839f8b73aab0fc0203785913a..58a11f84cda4e109df946aaa60822cd5280817a5 100644 (file)
@@ -291,9 +291,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        int ret;
        unsigned char *buf;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        usb = sdi->conn;
 
        std_session_send_df_header(sdi);
index e11587e6ced551c77a340893cd392ff19b3d5404..891775cc412985c823f1535c170203dade6c2f06 100644 (file)
@@ -612,9 +612,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_scpi_dev_inst *scpi;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        scpi = sdi->conn;
        devc = sdi->priv;
        digital_added = FALSE;
index 3d0c3a41a2107d741ba107f9ddeb079ec9940003..c36e06aea727cdd7daacb2a5460bd845f1269b7e 100644 (file)
@@ -490,9 +490,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        unsigned int discard;
        int trigger_now;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        if (analyzer_add_triggers(sdi) != SR_OK) {
index 6f467edb17278f09ca26981404f0af6085a7f4bf..b16dcd34f6f28af0ed8317397f483a74d84eacdb 100644 (file)
@@ -592,6 +592,25 @@ SR_PRIV void sr_config_free(struct sr_config *src)
 
 }
 
+/** @private */
+SR_PRIV int sr_dev_acquisition_start(struct sr_dev_inst *sdi)
+{
+       if (!sdi || !sdi->driver) {
+               sr_err("%s: Invalid arguments.", __func__);
+               return SR_ERR_ARG;
+       }
+
+       if (sdi->status != SR_ST_ACTIVE) {
+               sr_err("%s: Device instance not active, can't start.",
+                       sdi->driver->name);
+               return SR_ERR_DEV_CLOSED;
+       }
+
+       sr_dbg("%s: Starting acquisition.", sdi->driver->name);
+
+       return sdi->driver->dev_acquisition_start(sdi);
+}
+
 /** @private */
 SR_PRIV int sr_dev_acquisition_stop(struct sr_dev_inst *sdi)
 {
index 9cd1c2da1f7223cc5e236a3e354745a61f89ace0..fd26fd9e48df23a4f2de7c399cfc50b031aada10 100644 (file)
@@ -909,9 +909,6 @@ SR_PRIV int es51919_serial_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        if (!(devc = sdi->priv))
                return SR_ERR_BUG;
 
index d8610f820ee5bc17ed792cf7cd071d0efcba2abb..7dc3928abb875282bd9cc943adec7ee09b24f35a 100644 (file)
@@ -834,6 +834,7 @@ SR_PRIV int sr_variant_type_check(uint32_t key, GVariant *data);
 SR_PRIV void sr_hw_cleanup_all(const struct sr_context *ctx);
 SR_PRIV struct sr_config *sr_config_new(uint32_t key, GVariant *data);
 SR_PRIV void sr_config_free(struct sr_config *src);
+SR_PRIV int sr_dev_acquisition_start(struct sr_dev_inst *sdi);
 SR_PRIV int sr_dev_acquisition_stop(struct sr_dev_inst *sdi);
 
 /*--- session.c -------------------------------------------------------------*/
index 1843fd17b9f58bf248a58a66b6852f960d5215af..ad39ddcf54f457212637d120caaec55fa5cc4a52 100644 (file)
@@ -365,7 +365,7 @@ SR_API int sr_session_dev_add(struct sr_session *session,
                               sr_strerror(ret));
                        return ret;
                }
-               if ((ret = sdi->driver->dev_acquisition_start(sdi)) != SR_OK) {
+               if ((ret = sr_dev_acquisition_start(sdi)) != SR_OK) {
                        sr_err("Failed to start acquisition of device in "
                               "running session (%s)", sr_strerror(ret));
                        return ret;
@@ -816,7 +816,7 @@ SR_API int sr_session_start(struct sr_session *session)
                        ret = SR_ERR;
                        break;
                }
-               ret = sdi->driver->dev_acquisition_start(sdi);
+               ret = sr_dev_acquisition_start(sdi);
                if (ret != SR_OK) {
                        sr_err("Could not start %s device %s acquisition.",
                                sdi->driver->name, sdi->connection_id);
index bd748914df407edc02b86c341aa45890fd6b5f0f..df7a17495ed8dda02952f6943197257842a6d66d 100644 (file)
--- a/src/std.c
+++ b/src/std.c
@@ -98,8 +98,6 @@ SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi)
        struct sr_datafeed_packet packet;
        struct sr_datafeed_header header;
 
-       sr_dbg("%s: Starting acquisition.", prefix);
-
        /* Send header packet to the session bus. */
        sr_dbg("%s: Sending SR_DF_HEADER packet.", prefix);
        packet.type = SR_DF_HEADER;