From: Joel Holdsworth Date: Mon, 11 Mar 2013 23:30:34 +0000 (+0000) Subject: Check that at least one probe is enabled before acquisition begins X-Git-Tag: pulseview-0.1.0~85 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9c48fa57f507c1eb153b0fb4d3a273c5e32757c8;p=pulseview.git Check that at least one probe is enabled before acquisition begins --- 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));