Bug 1748 - saleae-logic-pro: Immediate timeout after initialization
Summary: saleae-logic-pro: Immediate timeout after initialization
Status: CONFIRMED
Alias: None
Product: libsigrok
Classification: Unclassified
Component: Driver: saleae-logic-pro (show other bugs)
Version: unreleased development snapshot
Hardware: All All
: Normal critical
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-16 10:16 CET by Michael Weiner
Modified: 2021-11-16 10:22 CET (History)
1 user (show)



Attachments
sigrok-cli log file (12.43 KB, text/plain)
2021-11-16 10:16 CET, Michael Weiner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Weiner 2021-11-16 10:16:51 CET
Created attachment 757 [details]
sigrok-cli log file

With our new Saleae Logic Pro 16 (which, just for the record, works perfectly with the official Saleae software), I run into a timeout after initialization, and before the first data is captured.

I could reproduce this both on an Arch linux x64 machine (git snapshot) and a Raspi 4 (libsigrok 0.5.1). The bug report is based on the data from the Arch machine.

libsigrok commit id: fb28e72dfdea0d985e03795f1f058aa4621e7e55
sigrok-cli commit id: 7ce834c1166fcf57ebb0e20bf4e7ba9e856aa6ce

I called sigrok-cli as:
$ LD_LIBRARY_PATH=../libsigrok/.libs ./sigrok-cli -l 5 --driver saleae-logic-pro --continuous

I added some debug output to better track down the issue:
--- cut ---
it diff
diff --git a/src/hardware/saleae-logic-pro/api.c b/src/hardware/saleae-logic-pro/api.c
index 0a2a2728..84afb914 100644
--- a/src/hardware/saleae-logic-pro/api.c
+++ b/src/hardware/saleae-logic-pro/api.c
@@ -383,12 +383,16 @@ static int dev_acquisition_handle(int fd, int revents, void *cb_data)
        struct timeval tv = ALL_ZERO;
 
        (void)fd;
+       sr_dbg("saleae-logic-pro: dev_acquisition_handle()");
 
        libusb_handle_events_timeout(drvc->sr_ctx->libusb_ctx, &tv);
 
        /* Handle timeout */
        if (!revents)
+       {
+               sr_err("saleae-logic-pro: stopping acquisition");
                sr_dev_acquisition_stop(sdi);
+       }
 
        return TRUE;
 }
--- cut ---

The important part of the attached log file is
--- cut ---
cli: Received SR_DF_HEADER.
sr: [00:00.489610] hwdriver: sr_config_get(): key 30000 (samplerate) sdi 0x561e5be9e530 cg NULL -> uint64 10000000
sr: [00:00.489749] saleae-logic-pro: Iterate 0x56931bfc -> 0x14aa0701
sr: [00:00.490221] saleae-logic-pro: Iterate 0x14aa0701 -> 0x493f55c1
Press any key to stop acquisition.
sr: [00:01.491614] saleae-logic-pro: saleae-logic-pro: dev_acquisition_handle()
sr: [00:01.491721] saleae-logic-pro: saleae-logic-pro: stopping acquisition
sr: [00:01.491745] hwdriver: saleae-logic-pro: Stopping acquisition.
--- cut ---

so apparently, dev_acquisition_handle() is called with revents=0, which makes the acquisition fail. Note that this is the first time the function is called.
Comment 1 Michael Weiner 2021-11-16 10:22:51 CET
For the record, here are the hashes of the firmware/bitstream files:

/usr/share/sigrok-firmware/ sha256sum *    
ad86c11965ee55f6705ad7ac6a5d7b57bad3a2a5d815633f5ded2e2fa553000f  saleae-logic16-fpga-18.bitstream
0748da041cf56d2dba1165e1a2718f46f0525428c118f100f50905c9e0c9d7ac  saleae-logic16-fpga-33.bitstream
e3c87262a4a79ccb1cf5bd7848ce7183235d2914a9fc1774bd8f960ba411fdbc  saleae-logic16-fx2.fw
e36720e59e0dea1dc4bd4a860e2b5b163dec09248af10882144960cad92db9a4  saleae-logicpro16-fpga.bitstream
c5c5da48317497b81343cb0ed7c815bf1e388a3977b8518e4b1cbed4580e03d3  saleae-logicpro16-fx3.fw
abe49cd4a3171f8344f789b3eb538b52bf8298c3df7525a9a3ec5124567f4b07  saleae-logicpro8-fpga.bitstream
ee091c4e0e20947f4068625a247fc75fe87f6b384e70a65ebf3c83184cff5242  saleae-logicpro8-fx3.fw