hi there!
I bought a Saleae logic pro 16 and followed all steps depicted in [1] to
obtain the FPGA firmware.
pulseview worked afterwards, but only for one capture. whenever I was
starting a secondary capture the device would blink red (3-7?-3) and
pulseview would get timed out with a LIBUSB error (see attached).
in order to recover I had to restart pulseview and plug in/out the logic
analyzer.
the attached patch fixes this behavior. please note that my code is just a
proof-of-concept, I'm willing to shape it to better fit your code.
best regards,
peter
[1] https://www.sigrok.org/wiki/Saleae_Logic_Pro_16
sr: [17:47.751296] session: Creating our own main context.
sr: [17:47.751325] session: Starting.
sr: [17:47.751330] hwdriver: saleae-logic-pro: Starting acquisition.
sr: [17:47.751335] saleae-logic-pro: 16 channels enabled (0xffff)
sr: [17:47.860859] saleae-logic-pro: random: 0x10 0xbf 0xab 0x44
sr: [17:47.969276] saleae-logic-pro: nonce: 0xc1 0xc1 0xc3 0x2f
sr: [17:48.077698] saleae-logic-pro: nonce: 0xd6 0x9e 0x15 0xce
sr: [17:48.187028] saleae-logic-pro: sig: 0x34 0x48 0xed 0xe7
sr: [17:48.187046] saleae-logic-pro: sig crc: 0x93 0x09
sr: [17:48.187051] saleae-logic-pro: Authenticate 0x9c42ebf5 -> 0x1d9f86c2
sr: [17:49.187500] saleae-logic-pro: Failed to receive response to request
0x80: LIBUSB_ERROR_TIMEOUT.
sr: [17:50.187974] saleae-logic-pro: Failed to send request 0x80:
LIBUSB_ERROR_TIMEOUT.
sr: [17:51.188450] saleae-logic-pro: Failed to send request 0x80:
LIBUSB_ERROR_TIMEOUT.
sr: [17:52.188919] saleae-logic-pro: Failed to send request 0x01:
LIBUSB_ERROR_TIMEOUT.
sr: [17:52.190356] saleae-logic-pro: Failed to submit transfer:
LIBUSB_ERROR_NO_MEM.
sr: [17:52.320578] session: Could not start saleae-logic-pro device usb/2-2
acquisition.
sr: [17:52.320597] hwdriver: saleae-logic-pro: Stopping acquisition.
sr: [17:53.321018] saleae-logic-pro: Failed to send request 0x80:
LIBUSB_ERROR_TIMEOUT.
sr: [17:54.321461] saleae-logic-pro: Failed to send request 0x02:
LIBUSB_ERROR_TIMEOUT.
sr: [17:55.321907] saleae-logic-pro: Failed to send request 0x81:
LIBUSB_ERROR_TIMEOUT.
sr: [17:55.321936] session: bus: Received SR_DF_END packet.
sr: [17:55.321948] session: Cannot remove non-existing event source
0x55714059d6d0.
Notifying user of session error: "generic/unspecified error"
sr: [19:58.143143] device: saleae-logic-pro: Closing device instance.
sr: [19:58.145089] usb: Closed USB device 2.3.
srd: Exiting libsigrokdecode.
sr: [19:58.176818] hwdriver: Cleaning up all drivers.
sr: [19:58.176846] usb: Closed USB device 2.3.
diff -upr pulseview-0.4.2.orig/pv/mainwindow.cpp pulseview-0.4.2/pv/mainwindow.cpp
--- pulseview-0.4.2.orig/pv/mainwindow.cpp 2020-03-31 23:41:18.000000000 +0300
+++ pulseview-0.4.2/pv/mainwindow.cpp 2022-08-10 22:18:30.200077311 +0300
@@ -721,6 +721,7 @@ void MainWindow::on_run_stop_clicked()
case Session::AwaitingTrigger:
case Session::Running:
session->stop_capture();
+ session->reselect_device(session->device());
break;
}
}
diff -upr pulseview-0.4.2.orig/pv/session.cpp pulseview-0.4.2/pv/session.cpp
--- pulseview-0.4.2.orig/pv/session.cpp 2020-03-31 23:41:18.000000000 +0300
+++ pulseview-0.4.2/pv/session.cpp 2022-08-10 22:05:35.463871097 +0300
@@ -542,6 +542,78 @@ void Session::set_device(shared_ptr<devi
device_changed();
}
+void Session::reselect_device(shared_ptr<devices::Device> device)
+{
+ try {
+ if (device)
+ reset_device(device);
+ else
+ set_default_device();
+ } catch (const QString &e) {
+ MainWindow::show_session_error(tr("Failed to select device"), e);
+ }
+}
+
+void Session::reset_device(shared_ptr<devices::Device> device)
+{
+ assert(device);
+
+ // Ensure we are not capturing before setting the device
+ stop_capture();
+
+ if (device_)
+ device_->close();
+
+ device_.reset();
+
+ // Revert name back to default name (e.g. "Session 1") as the data is gone
+ name_ = default_name_;
+ name_changed();
+
+ // Remove all stored data and reset all views
+// for (shared_ptr<views::ViewBase> view : views_) {
+// view->clear_signals();
+#ifdef ENABLE_DECODE
+// view->clear_decode_signals();
+#endif
+// view->reset_view_state();
+// }
+// for (const shared_ptr<data::SignalData>& d : all_signal_data_)
+// d->clear();
+// all_signal_data_.clear();
+// signalbases_.clear();
+// cur_logic_segment_.reset();
+
+// for (auto& entry : cur_analog_segments_) {
+// shared_ptr<sigrok::Channel>(entry.first).reset();
+// shared_ptr<data::AnalogSegment>(entry.second).reset();
+// }
+
+// logic_data_.reset();
+
+// signals_changed();
+
+ device_ = move(device);
+
+ try {
+ device_->open();
+ } catch (const QString &e) {
+ device_.reset();
+ MainWindow::show_session_error(tr("Failed to open device"), e);
+ }
+
+ if (device_) {
+ device_->session()->add_datafeed_callback([=]
+ (shared_ptr<sigrok::Device> device, shared_ptr<Packet> packet) {
+ data_feed_in(device, packet);
+ });
+
+ update_signals();
+ }
+
+ device_changed();
+}
+
void Session::set_default_device()
{
const list< shared_ptr<devices::HardwareDevice> > &devices =
diff -upr pulseview-0.4.2.orig/pv/session.hpp pulseview-0.4.2/pv/session.hpp
--- pulseview-0.4.2.orig/pv/session.hpp 2020-03-31 23:41:18.000000000 +0300
+++ pulseview-0.4.2/pv/session.hpp 2022-08-10 22:05:00.716424002 +0300
@@ -163,11 +163,13 @@ public:
* Attempts to set device instance, may fall back to demo if needed
*/
void select_device(shared_ptr<devices::Device> device);
+ void reselect_device(shared_ptr<devices::Device> device);
/**
* Sets device instance that will be used in the next capture session.
*/
void set_device(shared_ptr<devices::Device> device);
+ void reset_device(shared_ptr<devices::Device> device);
void set_default_device();
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel