Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/hardware/openbench-logic-sniffer/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,10 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
std_session_send_df_header(sdi);

/* If the device stops sending for longer than it takes to send a byte,
* that means it's finished. But wait at least 100 ms to be safe.
* that means it's finished. Since the device can be used over a slow
* network link, give it 10 seconds to reply.
*/
return serial_source_add(sdi->session, serial, G_IO_IN, 100,
return serial_source_add(sdi->session, serial, G_IO_IN, 10 * 1000,
ols_receive_data, (struct sr_dev_inst *)sdi);
}

Expand Down
16 changes: 14 additions & 2 deletions src/hardware/openbench-logic-sniffer/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,12 @@ SR_PRIV int ols_receive_data(int fd, int revents, void *cb_data)
sr_dbg("RLE count: %u.",
devc->rle_count);
devc->raw_sample_size = 0;
return TRUE;

/*
* Even on the rare occasion that the sampling ends with an RLE message,
* the acquisition should end immediately, without any timeout.
*/
goto process_and_forward;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is an OK case for 'goto'. So, patch looks good to me.

}
}

Expand Down Expand Up @@ -521,9 +526,16 @@ SR_PRIV int ols_receive_data(int fd, int revents, void *cb_data)
devc->raw_sample_size = 0;
devc->rle_count = 0;
}
} else {
}

process_and_forward:
if (revents != G_IO_IN ||
devc->cnt_rx_raw_samples == devc->limit_samples) {
unsigned int num_pre_trigger_samples;

if (devc->cnt_rx_raw_samples != devc->limit_samples)
sr_warn("Finished with unexpected sample count. Timeout?");

/*
* This is the main loop telling us a timeout was reached, or
* we've acquired all the samples we asked for -- we're done.
Expand Down