From 9c48fa57f507c1eb153b0fb4d3a273c5e32757c8 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Mon, 11 Mar 2013 23:30:34 +0000 Subject: [PATCH] Check that at least one probe is enabled before acquisition begins --- pv/sigsession.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index 8ab7dab8..a611e7ac 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -77,6 +77,21 @@ void SigSession::start_capture(struct sr_dev_inst *sdi, { stop_capture(); + // Check that at least one probe is enabled + const GSList *l; + for (l = sdi->probes; l; l = l->next) { + sr_probe *const probe = (sr_probe*)l->data; + assert(probe); + if (probe->enabled) + break; + } + + if (!l) { + error_handler(tr("No probes enabled.")); + return; + } + + // Begin the session _sampling_thread.reset(new boost::thread( &SigSession::sample_thread_proc, this, sdi, record_length, error_handler)); -- 2.30.2