ppannuto / python-saleae

Python library to control a Saleae Logic Analyzer
Apache License 2.0
124 stars 55 forks source link

Is there a way to get ACK when the capture starts #76

Closed maltekliemann closed 3 years ago

maltekliemann commented 3 years ago

TL;DR Is there a way to start a capture and get an acknowledgment for when the capture starts?

The problem, roughly, is the following: If capture_start is called and a signal arrives at the recording device, say, a nanosecond later, will that signal be recorded? Probably not. What about a second later? Probably. I would like to know for sure, in other words, I would like to get an acknowledgment which, one received by the host, guarantees that the recording is running. I'm fine with waiting a couple of seconds. So, for example:

handle = s.capture_start()
# The recording may or may not be running at this point.
handle.wait()
# Now the recording is guaranteed to be running.
time.sleep(1.0)
s.capture_stop()
# The recording is at least 1.0 seconds long.

Currently, capture_start returns immediately, and doesn't return any kind of callback functionality. It appears that the wrapped C# API may not have this functionality either, see saleae/SaleaeSocketApi#15.

18 may be related.

ppannuto commented 3 years ago

This is actually a fairly complex end-to-end problem -- even if the logic software reports that it's issued the capture start command, at what nanosecond did the physical saleae device start logging? I'm guessing this is not something that will be easy for the Logic folks to implement, and a pragmatic solution will simply be to start captures several seconds before any events of interest.

That all said, I'm just a stranger on the Internet who wrote some Python once upon a time. If Saleae changes anything upstream or adds the functionality, I'm happy to take updates to this library to make use of them. I have no control over Logic features or development though, so I'm going to close this until something is able to change upstream to support it.