Add sr_dev_acquisition_stop(), factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers and reduces the per-driver boilerplate.
This commit is contained in:
parent
6ad2fbaad2
commit
d2f7c417fd
|
@ -200,7 +200,7 @@ SR_PRIV int agdmm_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits) || stop)
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
else
|
||||
dispatch(sdi);
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ static void appa_55ii_log_end(struct sr_dev_inst *sdi)
|
|||
if (devc->data_source != DATA_SOURCE_MEMORY)
|
||||
return;
|
||||
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
}
|
||||
|
||||
static const uint8_t *appa_55ii_parse_data(struct sr_dev_inst *sdi,
|
||||
|
@ -309,7 +309,7 @@ SR_PRIV int appa_55ii_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits)) {
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ SR_PRIV int reloadpro_receive_data(int fd, int revents, void *cb_data)
|
|||
handle_new_data(sdi);
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits))
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1114,7 +1114,7 @@ static int download_capture(struct sr_dev_inst *sdi)
|
|||
|
||||
std_session_send_df_end(sdi);
|
||||
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
g_free(dram_line);
|
||||
|
||||
|
|
|
@ -466,9 +466,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
devc = sdi->priv;
|
||||
devc->acquisition_running = FALSE;
|
||||
|
||||
|
|
|
@ -360,9 +360,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
|
||||
devc = sdi->priv;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
dev_acquisition_close(sdi);
|
||||
sr_session_source_remove_channel(sdi->session, devc->channel);
|
||||
g_io_channel_shutdown(devc->channel, FALSE, NULL);
|
||||
|
|
|
@ -793,7 +793,7 @@ SR_PRIV int bl_acme_receive_data(int fd, int revents, void *cb_data)
|
|||
sr_sw_limits_update_samples_read(&devc->limits, 1);
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits)) {
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -332,9 +332,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
{
|
||||
struct dev_context *devc = sdi->priv;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
/* Execute a stop on BeagleLogic */
|
||||
beaglelogic_stop(devc);
|
||||
|
||||
|
|
|
@ -227,9 +227,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
|||
|
||||
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);
|
||||
|
||||
sr_session_source_remove(sdi->session, -1);
|
||||
|
|
|
@ -344,7 +344,7 @@ SR_PRIV int brymen_bm86x_receive_data(int fd, int revents, void *cb_data)
|
|||
return FALSE;
|
||||
|
||||
if (sr_sw_limits_check(&devc->sw_limits))
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ SR_PRIV int brymen_dmm_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->sw_limits))
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ static void process_mset(const struct sr_dev_inst *sdi)
|
|||
|
||||
devc->num_samples++;
|
||||
if (devc->limit_samples && devc->num_samples >= devc->limit_samples)
|
||||
sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi);
|
||||
sr_dev_acquisition_stop((struct sr_dev_inst *)sdi);
|
||||
break;
|
||||
case TOKEN_RECORDING_ON:
|
||||
devc->recording = TRUE;
|
||||
|
@ -208,7 +208,7 @@ static void send_data(const struct sr_dev_inst *sdi, unsigned char *data,
|
|||
|
||||
devc->num_samples += analog.num_samples;
|
||||
if (devc->limit_samples && devc->num_samples >= devc->limit_samples)
|
||||
sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi);
|
||||
sr_dev_acquisition_stop((struct sr_dev_inst *)sdi);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ static void process_byte(const struct sr_dev_inst *sdi, const unsigned char c,
|
|||
* records. Otherwise the frontend would have no
|
||||
* way to tell where stored data ends and live
|
||||
* measurements begin. */
|
||||
sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi);
|
||||
sr_dev_acquisition_stop((struct sr_dev_inst *)sdi);
|
||||
} else if (c == RECORD_DATA) {
|
||||
devc->buf_len = 0;
|
||||
devc->state = ST_GET_LOG_RECORD_DATA;
|
||||
|
|
|
@ -243,7 +243,7 @@ static int receive_data(int fd, int revents, int idx, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->sw_limits))
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,6 @@ static const int32_t trigger_matches[] = {
|
|||
SR_TRIGGER_FALLING,
|
||||
};
|
||||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi);
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
@ -452,7 +450,7 @@ static int receive_data(int fd, int revents, void *cb_data)
|
|||
/* Get one block of data. */
|
||||
if ((ret = cv_read_block(devc)) < 0) {
|
||||
sr_err("Failed to read data block: %d.", ret);
|
||||
dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -475,7 +473,7 @@ static int receive_data(int fd, int revents, void *cb_data)
|
|||
for (i = 0; i < NUM_BLOCKS; i++)
|
||||
cv_send_block_to_session_bus(sdi, i);
|
||||
|
||||
dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -552,7 +550,6 @@ 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.");
|
||||
sr_session_source_remove(sdi->session, -1);
|
||||
std_session_send_df_end(sdi);
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ static void process_packet(const struct sr_dev_inst *sdi)
|
|||
sr_sw_limits_update_samples_read(&devc->limits, 1);
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits))
|
||||
sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi);
|
||||
sr_dev_acquisition_stop((struct sr_dev_inst *)sdi);
|
||||
}
|
||||
|
||||
SR_PRIV int colead_slm_receive_data(int fd, int revents, void *cb_data)
|
||||
|
|
|
@ -171,8 +171,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||
{
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
(void)sdi;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
|
|
@ -532,7 +532,6 @@ 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.");
|
||||
sr_session_source_remove(sdi->session, -1);
|
||||
std_session_send_df_end(sdi);
|
||||
|
||||
|
|
|
@ -446,7 +446,7 @@ SR_PRIV int demo_prepare_data(int fd, int revents, void *cb_data)
|
|||
if (devc->cur_samplerate <= 0
|
||||
|| (devc->num_logic_channels <= 0
|
||||
&& devc->num_analog_channels <= 0)) {
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
|
@ -539,7 +539,7 @@ SR_PRIV int demo_prepare_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
}
|
||||
sr_dbg("Requested number of samples reached.");
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
}
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
|
|
|
@ -526,7 +526,7 @@ SR_PRIV int fluke_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits)) {
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -462,10 +462,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||
{
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
sr_dbg("Stopping acquisition.");
|
||||
sr_session_source_remove(sdi->session, -1);
|
||||
|
||||
std_session_send_df_end(sdi);
|
||||
|
|
|
@ -79,7 +79,7 @@ SR_PRIV int ftdi_la_receive_data(int fd, int revents, void *cb_data)
|
|||
if (bytes_read < 0) {
|
||||
sr_err("Failed to read FTDI data (%d): %s.",
|
||||
bytes_read, ftdi_get_error_string(devc->ftdic));
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return FALSE;
|
||||
}
|
||||
if (bytes_read == 0) {
|
||||
|
@ -94,7 +94,7 @@ SR_PRIV int ftdi_la_receive_data(int fd, int revents, void *cb_data)
|
|||
if (devc->limit_samples && (n >= devc->limit_samples)) {
|
||||
send_samples(sdi, devc->limit_samples - devc->samples_sent);
|
||||
sr_info("Requested number of samples reached.");
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
} else {
|
||||
send_samples(sdi, devc->bytes_received);
|
||||
|
|
|
@ -1175,7 +1175,7 @@ SR_PRIV int gmc_mh_1x_2x_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits))
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1218,7 +1218,7 @@ SR_PRIV int gmc_mh_2x_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits))
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
/* Request next data set, if required */
|
||||
if (sdi->status == SR_ST_ACTIVE) {
|
||||
|
|
|
@ -220,11 +220,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
scpi = sdi->conn;
|
||||
devc = sdi->priv;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE) {
|
||||
sr_err("Device inactive, can't stop acquisition.");
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
if (devc->df_started) {
|
||||
packet.type = SR_DF_FRAME_END;
|
||||
sr_session_send(sdi, &packet);
|
||||
|
|
|
@ -35,7 +35,7 @@ static int read_data(struct sr_dev_inst *sdi,
|
|||
data_size - devc->cur_rcv_buffer_position);
|
||||
if (len < 0) {
|
||||
sr_err("Read data error.");
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
devc->cur_rcv_buffer_position = 0;
|
||||
return SR_ERR;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ static int read_data(struct sr_dev_inst *sdi,
|
|||
return SR_OK;
|
||||
} else {
|
||||
sr_err("Too many bytes read.");
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
devc->cur_rcv_buffer_position = 0;
|
||||
return SR_ERR;
|
||||
}
|
||||
|
@ -96,17 +96,17 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data)
|
|||
case START_ACQUISITION:
|
||||
if (sr_scpi_send(scpi, ":TRIG:MOD 3") != SR_OK) {
|
||||
sr_err("Failed to set trigger mode to SINGLE.");
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
if (sr_scpi_send(scpi, ":STOP") != SR_OK) {
|
||||
sr_err("Failed to put the trigger system into STOP state.");
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
if (sr_scpi_send(scpi, ":RUN") != SR_OK) {
|
||||
sr_err("Failed to put the trigger system into RUN state.");
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -117,12 +117,12 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data)
|
|||
if (((struct sr_channel *)g_slist_nth_data(sdi->channels, devc->cur_acq_channel))->enabled) {
|
||||
if (sr_scpi_send(scpi, ":ACQ%d:MEM?", devc->cur_acq_channel+1) != SR_OK) {
|
||||
sr_err("Failed to acquire memory.");
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
if (sr_scpi_read_begin(scpi) != SR_OK) {
|
||||
sr_err("Could not begin reading SCPI response.");
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
devc->state = WAIT_FOR_TRANSFER_OF_BEGIN_TRANSMISSION_COMPLETE;
|
||||
|
@ -136,7 +136,7 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data)
|
|||
/* All frames accquired. */
|
||||
sr_spew("All frames acquired.");
|
||||
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
} else {
|
||||
/* Start acquiring next frame. */
|
||||
|
@ -170,7 +170,7 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data)
|
|||
devc->rcv_buffer[0] != '6') {
|
||||
sr_err("Data size digits is not 4, 5 or 6 but "
|
||||
"'%c'.", devc->rcv_buffer[0]);
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
} else {
|
||||
devc->data_size_digits = devc->rcv_buffer[0] - '0';
|
||||
|
@ -183,7 +183,7 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data)
|
|||
devc->rcv_buffer[devc->data_size_digits] = 0;
|
||||
if (sr_atoi(devc->rcv_buffer, &devc->data_size) != SR_OK) {
|
||||
sr_err("Could not parse data size '%s'", devc->rcv_buffer);
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
} else
|
||||
devc->state = WAIT_FOR_TRANSFER_OF_SAMPLE_RATE_COMPLETE;
|
||||
|
@ -224,7 +224,7 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data)
|
|||
devc->cur_acq_channel + 1);
|
||||
if (sr_scpi_get_string(scpi, command, &response) != SR_OK) {
|
||||
sr_err("Failed to get volts per division.");
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
volts_per_division = g_ascii_strtod(response, &end_ptr);
|
||||
|
@ -264,7 +264,7 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data)
|
|||
if (devc->cur_acq_frame == devc->frame_limit - 1) {
|
||||
/* All frames acquired. */
|
||||
sr_spew("All frames acquired.");
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
} else {
|
||||
/* Start acquiring next frame. */
|
||||
|
|
|
@ -811,9 +811,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
|
||||
std_session_send_df_end(sdi);
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
devc = sdi->priv;
|
||||
|
||||
devc->num_frames = 0;
|
||||
|
|
|
@ -1018,7 +1018,7 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
|
|||
* the first enabled channel.
|
||||
*/
|
||||
if (++devc->num_frames == devc->frame_limit) {
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
hmo_cleanup_logic_data(devc);
|
||||
} else {
|
||||
devc->current_channel = devc->enabled_channels;
|
||||
|
|
|
@ -88,8 +88,6 @@ static const uint64_t vdivs[][2] = {
|
|||
|
||||
static int read_channel(const struct sr_dev_inst *sdi, uint32_t amount);
|
||||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi);
|
||||
|
||||
static struct sr_dev_inst *hantek_6xxx_dev_new(const struct hantek_6xxx_profile *prof)
|
||||
{
|
||||
struct sr_dev_inst *sdi;
|
||||
|
@ -709,7 +707,7 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
|
|||
PRIu64 " <= %" PRIu64, devc->limit_samples,
|
||||
devc->samp_received);
|
||||
send_data(sdi, devc->sample_buf, devc->limit_samples);
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
} else if (devc->limit_msec && (g_get_monotonic_time() -
|
||||
devc->aq_started) / 1000 >= devc->limit_msec) {
|
||||
sr_info("Requested time limit reached, stopping. %d <= %d",
|
||||
|
@ -718,7 +716,7 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
|
|||
send_data(sdi, devc->sample_buf, devc->samp_received);
|
||||
g_free(devc->sample_buf);
|
||||
devc->sample_buf = NULL;
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
} else {
|
||||
read_channel(sdi, data_amount(sdi));
|
||||
}
|
||||
|
@ -818,9 +816,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR;
|
||||
|
||||
devc = sdi->priv;
|
||||
devc->dev_state = STOPPING;
|
||||
|
||||
|
|
|
@ -161,8 +161,6 @@ static const char *coupling[] = {
|
|||
"GND",
|
||||
};
|
||||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi);
|
||||
|
||||
static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof)
|
||||
{
|
||||
struct sr_dev_inst *sdi;
|
||||
|
@ -984,9 +982,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR;
|
||||
|
||||
devc = sdi->priv;
|
||||
devc->dev_state = STOPPING;
|
||||
|
||||
|
|
|
@ -435,7 +435,7 @@ SR_PRIV int hp_3457a_receive_data(int fd, int revents, void *cb_data)
|
|||
ret = sr_scpi_get_double(scpi, NULL, &devc->last_channel_sync);
|
||||
if (ret != SR_OK) {
|
||||
sr_err("Cannot check channel synchronization.");
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return FALSE;
|
||||
}
|
||||
devc->acq_state = ACQ_GOT_CHANNEL_SYNC;
|
||||
|
@ -456,7 +456,7 @@ SR_PRIV int hp_3457a_receive_data(int fd, int revents, void *cb_data)
|
|||
sr_err("Expected channel %u, but device says %u",
|
||||
chanc->index,
|
||||
(unsigned int)devc->last_channel_sync);
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return FALSE;
|
||||
}
|
||||
/* All is good. Back to business. */
|
||||
|
@ -464,7 +464,7 @@ SR_PRIV int hp_3457a_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (devc->limit_samples && (devc->num_samples >= devc->limit_samples)) {
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -692,11 +692,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV int hung_chang_dso_2100_dev_acquisition_stop(const struct sr_dev_inst *sdi)
|
||||
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);
|
||||
sr_session_source_remove(sdi->session, -1);
|
||||
hung_chang_dso_2100_move_to(sdi, 1);
|
||||
|
@ -704,11 +701,6 @@ SR_PRIV int hung_chang_dso_2100_dev_acquisition_stop(const struct sr_dev_inst *s
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||
{
|
||||
return hung_chang_dso_2100_dev_acquisition_stop(sdi);
|
||||
}
|
||||
|
||||
static struct sr_dev_driver hung_chang_dso_2100_driver_info = {
|
||||
.name = "hung-chang-dso-2100",
|
||||
.longname = "Hung-Chang DSO-2100",
|
||||
|
|
|
@ -420,7 +420,7 @@ static int read_subframe(const struct sr_dev_inst *sdi, uint8_t *buf)
|
|||
SR_PRIV int hung_chang_dso_2100_poll(int fd, int revents, void *cb_data)
|
||||
{
|
||||
struct sr_datafeed_packet packet = { .type = SR_DF_FRAME_BEGIN };
|
||||
const struct sr_dev_inst *sdi;
|
||||
struct sr_dev_inst *sdi;
|
||||
struct dev_context *devc;
|
||||
uint8_t state, buf[1000];
|
||||
|
||||
|
@ -464,7 +464,7 @@ SR_PRIV int hung_chang_dso_2100_poll(int fd, int revents, void *cb_data)
|
|||
sr_session_send(sdi, &packet);
|
||||
|
||||
if (++devc->frame >= devc->frame_limit)
|
||||
hung_chang_dso_2100_dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
else
|
||||
hung_chang_dso_2100_move_to(sdi, 0x21);
|
||||
|
||||
|
|
|
@ -63,6 +63,5 @@ SR_PRIV void hung_chang_dso_2100_write_mbox(struct parport *port, uint8_t val);
|
|||
SR_PRIV uint8_t hung_chang_dso_2100_read_mbox(struct parport *port, float timeout);
|
||||
SR_PRIV int hung_chang_dso_2100_move_to(const struct sr_dev_inst *sdi, uint8_t target);
|
||||
SR_PRIV int hung_chang_dso_2100_poll(int fd, int revents, void *cb_data);
|
||||
SR_PRIV int hung_chang_dso_2100_dev_acquisition_stop(const struct sr_dev_inst *sdi);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -443,11 +443,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||
{
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
sr_dbg("Stopping acquisition.");
|
||||
|
||||
sdi->status = SR_ST_STOPPING;
|
||||
|
||||
return SR_OK;
|
||||
|
|
|
@ -43,8 +43,6 @@ static const char *channel_names[] = {
|
|||
/* Note: The IKALOGIC ScanaPLUS always samples at 100MHz. */
|
||||
static const uint64_t samplerates[1] = { SR_MHZ(100) };
|
||||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi);
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
@ -358,7 +356,6 @@ 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.");
|
||||
sr_session_source_remove(sdi->session, -1);
|
||||
std_session_send_df_end(sdi);
|
||||
|
||||
|
|
|
@ -319,7 +319,7 @@ SR_PRIV int scanaplus_receive_data(int fd, int revents, void *cb_data)
|
|||
if (bytes_read < 0) {
|
||||
sr_err("Failed to read FTDI data (%d): %s.",
|
||||
bytes_read, ftdi_get_error_string(devc->ftdic));
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return FALSE;
|
||||
}
|
||||
if (bytes_read == 0) {
|
||||
|
@ -358,12 +358,12 @@ SR_PRIV int scanaplus_receive_data(int fd, int revents, void *cb_data)
|
|||
if (devc->limit_samples && (n >= devc->limit_samples)) {
|
||||
send_samples(sdi, devc->limit_samples - devc->samples_sent);
|
||||
sr_info("Requested number of samples reached.");
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
} else if (devc->limit_msec && (n >= max)) {
|
||||
send_samples(sdi, max - devc->samples_sent);
|
||||
sr_info("Requested time limit reached.");
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
} else {
|
||||
send_samples(sdi, devc->bytes_received / 2);
|
||||
|
|
|
@ -478,9 +478,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
/* Signal USB transfer handler to clean up and stop. */
|
||||
sdi->status = SR_ST_STOPPING;
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ SR_PRIV int kecheng_kc_330b_handle_events(int fd, int revents, void *cb_data)
|
|||
if (ret != 0 || len != 1) {
|
||||
sr_dbg("Failed to request new acquisition: %s",
|
||||
libusb_error_name(ret));
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
libusb_submit_transfer(devc->xfer);
|
||||
|
@ -88,7 +88,7 @@ SR_PRIV int kecheng_kc_330b_handle_events(int fd, int revents, void *cb_data)
|
|||
if (ret != 0 || len != 4) {
|
||||
sr_dbg("Failed to request next chunk: %s",
|
||||
libusb_error_name(ret));
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
libusb_submit_transfer(devc->xfer);
|
||||
|
@ -135,7 +135,7 @@ SR_PRIV void LIBUSB_CALL kecheng_kc_330b_receive_transfer(struct libusb_transfer
|
|||
switch (transfer->status) {
|
||||
case LIBUSB_TRANSFER_NO_DEVICE:
|
||||
/* USB device was unplugged. */
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return;
|
||||
case LIBUSB_TRANSFER_COMPLETED:
|
||||
case LIBUSB_TRANSFER_TIMED_OUT: /* We may have received some data though */
|
||||
|
@ -156,7 +156,7 @@ SR_PRIV void LIBUSB_CALL kecheng_kc_330b_receive_transfer(struct libusb_transfer
|
|||
send_data(sdi, fvalue, 1);
|
||||
devc->num_samples++;
|
||||
if (devc->limit_samples && devc->num_samples >= devc->limit_samples) {
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
} else {
|
||||
/* let USB event handler fire off another
|
||||
* request when the time is right. */
|
||||
|
@ -176,7 +176,7 @@ SR_PRIV void LIBUSB_CALL kecheng_kc_330b_receive_transfer(struct libusb_transfer
|
|||
send_data(sdi, fvalue, 1);
|
||||
devc->num_samples += num_samples;
|
||||
if (devc->num_samples >= devc->stored_samples) {
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
} else {
|
||||
/* let USB event handler fire off another
|
||||
* request when the time is right. */
|
||||
|
|
|
@ -125,7 +125,7 @@ SR_PRIV int kern_scale_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits))
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -387,7 +387,7 @@ SR_PRIV int korad_kaxxxxp_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits)) {
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -395,13 +395,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||
{
|
||||
if (sdi->status != SR_ST_ACTIVE) {
|
||||
sr_err("Device inactive, can't stop acquisition.");
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
sdi->status = SR_ST_STOPPING;
|
||||
/* TODO: free ongoing transfers? */
|
||||
|
||||
|
|
|
@ -528,7 +528,7 @@ SR_PRIV void LIBUSB_CALL lascar_el_usb_receive_transfer(struct libusb_transfer *
|
|||
switch (transfer->status) {
|
||||
case LIBUSB_TRANSFER_NO_DEVICE:
|
||||
/* USB device was unplugged. */
|
||||
dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return;
|
||||
case LIBUSB_TRANSFER_COMPLETED:
|
||||
case LIBUSB_TRANSFER_TIMED_OUT: /* We may have received some data though */
|
||||
|
@ -547,7 +547,7 @@ SR_PRIV void LIBUSB_CALL lascar_el_usb_receive_transfer(struct libusb_transfer *
|
|||
devc->rcvd_bytes, devc->log_size,
|
||||
devc->rcvd_samples, devc->logged_samples);
|
||||
if (devc->rcvd_bytes >= devc->log_size)
|
||||
dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
}
|
||||
|
||||
if (sdi->status == SR_ST_ACTIVE) {
|
||||
|
@ -557,7 +557,7 @@ SR_PRIV void LIBUSB_CALL lascar_el_usb_receive_transfer(struct libusb_transfer *
|
|||
libusb_error_name(ret));
|
||||
g_free(transfer->buffer);
|
||||
libusb_free_transfer(transfer);
|
||||
dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
}
|
||||
} else {
|
||||
/* This was the last transfer we're going to receive, so
|
||||
|
|
|
@ -79,6 +79,5 @@ SR_PRIV void LIBUSB_CALL lascar_el_usb_receive_transfer(struct libusb_transfer *
|
|||
SR_PRIV int lascar_start_logging(const struct sr_dev_inst *sdi);
|
||||
SR_PRIV int lascar_stop_logging(const struct sr_dev_inst *sdi);
|
||||
SR_PRIV int lascar_is_logging(const struct sr_dev_inst *sdi);
|
||||
SR_PRIV int dev_acquisition_stop(struct sr_dev_inst *sdi);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -488,9 +488,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||
{
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
return lls_stop_acquisition(sdi);
|
||||
}
|
||||
|
||||
|
|
|
@ -616,9 +616,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
|
||||
std_session_send_df_end(sdi);
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
devc = sdi->priv;
|
||||
|
||||
devc->num_frames = 0;
|
||||
|
|
|
@ -662,7 +662,7 @@ SR_PRIV int lecroy_xstream_receive_data(int fd, int revents, void *cb_data)
|
|||
* the first enabled channel.
|
||||
*/
|
||||
if (++devc->num_frames == devc->frame_limit) {
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
} else {
|
||||
devc->current_channel = devc->enabled_channels;
|
||||
lecroy_xstream_request_data(sdi);
|
||||
|
|
|
@ -405,7 +405,7 @@ SR_PRIV int mso_receive_data(int fd, int revents, void *cb_data)
|
|||
|
||||
if (devc->limit_samples && devc->num_samples >= devc->limit_samples) {
|
||||
sr_info("Requested number of samples reached.");
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -236,7 +236,7 @@ SR_PRIV int hcs_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits)) {
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -455,9 +455,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
{
|
||||
struct sr_modbus_dev_inst *modbus;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
std_session_send_df_end(sdi);
|
||||
|
||||
modbus = sdi->conn;
|
||||
|
|
|
@ -196,7 +196,7 @@ SR_PRIV int maynuo_m97_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits)) {
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ static int receive_data(int fd, int revents, int idx, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits))
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ SR_PRIV int motech_lps_30x_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits))
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
/* Only request the next packet if required. */
|
||||
if (!((sdi->status == SR_ST_ACTIVE) && (devc->acq_running)))
|
||||
|
|
|
@ -417,7 +417,7 @@ SR_PRIV int norma_dmm_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits)) {
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
} else {
|
||||
/* Request next package. */
|
||||
if (devc->last_req_pending) {
|
||||
|
|
|
@ -82,7 +82,7 @@ static void send_data(const struct sr_dev_inst *sdi, float sample)
|
|||
devc->num_samples++;
|
||||
/* Limiting number of samples is only supported for live data. */
|
||||
if (devc->cur_data_source == DATA_SOURCE_LIVE && devc->limit_samples && devc->num_samples >= devc->limit_samples)
|
||||
sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi);
|
||||
sr_dev_acquisition_stop((struct sr_dev_inst *)sdi);
|
||||
}
|
||||
|
||||
static void process_measurement(const struct sr_dev_inst *sdi)
|
||||
|
|
|
@ -682,7 +682,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
|
||||
devc = sdi->priv;
|
||||
|
||||
sr_dbg("Stopping acquisition.");
|
||||
write_shortcommand(devc, CMD_RESET);
|
||||
write_shortcommand(devc, CMD_RESET);
|
||||
write_shortcommand(devc, CMD_RESET);
|
||||
|
|
|
@ -424,7 +424,7 @@ SR_PRIV int p_ols_receive_data(int fd, int revents, void *cb_data)
|
|||
if (bytes_read < 0) {
|
||||
sr_err("Failed to read FTDI data (%d): %s.",
|
||||
bytes_read, ftdi_get_error_string(devc->ftdic));
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return FALSE;
|
||||
}
|
||||
if (bytes_read == 0) {
|
||||
|
@ -672,7 +672,7 @@ SR_PRIV int p_ols_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
g_free(devc->raw_sample_buf);
|
||||
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -1119,11 +1119,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
|
||||
devc = sdi->priv;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE) {
|
||||
sr_err("Device inactive, can't stop acquisition.");
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
std_session_send_df_end(sdi);
|
||||
|
||||
g_slist_free(devc->enabled_channels);
|
||||
|
|
|
@ -634,7 +634,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
|
|||
sr_err("Read error, aborting capture.");
|
||||
packet.type = SR_DF_FRAME_END;
|
||||
sr_session_send(sdi, &packet);
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
/* At slow timebases in live capture the DS2072
|
||||
|
@ -667,7 +667,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
|
|||
sr_err("Read error, aborting capture.");
|
||||
packet.type = SR_DF_FRAME_END;
|
||||
sr_session_send(sdi, &packet);
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -727,7 +727,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
|
|||
sr_err("Read should have been completed");
|
||||
packet.type = SR_DF_FRAME_END;
|
||||
sr_session_send(sdi, &packet);
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
}
|
||||
devc->num_block_read = 0;
|
||||
|
@ -765,7 +765,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
|
|||
|
||||
if (++devc->num_frames == devc->limit_frames) {
|
||||
/* Last frame, stop capture. */
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
} else {
|
||||
/* Get the next frame, starting with the first channel. */
|
||||
devc->channel_entry = devc->enabled_channels;
|
||||
|
|
|
@ -399,9 +399,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
struct dev_context *devc = sdi->priv;
|
||||
struct drv_context *drvc = sdi->driver->context;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
saleae_logic_pro_stop(sdi);
|
||||
|
||||
std_session_send_df_end(sdi);
|
||||
|
|
|
@ -775,9 +775,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
{
|
||||
int ret;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
ret = logic16_abort_acquisition(sdi);
|
||||
|
||||
abort_acquisition(sdi->priv);
|
||||
|
|
|
@ -678,9 +678,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
struct sr_scpi_dev_inst *scpi;
|
||||
float f;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
scpi = sdi->conn;
|
||||
|
||||
/*
|
||||
|
|
|
@ -188,7 +188,7 @@ int receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits))
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -759,12 +759,9 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
|
||||
devc = sdi->priv;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
if (devc->state != STATE_IDLE && !devc->cancel_requested) {
|
||||
devc->cancel_requested = TRUE;
|
||||
sr_dbg("Stopping acquisition.");
|
||||
sr_dbg("Requesting cancel.");
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
|
|
|
@ -221,7 +221,7 @@ SR_PRIV int teleinfo_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->sw_limits))
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "protocol.h"
|
||||
|
||||
#define SERIALCOMM "115200/8n1"
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi);
|
||||
|
||||
static const uint32_t scanopts[] = {
|
||||
SR_CONF_CONN,
|
||||
|
@ -285,7 +284,7 @@ static void receive_data(struct sr_dev_inst *sdi, unsigned char *data, int len)
|
|||
|
||||
devc->reply_size = 0;
|
||||
if (sr_sw_limits_check(&devc->sw_limits))
|
||||
dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
else
|
||||
testo_request_packet(sdi);
|
||||
|
||||
|
@ -305,7 +304,7 @@ SR_PRIV void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
|
|||
|
||||
if (transfer->status == LIBUSB_TRANSFER_NO_DEVICE) {
|
||||
/* USB device was unplugged. */
|
||||
dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
} else if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
|
||||
/* First two bytes in any transfer are FTDI status bytes. */
|
||||
if (transfer->actual_length > 2)
|
||||
|
@ -320,7 +319,7 @@ SR_PRIV void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
|
|||
libusb_error_name(ret));
|
||||
g_free(transfer->buffer);
|
||||
libusb_free_transfer(transfer);
|
||||
dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
}
|
||||
} else {
|
||||
/* This was the last transfer we're going to receive, so
|
||||
|
@ -347,7 +346,7 @@ static int handle_events(int fd, int revents, void *cb_data)
|
|||
drvc = di->context;
|
||||
|
||||
if (sr_sw_limits_check(&devc->sw_limits))
|
||||
dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
if (sdi->status == SR_ST_STOPPING) {
|
||||
usb_source_remove(sdi->session, drvc->sr_ctx);
|
||||
|
@ -412,9 +411,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||
{
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
sdi->status = SR_ST_STOPPING;
|
||||
|
||||
return SR_OK;
|
||||
|
|
|
@ -158,7 +158,7 @@ SR_PRIV int testo_request_packet(const struct sr_dev_inst *sdi)
|
|||
receive_transfer, (void *)sdi, 100);
|
||||
if ((ret = libusb_submit_transfer(devc->out_transfer) != 0)) {
|
||||
sr_err("Failed to request packet: %s.", libusb_error_name(ret));
|
||||
sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi);
|
||||
sr_dev_acquisition_stop((struct sr_dev_inst *)sdi);
|
||||
return SR_ERR;
|
||||
}
|
||||
sr_dbg("Requested new packet.");
|
||||
|
|
|
@ -205,7 +205,7 @@ SR_PRIV int tondaj_sl_814_receive_data(int fd, int revents, void *cb_data)
|
|||
}
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits))
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -171,7 +171,6 @@ 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);
|
||||
sr_session_source_remove(sdi->session, -1);
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ SR_PRIV int uni_t_dmm_receive_data(int fd, int revents, void *cb_data)
|
|||
|
||||
/* Abort acquisition if we acquired enough samples. */
|
||||
if (sr_sw_limits_check(&devc->limits))
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -296,9 +296,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||
{
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
/* Signal USB transfer handler to clean up and stop. */
|
||||
sdi->status = SR_ST_STOPPING;
|
||||
|
||||
|
|
|
@ -140,10 +140,8 @@ static void process_packet(struct sr_dev_inst *sdi)
|
|||
* a sample limit on "Memory" data source still works: unused
|
||||
* memory slots come through as "----" measurements. */
|
||||
devc->num_samples++;
|
||||
if (devc->limit_samples && devc->num_samples >= devc->limit_samples) {
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
}
|
||||
|
||||
if (devc->limit_samples && devc->num_samples >= devc->limit_samples)
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
}
|
||||
|
||||
SR_PRIV void LIBUSB_CALL uni_t_ut32x_receive_transfer(struct libusb_transfer *transfer)
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
#define VICTOR_INTERFACE 0
|
||||
#define VICTOR_ENDPOINT (LIBUSB_ENDPOINT_IN | 1)
|
||||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi);
|
||||
|
||||
static const uint32_t drvopts[] = {
|
||||
SR_CONF_MULTIMETER,
|
||||
};
|
||||
|
@ -223,13 +221,13 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
|
|||
devc = sdi->priv;
|
||||
if (transfer->status == LIBUSB_TRANSFER_NO_DEVICE) {
|
||||
/* USB device was unplugged. */
|
||||
dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
} else if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
|
||||
sr_dbg("Got %d-byte packet.", transfer->actual_length);
|
||||
if (transfer->actual_length == DMM_DATA_SIZE) {
|
||||
victor_dmm_receive_data(sdi, transfer->buffer);
|
||||
if (sr_sw_limits_check(&devc->limits))
|
||||
dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
}
|
||||
}
|
||||
/* Anything else is either an error or a timeout, which is fine:
|
||||
|
@ -242,7 +240,7 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
|
|||
libusb_error_name(ret));
|
||||
g_free(transfer->buffer);
|
||||
libusb_free_transfer(transfer);
|
||||
dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
}
|
||||
} else {
|
||||
/* This was the last transfer we're going to receive, so
|
||||
|
@ -269,7 +267,7 @@ static int handle_events(int fd, int revents, void *cb_data)
|
|||
drvc = di->context;
|
||||
|
||||
if (sr_sw_limits_check(&devc->limits))
|
||||
dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
if (sdi->status == SR_ST_STOPPING) {
|
||||
usb_source_remove(sdi->session, drvc->sr_ctx);
|
||||
|
@ -324,11 +322,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||
{
|
||||
if (sdi->status != SR_ST_ACTIVE) {
|
||||
sr_err("Device not active, can't stop acquisition.");
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
sdi->status = SR_ST_STOPPING;
|
||||
|
||||
return SR_OK;
|
||||
|
|
|
@ -660,9 +660,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
|
||||
std_session_send_df_end(sdi);
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
devc = sdi->priv;
|
||||
|
||||
devc->num_frames = 0;
|
||||
|
|
|
@ -1171,7 +1171,7 @@ SR_PRIV int dlm_data_receive(int fd, int revents, void *cb_data)
|
|||
* As of now we only support importing the current acquisition
|
||||
* data so we're going to stop at this point.
|
||||
*/
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
return TRUE;
|
||||
} else
|
||||
devc->current_channel = devc->current_channel->next;
|
||||
|
|
|
@ -592,6 +592,25 @@ SR_PRIV void sr_config_free(struct sr_config *src)
|
|||
|
||||
}
|
||||
|
||||
/** @private */
|
||||
SR_PRIV int sr_dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||
{
|
||||
if (!sdi || !sdi->driver) {
|
||||
sr_err("%s: Invalid arguments.", __func__);
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE) {
|
||||
sr_err("%s: Device instance not active, can't stop.",
|
||||
sdi->driver->name);
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
}
|
||||
|
||||
sr_dbg("%s: Stopping acquisition.", sdi->driver->name);
|
||||
|
||||
return sdi->driver->dev_acquisition_stop(sdi);
|
||||
}
|
||||
|
||||
static void log_key(const struct sr_dev_inst *sdi,
|
||||
const struct sr_channel_group *cg, uint32_t key, int op, GVariant *data)
|
||||
{
|
||||
|
|
|
@ -731,7 +731,7 @@ static int receive_data(int fd, int revents, void *cb_data)
|
|||
|
||||
if (dev_limit_counter_limit_reached(&devc->frame_count) ||
|
||||
dev_time_limit_reached(&devc->time_count))
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -834,6 +834,7 @@ SR_PRIV int sr_variant_type_check(uint32_t key, GVariant *data);
|
|||
SR_PRIV void sr_hw_cleanup_all(const struct sr_context *ctx);
|
||||
SR_PRIV struct sr_config *sr_config_new(uint32_t key, GVariant *data);
|
||||
SR_PRIV void sr_config_free(struct sr_config *src);
|
||||
SR_PRIV int sr_dev_acquisition_stop(struct sr_dev_inst *sdi);
|
||||
|
||||
/*--- session.c -------------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -830,7 +830,7 @@ SR_API int sr_session_start(struct sr_session *session)
|
|||
lend = l->next;
|
||||
for (l = session->devs; l != lend; l = l->next) {
|
||||
sdi = l->data;
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
}
|
||||
/* TODO: Handle delayed stops. Need to iterate the event
|
||||
* sources... */
|
||||
|
@ -913,8 +913,7 @@ static gboolean session_stop_sync(void *user_data)
|
|||
|
||||
for (node = session->devs; node; node = node->next) {
|
||||
sdi = node->data;
|
||||
if (sdi->driver && sdi->driver->dev_acquisition_stop)
|
||||
sdi->driver->dev_acquisition_stop(sdi);
|
||||
sr_dev_acquisition_stop(sdi);
|
||||
}
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
|
|
|
@ -217,13 +217,6 @@ SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi)
|
|||
const char *prefix = sdi->driver->name;
|
||||
int ret;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE) {
|
||||
sr_err("%s: Device inactive, can't stop acquisition.", prefix);
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
}
|
||||
|
||||
sr_dbg("%s: Stopping acquisition.", prefix);
|
||||
|
||||
if ((ret = serial_source_remove(sdi->session, serial)) < 0) {
|
||||
sr_err("%s: Failed to remove source: %d.", prefix, ret);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue