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:
parent
7d786a962d
commit
bee2b0168c
|
@ -198,7 +198,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
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. */
|
/* Poll every 100ms, or whenever some data comes in. */
|
||||||
serial = sdi->conn;
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close,
|
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 = {
|
static struct sr_dev_driver agdmm_driver_info = {
|
||||||
|
|
|
@ -206,7 +206,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
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. */
|
/* Poll every 50ms, or whenever some data comes in. */
|
||||||
serial_source_add(sdi->session, serial, G_IO_IN, 50,
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(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 = {
|
static struct sr_dev_driver appa_55ii_driver_info = {
|
||||||
|
|
|
@ -327,7 +327,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
reloadpro_receive_data, (void *)sdi);
|
reloadpro_receive_data, (void *)sdi);
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
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);
|
memset(devc->buf, 0, RELOADPRO_BUFSIZE);
|
||||||
devc->buflen = 0;
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(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 = {
|
static struct sr_dev_driver arachnid_labs_re_load_pro_driver_info = {
|
||||||
|
|
|
@ -372,7 +372,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
gettimeofday(&devc->start_tv, 0);
|
gettimeofday(&devc->start_tv, 0);
|
||||||
sigma_set_register(WRITE_MODE, 0x0d, devc);
|
sigma_set_register(WRITE_MODE, 0x0d, devc);
|
||||||
|
|
||||||
std_session_send_df_header(sdi, LOG_PREFIX);
|
std_session_send_df_header(sdi);
|
||||||
|
|
||||||
/* Add capture source. */
|
/* Add capture source. */
|
||||||
sr_session_source_add(sdi->session, -1, 0, 10, sigma_receive_data, (void *)sdi);
|
sr_session_source_add(sdi->session, -1, 0, 10, sigma_receive_data, (void *)sdi);
|
||||||
|
|
|
@ -906,7 +906,7 @@ static int download_capture(struct sr_dev_inst *sdi)
|
||||||
dl_lines_done += dl_lines_curr;
|
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);
|
sdi->driver->dev_acquisition_stop(sdi);
|
||||||
|
|
||||||
|
|
|
@ -451,7 +451,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
serial = sdi->conn;
|
serial = sdi->conn;
|
||||||
serial_source_add(sdi->session, serial, G_IO_IN, 50,
|
serial_source_add(sdi->session, serial, G_IO_IN, 50,
|
||||||
atten_pps3xxx_receive_data, (void *)sdi);
|
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. */
|
/* Send a "channel" configuration packet now. */
|
||||||
memset(packet, 0, PACKET_SIZE);
|
memset(packet, 0, PACKET_SIZE);
|
||||||
|
|
|
@ -155,7 +155,7 @@ SR_PRIV int atten_pps3xxx_receive_data(int fd, int revents, void *cb_data)
|
||||||
send_config(sdi);
|
send_config(sdi);
|
||||||
else {
|
else {
|
||||||
serial_source_remove(sdi->session, serial);
|
serial_source_remove(sdi->session, serial);
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,7 +348,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
sr_session_source_add_channel(sdi->session, devc->channel,
|
sr_session_source_add_channel(sdi->session, devc->channel,
|
||||||
G_IO_IN | G_IO_ERR, 1000, bl_acme_receive_data, (void *)sdi);
|
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);
|
sr_sw_limits_acquisition_start(&devc->limits);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
|
@ -369,7 +369,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
g_io_channel_unref(devc->channel);
|
g_io_channel_unref(devc->channel);
|
||||||
devc->channel = NULL;
|
devc->channel = NULL;
|
||||||
|
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
if (devc->samples_missed > 0)
|
if (devc->samples_missed > 0)
|
||||||
sr_warn("%" PRIu64 " samples missed", devc->samples_missed);
|
sr_warn("%" PRIu64 " samples missed", devc->samples_missed);
|
||||||
|
|
|
@ -317,7 +317,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
devc->trigger_fired = FALSE;
|
devc->trigger_fired = FALSE;
|
||||||
} else
|
} else
|
||||||
devc->trigger_fired = TRUE;
|
devc->trigger_fired = TRUE;
|
||||||
std_session_send_df_header(sdi, LOG_PREFIX);
|
std_session_send_df_header(sdi);
|
||||||
|
|
||||||
/* Trigger and add poll on file */
|
/* Trigger and add poll on file */
|
||||||
beaglelogic_start(devc);
|
beaglelogic_start(devc);
|
||||||
|
@ -343,7 +343,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
/* Remove session source and send EOT packet */
|
/* Remove session source and send EOT packet */
|
||||||
sr_session_source_remove_pollfd(sdi->session, &devc->pollfd);
|
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;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 ||
|
if (devc->bytes_read >= devc->limit_samples * logic.unitsize ||
|
||||||
packetsize == 0) {
|
packetsize == 0) {
|
||||||
/* Send EOA Packet, stop polling */
|
/* 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);
|
sr_session_source_remove_pollfd(sdi->session, &devc->pollfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->sw_limits);
|
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,
|
sr_session_source_add(sdi->session, -1, 0, 10,
|
||||||
brymen_bm86x_receive_data, (void *)sdi);
|
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)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
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);
|
sr_session_source_remove(sdi->session, -1);
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->sw_limits);
|
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. */
|
/* Poll every 50ms, or whenever some data comes in. */
|
||||||
serial = sdi->conn;
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close,
|
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 = {
|
static struct sr_dev_driver brymen_bm857_driver_info = {
|
||||||
|
|
|
@ -354,7 +354,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
devc->num_samples = 0;
|
devc->num_samples = 0;
|
||||||
devc->buf_len = 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. */
|
/* Poll every 100ms, or whenever some data comes in. */
|
||||||
serial = sdi->conn;
|
serial = sdi->conn;
|
||||||
|
@ -370,7 +370,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close,
|
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 = {
|
static struct sr_dev_driver cem_dt_885x_driver_info = {
|
||||||
|
|
|
@ -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);
|
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. */
|
/* Poll every 500ms, or whenever some data comes in. */
|
||||||
serial = sdi->conn;
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(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 */
|
/* Driver-specific API function wrappers */
|
||||||
|
|
|
@ -537,7 +537,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
sr_dbg("Hardware acquisition started successfully.");
|
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). */
|
/* Time when we should be done (for detecting trigger timeouts). */
|
||||||
devc->done = (devc->divcount + 1) * devc->prof->trigger_constant +
|
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_dbg("Stopping acquisition.");
|
||||||
sr_session_source_remove(sdi->session, -1);
|
sr_session_source_remove(sdi->session, -1);
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
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. */
|
/* Poll every 150ms, or whenever some data comes in. */
|
||||||
serial = sdi->conn;
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close,
|
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 = {
|
static struct sr_dev_driver colead_slm_driver_info = {
|
||||||
|
|
|
@ -850,7 +850,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
sr_session_source_add(sdi->session, -1, 0, 100,
|
sr_session_source_add(sdi->session, -1, 0, 100,
|
||||||
prepare_data, (struct sr_dev_inst *)sdi);
|
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. */
|
/* We use this timestamp to decide how many more samples to send. */
|
||||||
devc->start_us = g_get_monotonic_time();
|
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_dbg("Stopping acquisition.");
|
||||||
sr_session_source_remove(sdi->session, -1);
|
sr_session_source_remove(sdi->session, -1);
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,7 +227,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
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. */
|
/* Poll every 100ms, or whenever some data comes in. */
|
||||||
serial = sdi->conn;
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close,
|
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 = {
|
static struct sr_dev_driver flukedmm_driver_info = {
|
||||||
|
|
|
@ -451,7 +451,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
devc->samples_sent = 0;
|
devc->samples_sent = 0;
|
||||||
devc->bytes_received = 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. */
|
/* Hook up a dummy handler to receive data from the device. */
|
||||||
sr_session_source_add(sdi->session, -1, G_IO_IN, 0,
|
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_dbg("Stopping acquisition.");
|
||||||
sr_session_source_remove(sdi->session, -1);
|
sr_session_source_remove(sdi->session, -1);
|
||||||
|
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -857,7 +857,7 @@ static int start_transfers(const struct sr_dev_inst *sdi)
|
||||||
else
|
else
|
||||||
devc->send_data_proc = la_send_data_proc;
|
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;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
@ -873,7 +873,7 @@ static void LIBUSB_CALL dslogic_trigger_receive(struct libusb_transfer *transfer
|
||||||
if (transfer->status == LIBUSB_TRANSFER_CANCELLED) {
|
if (transfer->status == LIBUSB_TRANSFER_CANCELLED) {
|
||||||
sr_dbg("Trigger transfer canceled.");
|
sr_dbg("Trigger transfer canceled.");
|
||||||
/* Terminate session. */
|
/* Terminate session. */
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
usb_source_remove(sdi->session, devc->ctx);
|
usb_source_remove(sdi->session, devc->ctx);
|
||||||
devc->num_transfers = 0;
|
devc->num_transfers = 0;
|
||||||
g_free(devc->transfers);
|
g_free(devc->transfers);
|
||||||
|
|
|
@ -331,7 +331,7 @@ static void finish_acquisition(struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
usb_source_remove(sdi->session, devc->ctx);
|
usb_source_remove(sdi->session, devc->ctx);
|
||||||
|
|
||||||
|
|
|
@ -434,7 +434,7 @@ static int dev_acquisition_start_1x_2x_rs232(const struct sr_dev_inst *sdi)
|
||||||
devc->buflen = 0;
|
devc->buflen = 0;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
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. */
|
/* Poll every 40ms, or whenever some data comes in. */
|
||||||
serial = sdi->conn;
|
serial = sdi->conn;
|
||||||
|
@ -457,7 +457,7 @@ static int dev_acquisition_start_2x_bd232(const struct sr_dev_inst *sdi)
|
||||||
devc->buflen = 0;
|
devc->buflen = 0;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
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. */
|
/* Poll every 40ms, or whenever some data comes in. */
|
||||||
serial = sdi->conn;
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(sdi, dev_close,
|
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 = {
|
static struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info = {
|
||||||
|
|
|
@ -229,7 +229,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
packet.type = SR_DF_FRAME_END;
|
packet.type = SR_DF_FRAME_END;
|
||||||
sr_session_send(sdi, &packet);
|
sr_session_send(sdi, &packet);
|
||||||
|
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
devc->df_started = FALSE;
|
devc->df_started = FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
devc->state = WAIT_FOR_TRANSFER_OF_CHANNEL_INDICATOR_COMPLETE;
|
||||||
|
|
||||||
if (!devc->df_started) {
|
if (!devc->df_started) {
|
||||||
std_session_send_df_header(sdi, LOG_PREFIX);
|
std_session_send_df_header(sdi);
|
||||||
|
|
||||||
packet.type = SR_DF_FRAME_BEGIN;
|
packet.type = SR_DF_FRAME_BEGIN;
|
||||||
sr_session_send(sdi, &packet);
|
sr_session_send(sdi, &packet);
|
||||||
|
|
|
@ -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,
|
sr_scpi_source_add(sdi->session, scpi, G_IO_IN, 50,
|
||||||
hmo_receive_data, (void *)sdi);
|
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;
|
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 dev_context *devc;
|
||||||
struct sr_scpi_dev_inst *scpi;
|
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)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
|
@ -739,7 +739,7 @@ static int handle_event(int fd, int revents, void *cb_data)
|
||||||
*/
|
*/
|
||||||
usb_source_remove(sdi->session, drvc->sr_ctx);
|
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;
|
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)
|
if (hantek_6xxx_init(sdi) != SR_OK)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
std_session_send_df_header(sdi, LOG_PREFIX);
|
std_session_send_df_header(sdi);
|
||||||
|
|
||||||
devc->samp_received = 0;
|
devc->samp_received = 0;
|
||||||
devc->dev_state = FLUSH;
|
devc->dev_state = FLUSH;
|
||||||
|
|
|
@ -862,7 +862,7 @@ static int handle_event(int fd, int revents, void *cb_data)
|
||||||
*/
|
*/
|
||||||
usb_source_remove(sdi->session, drvc->sr_ctx);
|
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;
|
devc->dev_state = IDLE;
|
||||||
|
|
||||||
|
@ -971,7 +971,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
devc->dev_state = CAPTURE;
|
devc->dev_state = CAPTURE;
|
||||||
usb_source_add(sdi->session, drvc->sr_ctx, TICK, handle_event, (void *)sdi);
|
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;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -378,7 +378,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
if (ret != SR_OK)
|
if (ret != SR_OK)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
std_session_send_df_header(sdi, LOG_PREFIX);
|
std_session_send_df_header(sdi);
|
||||||
|
|
||||||
front_selected = rear_selected = FALSE;
|
front_selected = rear_selected = FALSE;
|
||||||
devc->active_channels = NULL;
|
devc->active_channels = NULL;
|
||||||
|
|
|
@ -682,7 +682,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
if (ret != SR_OK)
|
if (ret != SR_OK)
|
||||||
return ret;
|
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,
|
sr_session_source_add(sdi->session, -1, 0, 8,
|
||||||
hung_chang_dso_2100_poll, (void *)sdi);
|
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)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
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);
|
sr_session_source_remove(sdi->session, -1);
|
||||||
hung_chang_dso_2100_move_to(sdi, 1);
|
hung_chang_dso_2100_move_to(sdi, 1);
|
||||||
|
|
||||||
|
|
|
@ -434,7 +434,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
sr_dbg("Acquisition started successfully.");
|
sr_dbg("Acquisition started successfully.");
|
||||||
|
|
||||||
std_session_send_df_header(sdi, LOG_PREFIX);
|
std_session_send_df_header(sdi);
|
||||||
|
|
||||||
devc->next_state = STATE_SAMPLE;
|
devc->next_state = STATE_SAMPLE;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ static void stop_acquisition(struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
usb_source_remove(sdi->session, drvc->sr_ctx);
|
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;
|
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);
|
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);
|
sdi->driver->dev_close(sdi);
|
||||||
}
|
}
|
||||||
|
|
|
@ -349,7 +349,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
if ((ret = scanaplus_start_acquisition(devc)) < 0)
|
if ((ret = scanaplus_start_acquisition(devc)) < 0)
|
||||||
return ret;
|
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. */
|
/* 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);
|
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_dbg("Stopping acquisition.");
|
||||||
sr_session_source_remove(sdi->session, -1);
|
sr_session_source_remove(sdi->session, -1);
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -389,7 +389,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
devc->num_samples = 0;
|
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) {
|
if (devc->data_source == DATA_SOURCE_LIVE) {
|
||||||
/* Force configuration. */
|
/* 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];
|
devc->stored_samples = (buf[7] << 8) | buf[8];
|
||||||
if (devc->stored_samples == 0) {
|
if (devc->stored_samples == 0) {
|
||||||
/* Notify frontend of empty log by sending start/end packets. */
|
/* 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;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
if (sdi->status == SR_ST_STOPPING) {
|
||||||
libusb_free_transfer(devc->xfer);
|
libusb_free_transfer(devc->xfer);
|
||||||
usb_source_remove(sdi->session, drvc->sr_ctx);
|
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;
|
sdi->status = SR_ST_ACTIVE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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. */
|
/* Device replies with "A00\r\n" (OK) or "E01\r\n" (Error). Ignore. */
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
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. */
|
/* Poll every 50ms, or whenever some data comes in. */
|
||||||
serial_source_add(sdi->session, serial, G_IO_IN, 50,
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close,
|
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, \
|
#define SCALE(ID, CHIPSET, VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, \
|
||||||
|
|
|
@ -348,7 +348,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
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->reply_pending = FALSE;
|
||||||
devc->req_sent_at = 0;
|
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 SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
return std_serial_dev_acquisition_stop(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 korad_kaxxxxp_driver_info = {
|
static struct sr_dev_driver korad_kaxxxxp_driver_info = {
|
||||||
|
|
|
@ -305,7 +305,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
sr_dbg("Starting log retrieval.");
|
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;
|
interval = (devc->config[0x1c] | (devc->config[0x1d] << 8)) * 1000;
|
||||||
packet.type = SR_DF_META;
|
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) {
|
if (devc->logged_samples == 0) {
|
||||||
/* This ensures the frontend knows the session is done. */
|
/* 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;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
if (sdi->status == SR_ST_STOPPING) {
|
||||||
usb_source_remove(sdi->session, drvc->sr_ctx);
|
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));
|
memset(&tv, 0, sizeof(struct timeval));
|
||||||
|
|
|
@ -480,7 +480,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
if ((ret = lls_start_acquisition(sdi)) < 0)
|
if ((ret = lls_start_acquisition(sdi)) < 0)
|
||||||
return ret;
|
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,
|
return usb_source_add(sdi->session, drvc->sr_ctx, 100,
|
||||||
receive_usb_data, drvc);
|
receive_usb_data, drvc);
|
||||||
|
|
|
@ -918,7 +918,7 @@ static void LIBUSB_CALL recv_intr_transfer(struct libusb_transfer *xfer)
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
if (devc->abort_acquisition) {
|
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);
|
usb_source_remove(sdi->session, drvc->sr_ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1089,7 +1089,7 @@ static void LIBUSB_CALL recv_bulk_transfer(struct libusb_transfer *xfer)
|
||||||
read_offset %= SAMPLE_BUF_SIZE;
|
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,
|
static uint32_t transform_sample_count(struct dev_context *devc,
|
||||||
|
|
|
@ -380,7 +380,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
/* Reset trigger state. */
|
/* Reset trigger state. */
|
||||||
devc->trigger_state = 0x00;
|
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'. */
|
/* Our first channel is analog, the other 8 are of type 'logic'. */
|
||||||
/* TODO. */
|
/* TODO. */
|
||||||
|
|
|
@ -289,7 +289,7 @@ SR_PRIV void stop_acquisition(const struct sr_dev_inst *sdi)
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
serial_source_remove(sdi->session, devc->serial);
|
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)
|
SR_PRIV int mso_clkrate_out(struct sr_serial_dev_inst *serial, uint16_t val)
|
||||||
|
|
|
@ -356,7 +356,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
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->reply_pending = FALSE;
|
||||||
devc->req_sent_at = 0;
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(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 = {
|
static struct sr_dev_driver manson_hcs_3xxx_driver_info = {
|
||||||
|
|
|
@ -445,7 +445,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
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);
|
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)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
modbus = sdi->conn;
|
modbus = sdi->conn;
|
||||||
sr_modbus_source_remove(sdi->session, modbus);
|
sr_modbus_source_remove(sdi->session, modbus);
|
||||||
|
|
|
@ -185,7 +185,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, int idx)
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
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. */
|
/* Poll every 100ms, or whenever some data comes in. */
|
||||||
serial = sdi->conn;
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close,
|
return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close,
|
||||||
sdi->conn, LOG_PREFIX);
|
sdi->conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Driver-specific API function wrappers */
|
/* Driver-specific API function wrappers */
|
||||||
|
|
|
@ -770,7 +770,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
serial = sdi->conn;
|
serial = sdi->conn;
|
||||||
serial_source_add(sdi->session, serial, G_IO_IN, 50,
|
serial_source_add(sdi->session, serial, G_IO_IN, 50,
|
||||||
motech_lps_30x_receive_data, (void *)sdi);
|
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);
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close,
|
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 = {
|
static struct sr_dev_driver motech_lps_301_driver_info = {
|
||||||
|
|
|
@ -209,7 +209,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
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. */
|
/* Poll every 100ms, or whenever some data comes in. */
|
||||||
serial = sdi->conn;
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close,
|
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 = {
|
static struct sr_dev_driver norma_dmm_driver_info = {
|
||||||
|
|
|
@ -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;
|
devc->cnt_bytes = devc->cnt_samples = devc->cnt_samples_rle = 0;
|
||||||
memset(devc->sample, 0, 4);
|
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,
|
/* 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.
|
* that means it's finished. But wait at least 100 ms to be safe.
|
||||||
|
|
|
@ -317,7 +317,7 @@ SR_PRIV void abort_acquisition(const struct sr_dev_inst *sdi)
|
||||||
serial = sdi->conn;
|
serial = sdi->conn;
|
||||||
serial_source_remove(sdi->session, serial);
|
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)
|
SR_PRIV int ols_receive_data(int fd, int revents, void *cb_data)
|
||||||
|
|
|
@ -309,7 +309,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
devc->buffer_len = 0;
|
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. */
|
/* Poll every 150ms, or whenever some data comes in. */
|
||||||
serial = sdi->conn;
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(sdi, dev_close,
|
return std_serial_dev_acquisition_stop(sdi, dev_close,
|
||||||
sdi->conn, LOG_PREFIX);
|
sdi->conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct sr_dev_driver pce_322a_driver_info = {
|
static struct sr_dev_driver pce_322a_driver_info = {
|
||||||
|
|
|
@ -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;
|
devc->cnt_bytes = devc->cnt_samples = devc->cnt_samples_rle = 0;
|
||||||
memset(devc->sample, 0, 4);
|
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. */
|
/* Hook up a dummy handler to receive data from the device. */
|
||||||
sr_session_source_add(sdi->session, -1, 0, 10, p_ols_receive_data,
|
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);
|
sr_session_source_remove(sdi->session, -1);
|
||||||
|
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
sr_scpi_source_add(sdi->session, scpi, G_IO_IN, 50,
|
||||||
rigol_ds_receive, (void *)sdi);
|
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;
|
devc->channel_entry = devc->enabled_channels;
|
||||||
|
|
||||||
|
@ -1044,7 +1044,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
g_slist_free(devc->enabled_channels);
|
g_slist_free(devc->enabled_channels);
|
||||||
devc->enabled_channels = NULL;
|
devc->enabled_channels = NULL;
|
||||||
|
|
|
@ -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);
|
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) {
|
if ((ret = logic16_start_acquisition(sdi)) != SR_OK) {
|
||||||
abort_acquisition(devc);
|
abort_acquisition(devc);
|
||||||
|
|
|
@ -753,7 +753,7 @@ static void finish_acquisition(struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
usb_source_remove(sdi->session, devc->ctx);
|
usb_source_remove(sdi->session, devc->ctx);
|
||||||
|
|
||||||
|
|
|
@ -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,
|
if ((ret = sr_scpi_source_add(sdi->session, scpi, G_IO_IN, 10,
|
||||||
scpi_pps_receive_data, (void *)sdi)) != SR_OK)
|
scpi_pps_receive_data, (void *)sdi)) != SR_OK)
|
||||||
return ret;
|
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. */
|
/* Prime the pipe with the first channel's fetch. */
|
||||||
ch = sr_next_enabled_channel(sdi, NULL);
|
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_get_float(scpi, NULL, &f);
|
||||||
sr_scpi_source_remove(sdi->session, scpi);
|
sr_scpi_source_remove(sdi->session, scpi);
|
||||||
|
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
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. */
|
/* Poll every 50ms, or whenever some data comes in. */
|
||||||
serial = sdi->conn;
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close,
|
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, \
|
#define DMM(ID, CHIPSET, VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, TIMEOUT, \
|
||||||
|
|
|
@ -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. */
|
/* We are done, clean up and send end packet to session bus. */
|
||||||
clear_acquisition_state(sdi);
|
clear_acquisition_state(sdi);
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
return G_SOURCE_REMOVE;
|
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);
|
ret = submit_request(sdi, STATE_START_CAPTURE);
|
||||||
|
|
||||||
if (ret == SR_OK)
|
if (ret == SR_OK)
|
||||||
ret = std_session_send_df_header(sdi, LOG_PREFIX);
|
ret = std_session_send_df_header(sdi);
|
||||||
|
|
||||||
if (ret != SR_OK) {
|
if (ret != SR_OK) {
|
||||||
usb_source_remove(sdi->session, drvc->sr_ctx);
|
usb_source_remove(sdi->session, drvc->sr_ctx);
|
||||||
|
|
|
@ -170,7 +170,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->sw_limits);
|
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. */
|
/* Poll every 50ms, or whenever some data comes in. */
|
||||||
serial_source_add(sdi->session, serial, G_IO_IN, 50,
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(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 = {
|
static struct sr_dev_driver teleinfo_driver_info = {
|
||||||
|
|
|
@ -352,7 +352,7 @@ static int handle_events(int fd, int revents, void *cb_data)
|
||||||
if (sdi->status == SR_ST_STOPPING) {
|
if (sdi->status == SR_ST_STOPPING) {
|
||||||
usb_source_remove(sdi->session, drvc->sr_ctx);
|
usb_source_remove(sdi->session, drvc->sr_ctx);
|
||||||
dev_close(sdi);
|
dev_close(sdi);
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&tv, 0, sizeof(struct timeval));
|
memset(&tv, 0, sizeof(struct timeval));
|
||||||
|
@ -381,7 +381,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
devc->reply_size = 0;
|
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,
|
usb_source_add(sdi->session, drvc->sr_ctx, 100,
|
||||||
handle_events, (void *)sdi);
|
handle_events, (void *)sdi);
|
||||||
|
|
|
@ -137,7 +137,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
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);
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close,
|
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 = {
|
static struct sr_dev_driver tondaj_sl_814_driver_info = {
|
||||||
|
|
|
@ -164,7 +164,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
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 */,
|
sr_session_source_add(sdi->session, -1, 0, 10 /* poll_timeout */,
|
||||||
uni_t_dmm_receive_data, (void *)sdi);
|
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)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
sr_dbg("Stopping acquisition.");
|
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);
|
sr_session_source_remove(sdi->session, -1);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
|
|
|
@ -254,7 +254,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
std_session_send_df_header(sdi, LOG_PREFIX);
|
std_session_send_df_header(sdi);
|
||||||
|
|
||||||
if (!(devc->xfer = libusb_alloc_transfer(0)))
|
if (!(devc->xfer = libusb_alloc_transfer(0)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
|
@ -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) {
|
if (sdi->status == SR_ST_STOPPING) {
|
||||||
usb_source_remove(sdi->session, drvc->sr_ctx);
|
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. */
|
/* Tell the device to stop sending USB packets. */
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
|
@ -273,7 +273,7 @@ static int handle_events(int fd, int revents, void *cb_data)
|
||||||
if (sdi->status == SR_ST_STOPPING) {
|
if (sdi->status == SR_ST_STOPPING) {
|
||||||
usb_source_remove(sdi->session, drvc->sr_ctx);
|
usb_source_remove(sdi->session, drvc->sr_ctx);
|
||||||
dev_close(sdi);
|
dev_close(sdi);
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&tv, 0, sizeof(struct timeval));
|
memset(&tv, 0, sizeof(struct timeval));
|
||||||
|
@ -297,7 +297,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
usb = sdi->conn;
|
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,
|
usb_source_add(sdi->session, drvc->sr_ctx, 100,
|
||||||
handle_events, (void *)sdi);
|
handle_events, (void *)sdi);
|
||||||
|
|
|
@ -660,7 +660,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
|
@ -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("Ramsize trigger = 0x%x.", ramsize_trigger);
|
||||||
sr_info("Memory size = 0x%x.", memory_size);
|
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 */
|
/* Check for empty capture */
|
||||||
if ((status & STATUS_READY) && !stop_address) {
|
if ((status & STATUS_READY) && !stop_address) {
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,7 +634,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
analyzer_read_stop(usb->devhdl);
|
analyzer_read_stop(usb->devhdl);
|
||||||
g_free(buf);
|
g_free(buf);
|
||||||
|
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
@ -644,7 +644,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
|
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
analyzer_reset(usb->devhdl);
|
analyzer_reset(usb->devhdl);
|
||||||
|
|
|
@ -75,7 +75,7 @@ static int process_buffer(struct sr_input *in)
|
||||||
|
|
||||||
inc = in->priv;
|
inc = in->priv;
|
||||||
if (!inc->started) {
|
if (!inc->started) {
|
||||||
std_session_send_df_header(in->sdi, LOG_PREFIX);
|
std_session_send_df_header(in->sdi);
|
||||||
|
|
||||||
if (inc->samplerate) {
|
if (inc->samplerate) {
|
||||||
packet.type = SR_DF_META;
|
packet.type = SR_DF_META;
|
||||||
|
@ -137,7 +137,7 @@ static int end(struct sr_input *in)
|
||||||
|
|
||||||
inc = in->priv;
|
inc = in->priv;
|
||||||
if (inc->started)
|
if (inc->started)
|
||||||
std_session_send_df_end(in->sdi, LOG_PREFIX);
|
std_session_send_df_end(in->sdi);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ static int process_buffer(struct sr_input *in)
|
||||||
|
|
||||||
inc = in->priv;
|
inc = in->priv;
|
||||||
if (!inc->started) {
|
if (!inc->started) {
|
||||||
std_session_send_df_header(in->sdi, LOG_PREFIX);
|
std_session_send_df_header(in->sdi);
|
||||||
|
|
||||||
if (inc->samplerate) {
|
if (inc->samplerate) {
|
||||||
packet.type = SR_DF_META;
|
packet.type = SR_DF_META;
|
||||||
|
@ -149,7 +149,7 @@ static int end(struct sr_input *in)
|
||||||
|
|
||||||
inc = in->priv;
|
inc = in->priv;
|
||||||
if (inc->started)
|
if (inc->started)
|
||||||
std_session_send_df_end(in->sdi, LOG_PREFIX);
|
std_session_send_df_end(in->sdi);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -612,7 +612,7 @@ static int process_buffer(struct sr_input *in)
|
||||||
|
|
||||||
inc = in->priv;
|
inc = in->priv;
|
||||||
if (!inc->started) {
|
if (!inc->started) {
|
||||||
std_session_send_df_header(in->sdi, LOG_PREFIX);
|
std_session_send_df_header(in->sdi);
|
||||||
|
|
||||||
if (inc->samplerate) {
|
if (inc->samplerate) {
|
||||||
packet.type = SR_DF_META;
|
packet.type = SR_DF_META;
|
||||||
|
@ -747,7 +747,7 @@ static int end(struct sr_input *in)
|
||||||
|
|
||||||
inc = in->priv;
|
inc = in->priv;
|
||||||
if (inc->started)
|
if (inc->started)
|
||||||
std_session_send_df_end(in->sdi, LOG_PREFIX);
|
std_session_send_df_end(in->sdi);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ static int process_buffer(struct sr_input *in)
|
||||||
|
|
||||||
inc = in->priv;
|
inc = in->priv;
|
||||||
if (!inc->started) {
|
if (!inc->started) {
|
||||||
std_session_send_df_header(in->sdi, LOG_PREFIX);
|
std_session_send_df_header(in->sdi);
|
||||||
|
|
||||||
if (inc->samplerate) {
|
if (inc->samplerate) {
|
||||||
packet.type = SR_DF_META;
|
packet.type = SR_DF_META;
|
||||||
|
@ -227,7 +227,7 @@ static int end(struct sr_input *in)
|
||||||
|
|
||||||
inc = in->priv;
|
inc = in->priv;
|
||||||
if (inc->started)
|
if (inc->started)
|
||||||
std_session_send_df_end(in->sdi, LOG_PREFIX);
|
std_session_send_df_end(in->sdi);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -683,7 +683,7 @@ static int process_buffer(struct sr_input *in)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inc->meta_sent) {
|
if (!inc->meta_sent) {
|
||||||
std_session_send_df_header(in->sdi, LOG_PREFIX);
|
std_session_send_df_header(in->sdi);
|
||||||
send_metadata(in);
|
send_metadata(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -751,7 +751,7 @@ static int end(struct sr_input *in)
|
||||||
flush_output_buffer(in);
|
flush_output_buffer(in);
|
||||||
|
|
||||||
if (inc->meta_sent)
|
if (inc->meta_sent)
|
||||||
std_session_send_df_end(in->sdi, LOG_PREFIX);
|
std_session_send_df_end(in->sdi);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -530,7 +530,7 @@ static int process_buffer(struct sr_input *in)
|
||||||
|
|
||||||
inc = in->priv;
|
inc = in->priv;
|
||||||
if (!inc->started) {
|
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.type = SR_DF_META;
|
||||||
packet.payload = &meta;
|
packet.payload = &meta;
|
||||||
|
@ -596,7 +596,7 @@ static int end(struct sr_input *in)
|
||||||
send_buffer(in);
|
send_buffer(in);
|
||||||
|
|
||||||
if (inc->started)
|
if (inc->started)
|
||||||
std_session_send_df_end(in->sdi, LOG_PREFIX);
|
std_session_send_df_end(in->sdi);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,7 @@ static int process_buffer(struct sr_input *in)
|
||||||
|
|
||||||
inc = in->priv;
|
inc = in->priv;
|
||||||
if (!inc->started) {
|
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.type = SR_DF_META;
|
||||||
packet.payload = &meta;
|
packet.payload = &meta;
|
||||||
|
@ -351,7 +351,7 @@ static int end(struct sr_input *in)
|
||||||
|
|
||||||
inc = in->priv;
|
inc = in->priv;
|
||||||
if (inc->started)
|
if (inc->started)
|
||||||
std_session_send_df_end(in->sdi, LOG_PREFIX);
|
std_session_send_df_end(in->sdi);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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_limit_counter_start(&devc->frame_count);
|
||||||
dev_time_counter_start(&devc->time_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. */
|
/* Poll every 50ms, or whenever some data comes in. */
|
||||||
serial = sdi->conn;
|
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)
|
SR_PRIV int es51919_serial_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
return std_serial_dev_acquisition_stop(sdi,
|
return std_serial_dev_acquisition_stop(sdi,
|
||||||
std_serial_dev_close, sdi->conn, LOG_PREFIX);
|
std_serial_dev_close, sdi->conn);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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_open(struct sr_dev_inst *sdi);
|
||||||
SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi,
|
SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi,
|
||||||
dev_close_callback dev_close_fn,
|
dev_close_callback dev_close_fn,
|
||||||
struct sr_serial_dev_inst *serial, const char *prefix);
|
struct sr_serial_dev_inst *serial);
|
||||||
#endif
|
#endif
|
||||||
SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi,
|
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);
|
||||||
SR_PRIV int std_session_send_df_end(const struct sr_dev_inst *sdi,
|
|
||||||
const char *prefix);
|
|
||||||
SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver,
|
SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver,
|
||||||
std_dev_clear_callback clear_private);
|
std_dev_clear_callback clear_private);
|
||||||
SR_PRIV GSList *std_dev_list(const struct sr_dev_driver *di);
|
SR_PRIV GSList *std_dev_list(const struct sr_dev_driver *di);
|
||||||
|
|
|
@ -199,7 +199,7 @@ static int receive_data(int fd, int revents, void *cb_data)
|
||||||
vdev->archive = NULL;
|
vdev->archive = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
std_session_send_df_end(sdi, LOG_PREFIX);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
std_session_send_df_header(sdi, LOG_PREFIX);
|
std_session_send_df_header(sdi);
|
||||||
|
|
||||||
/* freewheeling source */
|
/* freewheeling source */
|
||||||
sr_session_source_add(sdi->session, -1, 0, 0, receive_data, (void *)sdi);
|
sr_session_source_add(sdi->session, -1, 0, 0, receive_data, (void *)sdi);
|
||||||
|
|
31
src/std.c
31
src/std.c
|
@ -85,24 +85,17 @@ SR_PRIV int std_cleanup(const struct sr_dev_driver *di)
|
||||||
* dev_acquisition_start() API callback.
|
* dev_acquisition_start() API callback.
|
||||||
*
|
*
|
||||||
* @param sdi The device instance to use.
|
* @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
|
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or
|
||||||
* SR_ERR upon other errors.
|
* SR_ERR upon other errors.
|
||||||
*/
|
*/
|
||||||
SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi,
|
SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi)
|
||||||
const char *prefix)
|
|
||||||
{
|
{
|
||||||
|
const char *prefix = sdi->driver->name;
|
||||||
int ret;
|
int ret;
|
||||||
struct sr_datafeed_packet packet;
|
struct sr_datafeed_packet packet;
|
||||||
struct sr_datafeed_header header;
|
struct sr_datafeed_header header;
|
||||||
|
|
||||||
if (!prefix) {
|
|
||||||
sr_err("Invalid prefix.");
|
|
||||||
return SR_ERR_ARG;
|
|
||||||
}
|
|
||||||
|
|
||||||
sr_dbg("%s: Starting acquisition.", prefix);
|
sr_dbg("%s: Starting acquisition.", prefix);
|
||||||
|
|
||||||
/* Send header packet to the session bus. */
|
/* 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.
|
* Standard API helper for sending an SR_DF_END packet.
|
||||||
*
|
*
|
||||||
* @param sdi The device instance to use. Must not be NULL.
|
* @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
|
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or
|
||||||
* SR_ERR upon other errors.
|
* SR_ERR upon other errors.
|
||||||
*/
|
*/
|
||||||
SR_PRIV int std_session_send_df_end(const struct sr_dev_inst *sdi,
|
SR_PRIV int std_session_send_df_end(const struct sr_dev_inst *sdi)
|
||||||
const char *prefix)
|
|
||||||
{
|
{
|
||||||
|
const char *prefix = sdi->driver->name;
|
||||||
int ret;
|
int ret;
|
||||||
struct sr_datafeed_packet packet;
|
struct sr_datafeed_packet packet;
|
||||||
|
|
||||||
if (!sdi || !prefix)
|
if (!sdi)
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
|
|
||||||
sr_dbg("%s: Sending SR_DF_END packet.", prefix);
|
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.
|
* Must not be NULL.
|
||||||
* @param serial The serial device instance (struct serial_dev_inst *).
|
* @param serial The serial device instance (struct serial_dev_inst *).
|
||||||
* Must not be NULL.
|
* 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_OK Success.
|
||||||
* @retval SR_ERR_ARG Invalid arguments.
|
* @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,
|
SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi,
|
||||||
dev_close_callback dev_close_fn,
|
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;
|
int ret;
|
||||||
|
|
||||||
if (!prefix) {
|
|
||||||
sr_err("Invalid prefix.");
|
|
||||||
return SR_ERR_ARG;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE) {
|
if (sdi->status != SR_ST_ACTIVE) {
|
||||||
sr_err("%s: Device inactive, can't stop acquisition.", prefix);
|
sr_err("%s: Device inactive, can't stop acquisition.", prefix);
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -253,7 +238,7 @@ SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std_session_send_df_end(sdi, prefix);
|
std_session_send_df_end(sdi);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue