]> sigrok.org Git - pulseview.git/blobdiff - pv/sigsession.cpp
Fixed decoder probes auto-select logic
[pulseview.git] / pv / sigsession.cpp
index 8d22296c40e89e57da2ad24ec12aec88112c7be9..e507a09946801fa0c081d8ecfecb18ba6806c946 100644 (file)
@@ -161,8 +161,7 @@ SigSession::capture_state SigSession::get_capture_state() const
        return _capture_state;
 }
 
-void SigSession::start_capture(uint64_t record_length,
-       function<void (const QString)> error_handler)
+void SigSession::start_capture(function<void (const QString)> error_handler)
 {
        stop_capture();
 
@@ -188,8 +187,7 @@ void SigSession::start_capture(uint64_t record_length,
 
        // Begin the session
        _sampling_thread = boost::thread(
-               &SigSession::sample_thread_proc, this, _sdi,
-               record_length, error_handler);
+               &SigSession::sample_thread_proc, this, _sdi, error_handler);
 }
 
 void SigSession::stop_capture()
@@ -235,10 +233,15 @@ bool SigSession::add_decoder(srd_decoder *const dec)
                decoder_stack = shared_ptr<data::DecoderStack>(
                        new data::DecoderStack(dec));
 
-               // Auto select the initial probes
+               // Make a list of all the probes
+               std::vector<const srd_probe*> all_probes;
                for(const GSList *i = dec->probes; i; i = i->next)
-               {
-                       const srd_probe *const probe = (const srd_probe*)i->data;
+                       all_probes.push_back((const srd_probe*)i->data);
+               for(const GSList *i = dec->opt_probes; i; i = i->next)
+                       all_probes.push_back((const srd_probe*)i->data);
+
+               // Auto select the initial probes
+               BOOST_FOREACH(const srd_probe *probe, all_probes)
                        BOOST_FOREACH(shared_ptr<view::Signal> s, _signals)
                        {
                                shared_ptr<view::LogicSignal> l =
@@ -248,7 +251,6 @@ bool SigSession::add_decoder(srd_decoder *const dec)
                                        l->get_name().toLower()))
                                        probes[probe] = l;
                        }
-               }
 
                assert(decoder_stack);
                assert(!decoder_stack->stack().empty());
@@ -557,7 +559,6 @@ void SigSession::load_input_thread_proc(const string name,
 }
 
 void SigSession::sample_thread_proc(struct sr_dev_inst *sdi,
-       uint64_t record_length,
        function<void (const QString)> error_handler)
 {
        assert(sdi);
@@ -572,15 +573,6 @@ void SigSession::sample_thread_proc(struct sr_dev_inst *sdi,
                return;
        }
 
-       // Set the sample limit
-       if (sr_config_set(sdi, NULL, SR_CONF_LIMIT_SAMPLES,
-               g_variant_new_uint64(record_length)) != SR_OK) {
-               error_handler(tr("Failed to configure "
-                       "time-based sample limit."));
-               sr_session_destroy();
-               return;
-       }
-
        if (sr_session_start() != SR_OK) {
                error_handler(tr("Failed to start session."));
                return;