From: Lars-Peter Clausen Date: Sun, 8 May 2016 13:47:35 +0000 (+0200) Subject: Use driver name as the log prefix in standard functions X-Git-Tag: libsigrok-0.5.0~356 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=bee2b0168c087676c1b365861d8c2d4714afa9b9;p=libsigrok.git Use driver name as the log prefix in standard functions Some of the standard helper functions take a log prefix parameter that is used when printing messages. This log prefix is almost always identical to the name field in the driver's sr_dev_driver struct. The only exception are drivers which register multiple sr_dev_driver structs. Instead of passing the log prefix as a parameter simply use the driver's name. This simplifies the API, gives consistent behaviour between different drivers and also makes it easier to identify where the message originates when a driver registers sr_dev_driver structs. Signed-off-by: Lars-Peter Clausen --- diff --git a/src/hardware/agilent-dmm/api.c b/src/hardware/agilent-dmm/api.c index df9c095a..0cfb1ef0 100644 --- a/src/hardware/agilent-dmm/api.c +++ b/src/hardware/agilent-dmm/api.c @@ -198,7 +198,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) return SR_ERR_DEV_CLOSED; sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 100ms, or whenever some data comes in. */ serial = sdi->conn; @@ -211,7 +211,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close, - sdi->conn, LOG_PREFIX); + sdi->conn); } static struct sr_dev_driver agdmm_driver_info = { diff --git a/src/hardware/appa-55ii/api.c b/src/hardware/appa-55ii/api.c index 960b8816..4f1233e4 100644 --- a/src/hardware/appa-55ii/api.c +++ b/src/hardware/appa-55ii/api.c @@ -206,7 +206,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 50ms, or whenever some data comes in. */ serial_source_add(sdi->session, serial, G_IO_IN, 50, @@ -218,7 +218,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, - std_serial_dev_close, sdi->conn, LOG_PREFIX); + std_serial_dev_close, sdi->conn); } static struct sr_dev_driver appa_55ii_driver_info = { diff --git a/src/hardware/arachnid-labs-re-load-pro/api.c b/src/hardware/arachnid-labs-re-load-pro/api.c index 45bc7a15..533be926 100644 --- a/src/hardware/arachnid-labs-re-load-pro/api.c +++ b/src/hardware/arachnid-labs-re-load-pro/api.c @@ -327,7 +327,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) reloadpro_receive_data, (void *)sdi); sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); memset(devc->buf, 0, RELOADPRO_BUFSIZE); devc->buflen = 0; @@ -338,7 +338,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, - std_serial_dev_close, sdi->conn, LOG_PREFIX); + std_serial_dev_close, sdi->conn); } static struct sr_dev_driver arachnid_labs_re_load_pro_driver_info = { diff --git a/src/hardware/asix-sigma/api.c b/src/hardware/asix-sigma/api.c index a102b03b..d4209988 100644 --- a/src/hardware/asix-sigma/api.c +++ b/src/hardware/asix-sigma/api.c @@ -372,7 +372,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) gettimeofday(&devc->start_tv, 0); sigma_set_register(WRITE_MODE, 0x0d, devc); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Add capture source. */ sr_session_source_add(sdi->session, -1, 0, 10, sigma_receive_data, (void *)sdi); diff --git a/src/hardware/asix-sigma/protocol.c b/src/hardware/asix-sigma/protocol.c index d9db069e..5fa7b2d0 100644 --- a/src/hardware/asix-sigma/protocol.c +++ b/src/hardware/asix-sigma/protocol.c @@ -906,7 +906,7 @@ static int download_capture(struct sr_dev_inst *sdi) dl_lines_done += dl_lines_curr; } - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); sdi->driver->dev_acquisition_stop(sdi); diff --git a/src/hardware/atten-pps3xxx/api.c b/src/hardware/atten-pps3xxx/api.c index b1724550..01c0d369 100644 --- a/src/hardware/atten-pps3xxx/api.c +++ b/src/hardware/atten-pps3xxx/api.c @@ -451,7 +451,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 50, atten_pps3xxx_receive_data, (void *)sdi); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Send a "channel" configuration packet now. */ memset(packet, 0, PACKET_SIZE); diff --git a/src/hardware/atten-pps3xxx/protocol.c b/src/hardware/atten-pps3xxx/protocol.c index 06a1d2e9..72b4a03e 100644 --- a/src/hardware/atten-pps3xxx/protocol.c +++ b/src/hardware/atten-pps3xxx/protocol.c @@ -155,7 +155,7 @@ SR_PRIV int atten_pps3xxx_receive_data(int fd, int revents, void *cb_data) send_config(sdi); else { serial_source_remove(sdi->session, serial); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); } } } diff --git a/src/hardware/baylibre-acme/api.c b/src/hardware/baylibre-acme/api.c index ed21b921..a1b860e3 100644 --- a/src/hardware/baylibre-acme/api.c +++ b/src/hardware/baylibre-acme/api.c @@ -348,7 +348,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_session_source_add_channel(sdi->session, devc->channel, G_IO_IN | G_IO_ERR, 1000, bl_acme_receive_data, (void *)sdi); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); sr_sw_limits_acquisition_start(&devc->limits); return SR_OK; @@ -369,7 +369,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) g_io_channel_unref(devc->channel); devc->channel = NULL; - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); if (devc->samples_missed > 0) sr_warn("%" PRIu64 " samples missed", devc->samples_missed); diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c index f945c3aa..34b09f21 100644 --- a/src/hardware/beaglelogic/api.c +++ b/src/hardware/beaglelogic/api.c @@ -317,7 +317,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc->trigger_fired = FALSE; } else devc->trigger_fired = TRUE; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Trigger and add poll on file */ beaglelogic_start(devc); @@ -343,7 +343,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) /* Remove session source and send EOT packet */ sr_session_source_remove_pollfd(sdi->session, &devc->pollfd); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); return SR_OK; } diff --git a/src/hardware/beaglelogic/protocol.c b/src/hardware/beaglelogic/protocol.c index ce6c2ae9..8f3ce265 100644 --- a/src/hardware/beaglelogic/protocol.c +++ b/src/hardware/beaglelogic/protocol.c @@ -101,7 +101,7 @@ SR_PRIV int beaglelogic_receive_data(int fd, int revents, void *cb_data) if (devc->bytes_read >= devc->limit_samples * logic.unitsize || packetsize == 0) { /* Send EOA Packet, stop polling */ - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); sr_session_source_remove_pollfd(sdi->session, &devc->pollfd); } diff --git a/src/hardware/brymen-bm86x/api.c b/src/hardware/brymen-bm86x/api.c index a9ac15b3..fb9f2807 100644 --- a/src/hardware/brymen-bm86x/api.c +++ b/src/hardware/brymen-bm86x/api.c @@ -217,7 +217,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->sw_limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); sr_session_source_add(sdi->session, -1, 0, 10, brymen_bm86x_receive_data, (void *)sdi); @@ -230,7 +230,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); sr_session_source_remove(sdi->session, -1); diff --git a/src/hardware/brymen-dmm/api.c b/src/hardware/brymen-dmm/api.c index c9f63b16..8dc7a160 100644 --- a/src/hardware/brymen-dmm/api.c +++ b/src/hardware/brymen-dmm/api.c @@ -166,7 +166,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc = sdi->priv; sr_sw_limits_acquisition_start(&devc->sw_limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 50ms, or whenever some data comes in. */ serial = sdi->conn; @@ -179,7 +179,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close, - sdi->conn, LOG_PREFIX); + sdi->conn); } static struct sr_dev_driver brymen_bm857_driver_info = { diff --git a/src/hardware/cem-dt-885x/api.c b/src/hardware/cem-dt-885x/api.c index 03dc4f05..37aa9bf0 100644 --- a/src/hardware/cem-dt-885x/api.c +++ b/src/hardware/cem-dt-885x/api.c @@ -354,7 +354,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc->num_samples = 0; devc->buf_len = 0; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 100ms, or whenever some data comes in. */ serial = sdi->conn; @@ -370,7 +370,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) return SR_ERR_DEV_CLOSED; return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close, - sdi->conn, LOG_PREFIX); + sdi->conn); } static struct sr_dev_driver cem_dt_885x_driver_info = { diff --git a/src/hardware/center-3xx/api.c b/src/hardware/center-3xx/api.c index 468093c4..f5be8a83 100644 --- a/src/hardware/center-3xx/api.c +++ b/src/hardware/center-3xx/api.c @@ -173,7 +173,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, int idx) sr_sw_limits_acquisition_start(&devc->sw_limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 500ms, or whenever some data comes in. */ serial = sdi->conn; @@ -186,7 +186,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, int idx) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, - std_serial_dev_close, sdi->conn, LOG_PREFIX); + std_serial_dev_close, sdi->conn); } /* Driver-specific API function wrappers */ diff --git a/src/hardware/chronovu-la/api.c b/src/hardware/chronovu-la/api.c index ea247d42..f855f8e8 100644 --- a/src/hardware/chronovu-la/api.c +++ b/src/hardware/chronovu-la/api.c @@ -537,7 +537,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_dbg("Hardware acquisition started successfully."); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Time when we should be done (for detecting trigger timeouts). */ devc->done = (devc->divcount + 1) * devc->prof->trigger_constant + @@ -555,7 +555,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) { sr_dbg("Stopping acquisition."); sr_session_source_remove(sdi->session, -1); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); return SR_OK; } diff --git a/src/hardware/colead-slm/api.c b/src/hardware/colead-slm/api.c index 85ccd86c..3ed4c85a 100644 --- a/src/hardware/colead-slm/api.c +++ b/src/hardware/colead-slm/api.c @@ -127,7 +127,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) return SR_ERR_DEV_CLOSED; sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 150ms, or whenever some data comes in. */ serial = sdi->conn; @@ -140,7 +140,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close, - sdi->conn, LOG_PREFIX); + sdi->conn); } static struct sr_dev_driver colead_slm_driver_info = { diff --git a/src/hardware/demo/demo.c b/src/hardware/demo/demo.c index bd9189d6..288abef2 100644 --- a/src/hardware/demo/demo.c +++ b/src/hardware/demo/demo.c @@ -850,7 +850,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_session_source_add(sdi->session, -1, 0, 100, prepare_data, (struct sr_dev_inst *)sdi); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* We use this timestamp to decide how many more samples to send. */ devc->start_us = g_get_monotonic_time(); @@ -863,7 +863,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) { sr_dbg("Stopping acquisition."); sr_session_source_remove(sdi->session, -1); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); return SR_OK; } diff --git a/src/hardware/fluke-dmm/api.c b/src/hardware/fluke-dmm/api.c index deca6c9e..f9683e6a 100644 --- a/src/hardware/fluke-dmm/api.c +++ b/src/hardware/fluke-dmm/api.c @@ -227,7 +227,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc = sdi->priv; sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 100ms, or whenever some data comes in. */ serial = sdi->conn; @@ -247,7 +247,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close, - sdi->conn, LOG_PREFIX); + sdi->conn); } static struct sr_dev_driver flukedmm_driver_info = { diff --git a/src/hardware/ftdi-la/api.c b/src/hardware/ftdi-la/api.c index 78dc23f7..22715a1f 100644 --- a/src/hardware/ftdi-la/api.c +++ b/src/hardware/ftdi-la/api.c @@ -451,7 +451,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc->samples_sent = 0; devc->bytes_received = 0; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Hook up a dummy handler to receive data from the device. */ sr_session_source_add(sdi->session, -1, G_IO_IN, 0, @@ -468,7 +468,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) sr_dbg("Stopping acquisition."); sr_session_source_remove(sdi->session, -1); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); return SR_OK; } diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index 46b9ee34..e1eb3ee1 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -857,7 +857,7 @@ static int start_transfers(const struct sr_dev_inst *sdi) else devc->send_data_proc = la_send_data_proc; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); return SR_OK; } @@ -873,7 +873,7 @@ static void LIBUSB_CALL dslogic_trigger_receive(struct libusb_transfer *transfer if (transfer->status == LIBUSB_TRANSFER_CANCELLED) { sr_dbg("Trigger transfer canceled."); /* Terminate session. */ - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); usb_source_remove(sdi->session, devc->ctx); devc->num_transfers = 0; g_free(devc->transfers); diff --git a/src/hardware/fx2lafw/protocol.c b/src/hardware/fx2lafw/protocol.c index 3ec904c2..8e69b77f 100644 --- a/src/hardware/fx2lafw/protocol.c +++ b/src/hardware/fx2lafw/protocol.c @@ -331,7 +331,7 @@ static void finish_acquisition(struct sr_dev_inst *sdi) devc = sdi->priv; - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); usb_source_remove(sdi->session, devc->ctx); diff --git a/src/hardware/gmc-mh-1x-2x/api.c b/src/hardware/gmc-mh-1x-2x/api.c index 0ca9029f..a2688eee 100644 --- a/src/hardware/gmc-mh-1x-2x/api.c +++ b/src/hardware/gmc-mh-1x-2x/api.c @@ -434,7 +434,7 @@ static int dev_acquisition_start_1x_2x_rs232(const struct sr_dev_inst *sdi) devc->buflen = 0; sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 40ms, or whenever some data comes in. */ serial = sdi->conn; @@ -457,7 +457,7 @@ static int dev_acquisition_start_2x_bd232(const struct sr_dev_inst *sdi) devc->buflen = 0; sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 40ms, or whenever some data comes in. */ serial = sdi->conn; @@ -471,7 +471,7 @@ static int dev_acquisition_start_2x_bd232(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, dev_close, - sdi->conn, LOG_PREFIX); + sdi->conn); } static struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info = { diff --git a/src/hardware/gwinstek-gds-800/api.c b/src/hardware/gwinstek-gds-800/api.c index 656b61e3..2889a814 100644 --- a/src/hardware/gwinstek-gds-800/api.c +++ b/src/hardware/gwinstek-gds-800/api.c @@ -229,7 +229,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) packet.type = SR_DF_FRAME_END; sr_session_send(sdi, &packet); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); devc->df_started = FALSE; } diff --git a/src/hardware/gwinstek-gds-800/protocol.c b/src/hardware/gwinstek-gds-800/protocol.c index 77058577..09ce9ee5 100644 --- a/src/hardware/gwinstek-gds-800/protocol.c +++ b/src/hardware/gwinstek-gds-800/protocol.c @@ -196,7 +196,7 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data) devc->state = WAIT_FOR_TRANSFER_OF_CHANNEL_INDICATOR_COMPLETE; if (!devc->df_started) { - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); packet.type = SR_DF_FRAME_BEGIN; sr_session_send(sdi, &packet); diff --git a/src/hardware/hameg-hmo/api.c b/src/hardware/hameg-hmo/api.c index 4ed9527e..fe32262d 100644 --- a/src/hardware/hameg-hmo/api.c +++ b/src/hardware/hameg-hmo/api.c @@ -745,7 +745,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_scpi_source_add(sdi->session, scpi, G_IO_IN, 50, hmo_receive_data, (void *)sdi); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); devc->current_channel = devc->enabled_channels; @@ -757,7 +757,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) struct dev_context *devc; struct sr_scpi_dev_inst *scpi; - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; diff --git a/src/hardware/hantek-6xxx/api.c b/src/hardware/hantek-6xxx/api.c index 5c2a478a..27eacf4a 100644 --- a/src/hardware/hantek-6xxx/api.c +++ b/src/hardware/hantek-6xxx/api.c @@ -739,7 +739,7 @@ static int handle_event(int fd, int revents, void *cb_data) */ usb_source_remove(sdi->session, drvc->sr_ctx); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); devc->dev_state = IDLE; @@ -768,7 +768,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) if (hantek_6xxx_init(sdi) != SR_OK) return SR_ERR; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); devc->samp_received = 0; devc->dev_state = FLUSH; diff --git a/src/hardware/hantek-dso/api.c b/src/hardware/hantek-dso/api.c index eb6c8b63..1604a18c 100644 --- a/src/hardware/hantek-dso/api.c +++ b/src/hardware/hantek-dso/api.c @@ -862,7 +862,7 @@ static int handle_event(int fd, int revents, void *cb_data) */ usb_source_remove(sdi->session, drvc->sr_ctx); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); devc->dev_state = IDLE; @@ -971,7 +971,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc->dev_state = CAPTURE; usb_source_add(sdi->session, drvc->sr_ctx, TICK, handle_event, (void *)sdi); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); return SR_OK; } diff --git a/src/hardware/hp-3457a/api.c b/src/hardware/hp-3457a/api.c index 16b44a77..3bcc723b 100644 --- a/src/hardware/hp-3457a/api.c +++ b/src/hardware/hp-3457a/api.c @@ -378,7 +378,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) if (ret != SR_OK) return ret; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); front_selected = rear_selected = FALSE; devc->active_channels = NULL; diff --git a/src/hardware/hung-chang-dso-2100/api.c b/src/hardware/hung-chang-dso-2100/api.c index 842bdc21..56acd856 100644 --- a/src/hardware/hung-chang-dso-2100/api.c +++ b/src/hardware/hung-chang-dso-2100/api.c @@ -682,7 +682,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) if (ret != SR_OK) return ret; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); sr_session_source_add(sdi->session, -1, 0, 8, hung_chang_dso_2100_poll, (void *)sdi); @@ -695,7 +695,7 @@ SR_PRIV int hung_chang_dso_2100_dev_acquisition_stop(const struct sr_dev_inst *s if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); sr_session_source_remove(sdi->session, -1); hung_chang_dso_2100_move_to(sdi, 1); diff --git a/src/hardware/ikalogic-scanalogic2/api.c b/src/hardware/ikalogic-scanalogic2/api.c index 2d194abd..c82422a5 100644 --- a/src/hardware/ikalogic-scanalogic2/api.c +++ b/src/hardware/ikalogic-scanalogic2/api.c @@ -434,7 +434,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_dbg("Acquisition started successfully."); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); devc->next_state = STATE_SAMPLE; diff --git a/src/hardware/ikalogic-scanalogic2/protocol.c b/src/hardware/ikalogic-scanalogic2/protocol.c index 621fb000..45d60db5 100644 --- a/src/hardware/ikalogic-scanalogic2/protocol.c +++ b/src/hardware/ikalogic-scanalogic2/protocol.c @@ -28,7 +28,7 @@ static void stop_acquisition(struct sr_dev_inst *sdi) usb_source_remove(sdi->session, drvc->sr_ctx); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); sdi->status = SR_ST_ACTIVE; } @@ -39,7 +39,7 @@ static void abort_acquisition(struct sr_dev_inst *sdi) usb_source_remove(sdi->session, drvc->sr_ctx); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); sdi->driver->dev_close(sdi); } diff --git a/src/hardware/ikalogic-scanaplus/api.c b/src/hardware/ikalogic-scanaplus/api.c index fc54ae43..af33244d 100644 --- a/src/hardware/ikalogic-scanaplus/api.c +++ b/src/hardware/ikalogic-scanaplus/api.c @@ -349,7 +349,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) if ((ret = scanaplus_start_acquisition(devc)) < 0) return ret; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Hook up a dummy handler to receive data from the device. */ sr_session_source_add(sdi->session, -1, 0, 0, scanaplus_receive_data, (void *)sdi); @@ -361,7 +361,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) { sr_dbg("Stopping acquisition."); sr_session_source_remove(sdi->session, -1); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); return SR_OK; } diff --git a/src/hardware/kecheng-kc-330b/api.c b/src/hardware/kecheng-kc-330b/api.c index 4dacfdc0..a4e62619 100644 --- a/src/hardware/kecheng-kc-330b/api.c +++ b/src/hardware/kecheng-kc-330b/api.c @@ -389,7 +389,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc->num_samples = 0; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); if (devc->data_source == DATA_SOURCE_LIVE) { /* Force configuration. */ @@ -412,7 +412,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc->stored_samples = (buf[7] << 8) | buf[8]; if (devc->stored_samples == 0) { /* Notify frontend of empty log by sending start/end packets. */ - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); return SR_OK; } diff --git a/src/hardware/kecheng-kc-330b/protocol.c b/src/hardware/kecheng-kc-330b/protocol.c index 644d9677..968ef696 100644 --- a/src/hardware/kecheng-kc-330b/protocol.c +++ b/src/hardware/kecheng-kc-330b/protocol.c @@ -51,7 +51,7 @@ SR_PRIV int kecheng_kc_330b_handle_events(int fd, int revents, void *cb_data) if (sdi->status == SR_ST_STOPPING) { libusb_free_transfer(devc->xfer); usb_source_remove(sdi->session, drvc->sr_ctx); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); sdi->status = SR_ST_ACTIVE; return TRUE; } diff --git a/src/hardware/kern-scale/api.c b/src/hardware/kern-scale/api.c index 7fa66bb3..1af8362a 100644 --- a/src/hardware/kern-scale/api.c +++ b/src/hardware/kern-scale/api.c @@ -165,7 +165,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) /* Device replies with "A00\r\n" (OK) or "E01\r\n" (Error). Ignore. */ sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 50ms, or whenever some data comes in. */ serial_source_add(sdi->session, serial, G_IO_IN, 50, @@ -177,7 +177,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close, - sdi->conn, LOG_PREFIX); + sdi->conn); } #define SCALE(ID, CHIPSET, VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, \ diff --git a/src/hardware/korad-kaxxxxp/api.c b/src/hardware/korad-kaxxxxp/api.c index 15cc5294..82a75376 100644 --- a/src/hardware/korad-kaxxxxp/api.c +++ b/src/hardware/korad-kaxxxxp/api.c @@ -348,7 +348,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc = sdi->priv; sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); devc->reply_pending = FALSE; devc->req_sent_at = 0; @@ -366,7 +366,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) return SR_ERR_DEV_CLOSED; return std_serial_dev_acquisition_stop(sdi, - std_serial_dev_close, sdi->conn, LOG_PREFIX); + std_serial_dev_close, sdi->conn); } static struct sr_dev_driver korad_kaxxxxp_driver_info = { diff --git a/src/hardware/lascar-el-usb/api.c b/src/hardware/lascar-el-usb/api.c index 32bb958b..405c8f92 100644 --- a/src/hardware/lascar-el-usb/api.c +++ b/src/hardware/lascar-el-usb/api.c @@ -305,7 +305,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_dbg("Starting log retrieval."); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); interval = (devc->config[0x1c] | (devc->config[0x1d] << 8)) * 1000; packet.type = SR_DF_META; @@ -317,7 +317,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) if (devc->logged_samples == 0) { /* This ensures the frontend knows the session is done. */ - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); return SR_OK; } diff --git a/src/hardware/lascar-el-usb/protocol.c b/src/hardware/lascar-el-usb/protocol.c index ceaf9d72..1b6a0ad5 100644 --- a/src/hardware/lascar-el-usb/protocol.c +++ b/src/hardware/lascar-el-usb/protocol.c @@ -491,7 +491,7 @@ SR_PRIV int lascar_el_usb_handle_events(int fd, int revents, void *cb_data) if (sdi->status == SR_ST_STOPPING) { usb_source_remove(sdi->session, drvc->sr_ctx); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); } memset(&tv, 0, sizeof(struct timeval)); diff --git a/src/hardware/lecroy-logicstudio/api.c b/src/hardware/lecroy-logicstudio/api.c index 60325fe4..db423e4b 100644 --- a/src/hardware/lecroy-logicstudio/api.c +++ b/src/hardware/lecroy-logicstudio/api.c @@ -480,7 +480,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) if ((ret = lls_start_acquisition(sdi)) < 0) return ret; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); return usb_source_add(sdi->session, drvc->sr_ctx, 100, receive_usb_data, drvc); diff --git a/src/hardware/lecroy-logicstudio/protocol.c b/src/hardware/lecroy-logicstudio/protocol.c index 11d3ce2c..78376a45 100644 --- a/src/hardware/lecroy-logicstudio/protocol.c +++ b/src/hardware/lecroy-logicstudio/protocol.c @@ -918,7 +918,7 @@ static void LIBUSB_CALL recv_intr_transfer(struct libusb_transfer *xfer) devc = sdi->priv; if (devc->abort_acquisition) { - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); usb_source_remove(sdi->session, drvc->sr_ctx); return; } @@ -1089,7 +1089,7 @@ static void LIBUSB_CALL recv_bulk_transfer(struct libusb_transfer *xfer) read_offset %= SAMPLE_BUF_SIZE; } - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); } static uint32_t transform_sample_count(struct dev_context *devc, diff --git a/src/hardware/link-mso19/api.c b/src/hardware/link-mso19/api.c index a3b00869..7924b231 100644 --- a/src/hardware/link-mso19/api.c +++ b/src/hardware/link-mso19/api.c @@ -380,7 +380,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) /* Reset trigger state. */ devc->trigger_state = 0x00; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Our first channel is analog, the other 8 are of type 'logic'. */ /* TODO. */ diff --git a/src/hardware/link-mso19/protocol.c b/src/hardware/link-mso19/protocol.c index 5c263adb..3952dd99 100644 --- a/src/hardware/link-mso19/protocol.c +++ b/src/hardware/link-mso19/protocol.c @@ -289,7 +289,7 @@ SR_PRIV void stop_acquisition(const struct sr_dev_inst *sdi) devc = sdi->priv; serial_source_remove(sdi->session, devc->serial); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); } SR_PRIV int mso_clkrate_out(struct sr_serial_dev_inst *serial, uint16_t val) diff --git a/src/hardware/manson-hcs-3xxx/api.c b/src/hardware/manson-hcs-3xxx/api.c index 6b6b12e4..c7394e36 100644 --- a/src/hardware/manson-hcs-3xxx/api.c +++ b/src/hardware/manson-hcs-3xxx/api.c @@ -356,7 +356,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc = sdi->priv; sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); devc->reply_pending = FALSE; devc->req_sent_at = 0; @@ -372,7 +372,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, - std_serial_dev_close, sdi->conn, LOG_PREFIX); + std_serial_dev_close, sdi->conn); } static struct sr_dev_driver manson_hcs_3xxx_driver_info = { diff --git a/src/hardware/maynuo-m97/api.c b/src/hardware/maynuo-m97/api.c index 84e90b5e..68225431 100644 --- a/src/hardware/maynuo-m97/api.c +++ b/src/hardware/maynuo-m97/api.c @@ -445,7 +445,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) return ret; sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); return maynuo_m97_capture_start(sdi); } @@ -457,7 +457,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); modbus = sdi->conn; sr_modbus_source_remove(sdi->session, modbus); diff --git a/src/hardware/mic-985xx/api.c b/src/hardware/mic-985xx/api.c index f12aa845..510dbb81 100644 --- a/src/hardware/mic-985xx/api.c +++ b/src/hardware/mic-985xx/api.c @@ -185,7 +185,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, int idx) devc = sdi->priv; sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 100ms, or whenever some data comes in. */ serial = sdi->conn; @@ -198,7 +198,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, int idx) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close, - sdi->conn, LOG_PREFIX); + sdi->conn); } /* Driver-specific API function wrappers */ diff --git a/src/hardware/motech-lps-30x/api.c b/src/hardware/motech-lps-30x/api.c index abc53ce3..59061530 100644 --- a/src/hardware/motech-lps-30x/api.c +++ b/src/hardware/motech-lps-30x/api.c @@ -770,7 +770,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 50, motech_lps_30x_receive_data, (void *)sdi); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); sr_sw_limits_acquisition_start(&devc->limits); @@ -783,7 +783,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close, - sdi->conn, LOG_PREFIX); + sdi->conn); } static struct sr_dev_driver motech_lps_301_driver_info = { diff --git a/src/hardware/norma-dmm/api.c b/src/hardware/norma-dmm/api.c index 04e16a55..0fcfff8f 100644 --- a/src/hardware/norma-dmm/api.c +++ b/src/hardware/norma-dmm/api.c @@ -209,7 +209,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc = sdi->priv; sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 100ms, or whenever some data comes in. */ serial = sdi->conn; @@ -222,7 +222,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close, - sdi->conn, LOG_PREFIX); + sdi->conn); } static struct sr_dev_driver norma_dmm_driver_info = { diff --git a/src/hardware/openbench-logic-sniffer/api.c b/src/hardware/openbench-logic-sniffer/api.c index 970d4a61..1e22c5b8 100644 --- a/src/hardware/openbench-logic-sniffer/api.c +++ b/src/hardware/openbench-logic-sniffer/api.c @@ -543,7 +543,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc->cnt_bytes = devc->cnt_samples = devc->cnt_samples_rle = 0; memset(devc->sample, 0, 4); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* If the device stops sending for longer than it takes to send a byte, * that means it's finished. But wait at least 100 ms to be safe. diff --git a/src/hardware/openbench-logic-sniffer/protocol.c b/src/hardware/openbench-logic-sniffer/protocol.c index f88729d5..a7c3f963 100644 --- a/src/hardware/openbench-logic-sniffer/protocol.c +++ b/src/hardware/openbench-logic-sniffer/protocol.c @@ -317,7 +317,7 @@ SR_PRIV void abort_acquisition(const struct sr_dev_inst *sdi) serial = sdi->conn; serial_source_remove(sdi->session, serial); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); } SR_PRIV int ols_receive_data(int fd, int revents, void *cb_data) diff --git a/src/hardware/pce-322a/api.c b/src/hardware/pce-322a/api.c index 57f49bf6..e53723c7 100644 --- a/src/hardware/pce-322a/api.c +++ b/src/hardware/pce-322a/api.c @@ -309,7 +309,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc = sdi->priv; devc->buffer_len = 0; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 150ms, or whenever some data comes in. */ serial = sdi->conn; @@ -322,7 +322,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, dev_close, - sdi->conn, LOG_PREFIX); + sdi->conn); } static struct sr_dev_driver pce_322a_driver_info = { diff --git a/src/hardware/pipistrello-ols/api.c b/src/hardware/pipistrello-ols/api.c index 91c7dc2f..ca050bf6 100644 --- a/src/hardware/pipistrello-ols/api.c +++ b/src/hardware/pipistrello-ols/api.c @@ -667,7 +667,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc->cnt_bytes = devc->cnt_samples = devc->cnt_samples_rle = 0; memset(devc->sample, 0, 4); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Hook up a dummy handler to receive data from the device. */ sr_session_source_add(sdi->session, -1, 0, 10, p_ols_receive_data, @@ -691,7 +691,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) sr_session_source_remove(sdi->session, -1); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); return SR_OK; } diff --git a/src/hardware/rigol-ds/api.c b/src/hardware/rigol-ds/api.c index 6668d9cd..4d105381 100644 --- a/src/hardware/rigol-ds/api.c +++ b/src/hardware/rigol-ds/api.c @@ -1018,7 +1018,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_scpi_source_add(sdi->session, scpi, G_IO_IN, 50, rigol_ds_receive, (void *)sdi); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); devc->channel_entry = devc->enabled_channels; @@ -1044,7 +1044,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) return SR_ERR; } - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); g_slist_free(devc->enabled_channels); devc->enabled_channels = NULL; diff --git a/src/hardware/saleae-logic16/api.c b/src/hardware/saleae-logic16/api.c index 3eb9f403..3597d3f1 100644 --- a/src/hardware/saleae-logic16/api.c +++ b/src/hardware/saleae-logic16/api.c @@ -761,7 +761,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) usb_source_add(sdi->session, devc->ctx, timeout, receive_data, (void *)sdi); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); if ((ret = logic16_start_acquisition(sdi)) != SR_OK) { abort_acquisition(devc); diff --git a/src/hardware/saleae-logic16/protocol.c b/src/hardware/saleae-logic16/protocol.c index 997a829a..28a4c52f 100644 --- a/src/hardware/saleae-logic16/protocol.c +++ b/src/hardware/saleae-logic16/protocol.c @@ -753,7 +753,7 @@ static void finish_acquisition(struct sr_dev_inst *sdi) devc = sdi->priv; - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); usb_source_remove(sdi->session, devc->ctx); diff --git a/src/hardware/scpi-pps/api.c b/src/hardware/scpi-pps/api.c index ad3d0a37..5bce3af0 100644 --- a/src/hardware/scpi-pps/api.c +++ b/src/hardware/scpi-pps/api.c @@ -652,7 +652,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) if ((ret = sr_scpi_source_add(sdi->session, scpi, G_IO_IN, 10, scpi_pps_receive_data, (void *)sdi)) != SR_OK) return ret; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Prime the pipe with the first channel's fetch. */ ch = sr_next_enabled_channel(sdi, NULL); @@ -692,7 +692,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) sr_scpi_get_float(scpi, NULL, &f); sr_scpi_source_remove(sdi->session, scpi); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); return SR_OK; } diff --git a/src/hardware/serial-dmm/api.c b/src/hardware/serial-dmm/api.c index af70fc30..7cd444fb 100644 --- a/src/hardware/serial-dmm/api.c +++ b/src/hardware/serial-dmm/api.c @@ -185,7 +185,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc = sdi->priv; sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 50ms, or whenever some data comes in. */ serial = sdi->conn; @@ -198,7 +198,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close, - sdi->conn, LOG_PREFIX); + sdi->conn); } #define DMM(ID, CHIPSET, VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, TIMEOUT, \ diff --git a/src/hardware/sysclk-lwla/protocol.c b/src/hardware/sysclk-lwla/protocol.c index b4c3171e..986aa612 100644 --- a/src/hardware/sysclk-lwla/protocol.c +++ b/src/hardware/sysclk-lwla/protocol.c @@ -316,7 +316,7 @@ static int transfer_event(int fd, int revents, void *cb_data) /* We are done, clean up and send end packet to session bus. */ clear_acquisition_state(sdi); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); return G_SOURCE_REMOVE; } @@ -574,7 +574,7 @@ SR_PRIV int lwla_start_acquisition(const struct sr_dev_inst *sdi) ret = submit_request(sdi, STATE_START_CAPTURE); if (ret == SR_OK) - ret = std_session_send_df_header(sdi, LOG_PREFIX); + ret = std_session_send_df_header(sdi); if (ret != SR_OK) { usb_source_remove(sdi->session, drvc->sr_ctx); diff --git a/src/hardware/teleinfo/api.c b/src/hardware/teleinfo/api.c index 89344337..d234bb10 100644 --- a/src/hardware/teleinfo/api.c +++ b/src/hardware/teleinfo/api.c @@ -170,7 +170,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->sw_limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 50ms, or whenever some data comes in. */ serial_source_add(sdi->session, serial, G_IO_IN, 50, @@ -182,7 +182,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, - std_serial_dev_close, sdi->conn, LOG_PREFIX); + std_serial_dev_close, sdi->conn); } static struct sr_dev_driver teleinfo_driver_info = { diff --git a/src/hardware/testo/api.c b/src/hardware/testo/api.c index 4d9a7a42..2f44eaad 100644 --- a/src/hardware/testo/api.c +++ b/src/hardware/testo/api.c @@ -352,7 +352,7 @@ static int handle_events(int fd, int revents, void *cb_data) if (sdi->status == SR_ST_STOPPING) { usb_source_remove(sdi->session, drvc->sr_ctx); dev_close(sdi); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); } memset(&tv, 0, sizeof(struct timeval)); @@ -381,7 +381,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) usb = sdi->conn; devc->reply_size = 0; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); usb_source_add(sdi->session, drvc->sr_ctx, 100, handle_events, (void *)sdi); diff --git a/src/hardware/tondaj-sl-814/api.c b/src/hardware/tondaj-sl-814/api.c index 0e1c680f..d2ef3288 100644 --- a/src/hardware/tondaj-sl-814/api.c +++ b/src/hardware/tondaj-sl-814/api.c @@ -137,7 +137,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); sr_sw_limits_acquisition_start(&devc->limits); @@ -152,7 +152,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close, - sdi->conn, LOG_PREFIX); + sdi->conn); } static struct sr_dev_driver tondaj_sl_814_driver_info = { diff --git a/src/hardware/uni-t-dmm/api.c b/src/hardware/uni-t-dmm/api.c index 02e301cc..97d079f5 100644 --- a/src/hardware/uni-t-dmm/api.c +++ b/src/hardware/uni-t-dmm/api.c @@ -164,7 +164,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); sr_session_source_add(sdi->session, -1, 0, 10 /* poll_timeout */, uni_t_dmm_receive_data, (void *)sdi); @@ -175,7 +175,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { sr_dbg("Stopping acquisition."); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); sr_session_source_remove(sdi->session, -1); return SR_OK; diff --git a/src/hardware/uni-t-ut32x/api.c b/src/hardware/uni-t-ut32x/api.c index bc4ad438..8e84c2c1 100644 --- a/src/hardware/uni-t-ut32x/api.c +++ b/src/hardware/uni-t-ut32x/api.c @@ -254,7 +254,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) return SR_ERR; } - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); if (!(devc->xfer = libusb_alloc_transfer(0))) return SR_ERR; diff --git a/src/hardware/uni-t-ut32x/protocol.c b/src/hardware/uni-t-ut32x/protocol.c index 4287e393..0b4d2da2 100644 --- a/src/hardware/uni-t-ut32x/protocol.c +++ b/src/hardware/uni-t-ut32x/protocol.c @@ -215,7 +215,7 @@ SR_PRIV int uni_t_ut32x_handle_events(int fd, int revents, void *cb_data) if (sdi->status == SR_ST_STOPPING) { usb_source_remove(sdi->session, drvc->sr_ctx); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); /* Tell the device to stop sending USB packets. */ usb = sdi->conn; diff --git a/src/hardware/victor-dmm/api.c b/src/hardware/victor-dmm/api.c index 3a132a17..b5502043 100644 --- a/src/hardware/victor-dmm/api.c +++ b/src/hardware/victor-dmm/api.c @@ -273,7 +273,7 @@ static int handle_events(int fd, int revents, void *cb_data) if (sdi->status == SR_ST_STOPPING) { usb_source_remove(sdi->session, drvc->sr_ctx); dev_close(sdi); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); } memset(&tv, 0, sizeof(struct timeval)); @@ -297,7 +297,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) usb = sdi->conn; - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); usb_source_add(sdi->session, drvc->sr_ctx, 100, handle_events, (void *)sdi); diff --git a/src/hardware/yokogawa-dlm/api.c b/src/hardware/yokogawa-dlm/api.c index 103bb030..99647913 100644 --- a/src/hardware/yokogawa-dlm/api.c +++ b/src/hardware/yokogawa-dlm/api.c @@ -660,7 +660,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) { struct dev_context *devc; - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; diff --git a/src/hardware/zeroplus-logic-cube/api.c b/src/hardware/zeroplus-logic-cube/api.c index 547d8152..b2fe6079 100644 --- a/src/hardware/zeroplus-logic-cube/api.c +++ b/src/hardware/zeroplus-logic-cube/api.c @@ -522,11 +522,11 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_info("Ramsize trigger = 0x%x.", ramsize_trigger); sr_info("Memory size = 0x%x.", memory_size); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Check for empty capture */ if ((status & STATUS_READY) && !stop_address) { - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); return SR_OK; } @@ -634,7 +634,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) analyzer_read_stop(usb->devhdl); g_free(buf); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); return SR_OK; } @@ -644,7 +644,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) { struct sr_usb_dev_inst *usb; - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); usb = sdi->conn; analyzer_reset(usb->devhdl); diff --git a/src/input/binary.c b/src/input/binary.c index e693f581..4984edb0 100644 --- a/src/input/binary.c +++ b/src/input/binary.c @@ -75,7 +75,7 @@ static int process_buffer(struct sr_input *in) inc = in->priv; if (!inc->started) { - std_session_send_df_header(in->sdi, LOG_PREFIX); + std_session_send_df_header(in->sdi); if (inc->samplerate) { packet.type = SR_DF_META; @@ -137,7 +137,7 @@ static int end(struct sr_input *in) inc = in->priv; if (inc->started) - std_session_send_df_end(in->sdi, LOG_PREFIX); + std_session_send_df_end(in->sdi); return ret; } diff --git a/src/input/chronovu_la8.c b/src/input/chronovu_la8.c index 48c04b90..9c7b2205 100644 --- a/src/input/chronovu_la8.c +++ b/src/input/chronovu_la8.c @@ -87,7 +87,7 @@ static int process_buffer(struct sr_input *in) inc = in->priv; if (!inc->started) { - std_session_send_df_header(in->sdi, LOG_PREFIX); + std_session_send_df_header(in->sdi); if (inc->samplerate) { packet.type = SR_DF_META; @@ -149,7 +149,7 @@ static int end(struct sr_input *in) inc = in->priv; if (inc->started) - std_session_send_df_end(in->sdi, LOG_PREFIX); + std_session_send_df_end(in->sdi); return ret; } diff --git a/src/input/csv.c b/src/input/csv.c index a8c68944..1eb20bff 100644 --- a/src/input/csv.c +++ b/src/input/csv.c @@ -612,7 +612,7 @@ static int process_buffer(struct sr_input *in) inc = in->priv; if (!inc->started) { - std_session_send_df_header(in->sdi, LOG_PREFIX); + std_session_send_df_header(in->sdi); if (inc->samplerate) { packet.type = SR_DF_META; @@ -747,7 +747,7 @@ static int end(struct sr_input *in) inc = in->priv; if (inc->started) - std_session_send_df_end(in->sdi, LOG_PREFIX); + std_session_send_df_end(in->sdi); return ret; } diff --git a/src/input/raw_analog.c b/src/input/raw_analog.c index 5241e74c..9c7135f0 100644 --- a/src/input/raw_analog.c +++ b/src/input/raw_analog.c @@ -151,7 +151,7 @@ static int process_buffer(struct sr_input *in) inc = in->priv; if (!inc->started) { - std_session_send_df_header(in->sdi, LOG_PREFIX); + std_session_send_df_header(in->sdi); if (inc->samplerate) { packet.type = SR_DF_META; @@ -227,7 +227,7 @@ static int end(struct sr_input *in) inc = in->priv; if (inc->started) - std_session_send_df_end(in->sdi, LOG_PREFIX); + std_session_send_df_end(in->sdi); return ret; } diff --git a/src/input/trace32_ad.c b/src/input/trace32_ad.c index 4c991a98..a9b1ca4f 100644 --- a/src/input/trace32_ad.c +++ b/src/input/trace32_ad.c @@ -683,7 +683,7 @@ static int process_buffer(struct sr_input *in) } if (!inc->meta_sent) { - std_session_send_df_header(in->sdi, LOG_PREFIX); + std_session_send_df_header(in->sdi); send_metadata(in); } @@ -751,7 +751,7 @@ static int end(struct sr_input *in) flush_output_buffer(in); if (inc->meta_sent) - std_session_send_df_end(in->sdi, LOG_PREFIX); + std_session_send_df_end(in->sdi); return ret; } diff --git a/src/input/vcd.c b/src/input/vcd.c index 39a92d32..3b8aba82 100644 --- a/src/input/vcd.c +++ b/src/input/vcd.c @@ -530,7 +530,7 @@ static int process_buffer(struct sr_input *in) inc = in->priv; if (!inc->started) { - std_session_send_df_header(in->sdi, LOG_PREFIX); + std_session_send_df_header(in->sdi); packet.type = SR_DF_META; packet.payload = &meta; @@ -596,7 +596,7 @@ static int end(struct sr_input *in) send_buffer(in); if (inc->started) - std_session_send_df_end(in->sdi, LOG_PREFIX); + std_session_send_df_end(in->sdi); return ret; } diff --git a/src/input/wav.c b/src/input/wav.c index 0f56a4ad..a07fcd10 100644 --- a/src/input/wav.c +++ b/src/input/wav.c @@ -245,7 +245,7 @@ static int process_buffer(struct sr_input *in) inc = in->priv; if (!inc->started) { - std_session_send_df_header(in->sdi, LOG_PREFIX); + std_session_send_df_header(in->sdi); packet.type = SR_DF_META; packet.payload = &meta; @@ -351,7 +351,7 @@ static int end(struct sr_input *in) inc = in->priv; if (inc->started) - std_session_send_df_end(in->sdi, LOG_PREFIX); + std_session_send_df_end(in->sdi); return ret; } diff --git a/src/lcr/es51919.c b/src/lcr/es51919.c index 3b32df1e..d4b802db 100644 --- a/src/lcr/es51919.c +++ b/src/lcr/es51919.c @@ -914,7 +914,7 @@ SR_PRIV int es51919_serial_acquisition_start(const struct sr_dev_inst *sdi) dev_limit_counter_start(&devc->frame_count); dev_time_counter_start(&devc->time_count); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 50ms, or whenever some data comes in. */ serial = sdi->conn; @@ -927,5 +927,5 @@ SR_PRIV int es51919_serial_acquisition_start(const struct sr_dev_inst *sdi) SR_PRIV int es51919_serial_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, - std_serial_dev_close, sdi->conn, LOG_PREFIX); + std_serial_dev_close, sdi->conn); } diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index ad578e98..2ffffd3d 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -928,12 +928,10 @@ SR_PRIV int std_cleanup(const struct sr_dev_driver *di); SR_PRIV int std_serial_dev_open(struct sr_dev_inst *sdi); SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi, dev_close_callback dev_close_fn, - struct sr_serial_dev_inst *serial, const char *prefix); + struct sr_serial_dev_inst *serial); #endif -SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi, - const char *prefix); -SR_PRIV int std_session_send_df_end(const struct sr_dev_inst *sdi, - const char *prefix); +SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi); +SR_PRIV int std_session_send_df_end(const struct sr_dev_inst *sdi); SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver, std_dev_clear_callback clear_private); SR_PRIV GSList *std_dev_list(const struct sr_dev_driver *di); diff --git a/src/session_driver.c b/src/session_driver.c index c2751223..3aabffa2 100644 --- a/src/session_driver.c +++ b/src/session_driver.c @@ -199,7 +199,7 @@ static int receive_data(int fd, int revents, void *cb_data) vdev->archive = NULL; } - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); return G_SOURCE_REMOVE; } @@ -360,7 +360,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) return SR_ERR; } - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* freewheeling source */ sr_session_source_add(sdi->session, -1, 0, 0, receive_data, (void *)sdi); diff --git a/src/std.c b/src/std.c index fa668a7c..70632319 100644 --- a/src/std.c +++ b/src/std.c @@ -85,24 +85,17 @@ SR_PRIV int std_cleanup(const struct sr_dev_driver *di) * dev_acquisition_start() API callback. * * @param sdi The device instance to use. - * @param prefix A driver-specific prefix string used for log messages. - * Must not be NULL. An empty string is allowed. * * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or * SR_ERR upon other errors. */ -SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi, - const char *prefix) +SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi) { + const char *prefix = sdi->driver->name; int ret; struct sr_datafeed_packet packet; struct sr_datafeed_header header; - if (!prefix) { - sr_err("Invalid prefix."); - return SR_ERR_ARG; - } - sr_dbg("%s: Starting acquisition.", prefix); /* Send header packet to the session bus. */ @@ -124,19 +117,17 @@ SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi, * Standard API helper for sending an SR_DF_END packet. * * @param sdi The device instance to use. Must not be NULL. - * @param prefix A driver-specific prefix string used for log messages. - * Must not be NULL. An empty string is allowed. * * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or * SR_ERR upon other errors. */ -SR_PRIV int std_session_send_df_end(const struct sr_dev_inst *sdi, - const char *prefix) +SR_PRIV int std_session_send_df_end(const struct sr_dev_inst *sdi) { + const char *prefix = sdi->driver->name; int ret; struct sr_datafeed_packet packet; - if (!sdi || !prefix) + if (!sdi) return SR_ERR_ARG; sr_dbg("%s: Sending SR_DF_END packet.", prefix); @@ -217,8 +208,6 @@ SR_PRIV int std_serial_dev_close(struct sr_dev_inst *sdi) * Must not be NULL. * @param serial The serial device instance (struct serial_dev_inst *). * Must not be NULL. - * @param[in] prefix A driver-specific prefix string used for log messages. - * Must not be NULL. An empty string is allowed. * * @retval SR_OK Success. * @retval SR_ERR_ARG Invalid arguments. @@ -227,15 +216,11 @@ SR_PRIV int std_serial_dev_close(struct sr_dev_inst *sdi) */ SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi, dev_close_callback dev_close_fn, - struct sr_serial_dev_inst *serial, const char *prefix) + struct sr_serial_dev_inst *serial) { + const char *prefix = sdi->driver->name; int ret; - if (!prefix) { - sr_err("Invalid prefix."); - return SR_ERR_ARG; - } - if (sdi->status != SR_ST_ACTIVE) { sr_err("%s: Device inactive, can't stop acquisition.", prefix); return SR_ERR_DEV_CLOSED; @@ -253,7 +238,7 @@ SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi, return ret; } - std_session_send_df_end(sdi, prefix); + std_session_send_df_end(sdi); return SR_OK; }