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 <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2016-05-08 15:47:35 +02:00 committed by Uwe Hermann
parent 7d786a962d
commit bee2b0168c
77 changed files with 142 additions and 159 deletions

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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 */

View File

@ -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;
}

View File

@ -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 = {

View File

@ -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;
}

View File

@ -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 = {

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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 = {

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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, \

View File

@ -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 = {

View File

@ -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;
}

View File

@ -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));

View File

@ -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);

View File

@ -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,

View File

@ -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. */

View File

@ -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)

View File

@ -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 = {

View File

@ -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);

View File

@ -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 */

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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.

View File

@ -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)

View File

@ -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 = {

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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, \

View File

@ -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);

View File

@ -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 = {

View File

@ -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);

View File

@ -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 = {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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;
}