# Stop acquisition from python script

**URL:** <https://discuss.saleae.com/t/stop-acquisition-from-python-script/1018>\
**Category:** Extensions\
**Created:** [May 3, 2021, 11:44am UTC](https://discuss.saleae.com/t/stop-acquisition-from-python-script/1018 "2021-05-03T11:44:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![davide.ferrari](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@davide.ferrari](https://discuss.saleae.com/u/davide.ferrari)\
**Post date:** [May 3, 2021, 11:44am UTC](https://discuss.saleae.com/t/stop-acquisition-from-python-script/1018/1 "2021-05-03T11:44:26Z")

</div>

Hi  
would it be possible to stop the acquisition through the same python script I use to analyze the data?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![timreyes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/timreyes/32/108_2.png) [@timreyes](https://discuss.saleae.com/u/timreyes)\
**Post date:** [May 3, 2021, 10:28pm UTC](https://discuss.saleae.com/t/stop-acquisition-from-python-script/1018/2 "2021-05-03T22:28:16Z")

</div>

Hi @davide.ferrari, I assume you are using the following software tools?

- Logic v2 software: [Logic analyzer software from Saleae](https://www.saleae.com/downloads/)
- Python HLA: [High-Level Analyzer Extensions - Saleae Support](https://support.saleae.com/extensions/high-level-analyzer-quickstart)

If so, then unfortunately, Python HLAs do not have the ability to control captures.

In case you are looking to automate starting and stopping of captures, we are currently gathering feedback/user interest in the feature request below. Feel free to add your votes/comments to it if this is something you need!  
[https://ideas.saleae.com/b/feature-requests/application-api/](https://ideas.saleae.com/b/feature-requests/application-api/)

Otherwise, as an alternative, we do support automation of captures in our older (no longer supported) Logic v1.x. More information on this below in case you are interested:  
[https://support.saleae.com/saleae-api-and-sdk/socket-api](https://support.saleae.com/saleae-api-and-sdk/socket-api)

Hope this information helps.

---

<div class="post-metadata">

**Author:** ![davide.ferrari](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@davide.ferrari](https://discuss.saleae.com/u/davide.ferrari)\
**Post date:** [May 4, 2021, 5:51am UTC](https://discuss.saleae.com/t/stop-acquisition-from-python-script/1018/3 "2021-05-04T05:51:25Z")

</div>

Hi Tim  
yes I do use Logic 2 with HLA  
Ok thanks for the links, I’ll take a look.

---

<div class="post-metadata">

**Author:** ![davide.ferrari](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@davide.ferrari](https://discuss.saleae.com/u/davide.ferrari)\
**Post date:** [May 4, 2021, 6:05am UTC](https://discuss.saleae.com/t/stop-acquisition-from-python-script/1018/4 "2021-05-04T06:05:36Z")

</div>

@timreyes I’ve seen that there is the so called “Trigger view” which is now limited to trigger on the decoding of a value (hex).  
Would it be possible to extend it and to trigger when a pattern (like a string) is reported by the custom analyzer?  
In this way for instance I could report “error” form the script and then the capture would be stopped upon errors.

---

<div class="post-metadata">

**Author:** ![timreyes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/timreyes/32/108_2.png) [@timreyes](https://discuss.saleae.com/u/timreyes)\
**Post date:** [May 4, 2021, 9:34pm UTC](https://discuss.saleae.com/t/stop-acquisition-from-python-script/1018/5 "2021-05-04T21:34:58Z")

</div>

@davide.ferrari Right now, we don’t have a native way of looking for a trigger with regards to a sequence of bytes (or decoded boxes). The Trigger View can only trigger on one decoded box at a time.

As an example in the image below…  
 ![Screen Shot 2021-05-04 at 4.28.07 PM](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/1X/0002a13aaf4581db6750337a8eae1425b00ec090.png)

If the Trigger View is attached to the Async Serial analyzer, it can only trigger on a single ASCII character, such as “H” or “e”, but not a combination “He.” The workaround is to use a concatenator extension (like the one shown here) to combine the decoded boxes into a single “Hello Saleae” message. Since all characters are combined in a single decoded box, I am not able to trigger on a sequence of characters, such as “Hello” or “Sal.”

I’m using the Concatenator extension here, as submitted by a community user to our extensions marketplace. More information on installing extensions are below. This extensions seems to be compatible only with our Async Serial analyzer though, but this does open up the possibility for developing extensions like this that are compatible for other analyzers for this purpose.  
[https://support.saleae.com/extensions/installing-extensions](https://support.saleae.com/extensions/installing-extensions)

---

<div class="post-metadata">

**Author:** ![davide.ferrari](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@davide.ferrari](https://discuss.saleae.com/u/davide.ferrari)\
**Post date:** [May 5, 2021, 6:18am UTC](https://discuss.saleae.com/t/stop-acquisition-from-python-script/1018/6 "2021-05-05T06:18:57Z")

</div>

Thank you I’ll try it out!  
It seem a very good workaround.

---

<div class="post-metadata">

**Author:** ![davide.ferrari](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@davide.ferrari](https://discuss.saleae.com/u/davide.ferrari)\
**Post date:** [May 5, 2021, 12:34pm UTC](https://discuss.saleae.com/t/stop-acquisition-from-python-script/1018/7 "2021-05-05T12:34:31Z")

</div>

Hi Tim  
the concatenator works only on raw data produced by the Async serial analyzer.  
I would need really something triggering on the data produced by my custom python analyzer. It would be really appreciated.

---

<div class="post-metadata">

**Author:** ![timreyes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/timreyes/32/108_2.png) [@timreyes](https://discuss.saleae.com/u/timreyes)\
**Post date:** [May 5, 2021, 8:29pm UTC](https://discuss.saleae.com/t/stop-acquisition-from-python-script/1018/8 "2021-05-05T20:29:32Z")

</div>

I just re-opened a previous idea we were tracking. I’d like to start gathering feedback on how we can improve triggering on a protocol frame. You brought up some good points on being able to trigger on a sequence of data, rather than just a single protocol frame.  
[https://ideas.saleae.com/b/feature-requests/trigger-on-protocol-results/](https://ideas.saleae.com/b/feature-requests/trigger-on-protocol-results/)

---

<div class="post-metadata">

**Author:** ![huffman](https://avatars.discourse-cdn.com/v4/letter/h/71e660/32.png) [@huffman](https://discuss.saleae.com/u/huffman)\
**Post date:** [May 5, 2021, 9:24pm UTC](https://discuss.saleae.com/t/stop-acquisition-from-python-script/1018/9 "2021-05-05T21:24:42Z")

</div>

If the data you are triggering on is all in a single Analyzer Frame, you should be able to trigger on it. If you can give an example of the data you are producing, or the source code itself, I would be happy to help!

You had also mentioned stopping the capture - unfortunately the “Trigger View” for analyzers only works for moving the view to the latest trigger, but not stopping the capture altogether. I’m not sure if that’s sufficient for your use-case. This is something we’d like to support, but don’t currently.

Ryan
