Saleae Logic 2 Automation API

Hi @sasi.lior1 ,

To confirm, are you running Logic 2 in the background? And have you enabled the automation server? When it is enabled, you should see this in the bottom right corner of the app:

image

Ryan

Hi Ryan,

Yes, running the Logic2, enabled the automation server and getting the error.

Thanks,
Lior.

Could you please try the following:

  1. In a terminal, can you run lsof -i | grep 10430 and paste the output here? I want to make sure there isn’t an issue where the application is reporting that it is listening, but it’s not.
  2. Can you also run ps -f ax | grep Logic and paste the output here? It’s normal for there to be multiple processes, but I’d like to make sure there aren’t multiple instances of the application running.

You can also message me the output directly.

Thanks,

Ryan

Hi,

Didn’t found the way to send direct message so responded here.

For lsof -i | grep 10430:
Logic 165011 administrator 72u IPv4 775996 0t0 TCP localhost:10430 (LISTEN)

For ps -f ax | grep Logic:
adminis+ 164910 164873 1 11:36 pts/1 Sl+ 0:02 /tmp/.mount_Logic-KAYonU/Logic --enable-crashpad
adminis+ 164914 2099 2 11:36 ? Ssl 0:04 ./Logic-2.3.58-master.AppImage
adminis+ 164959 164910 0 11:36 pts/1 S+ 0:00 /tmp/.mount_Logic-KAYonU/Logic --type=zygote --no-zygote-sandbox --enable-crashpad --enable-crashpad
adminis+ 164960 164910 0 11:36 pts/1 S+ 0:00 /tmp/.mount_Logic-KAYonU/Logic --type=zygote --enable-crashpad --enable-crashpad
adminis+ 164962 164960 0 11:36 pts/1 S+ 0:00 /tmp/.mount_Logic-KAYonU/Logic --type=zygote --enable-crashpad --enable-crashpad
adminis+ 164975 2099 0 11:36 ? Sl 0:00 /tmp/.mount_Logic-KAYonU/chrome_crashpad_handler --monitor-self-annotation=ptype=crashpad-handler --no-rate-limit --database=/home/administrator/.config/Logic/Crashpad --url=https://submit.backtrace.io/saleae-logic/c9a7b8f5e55b8b7532cd59bb95c5dde46b91b6665da46ffa3a2920cd3eb260fa/minidump --annotation=_companyName=saleae-logic --annotation=_productName=Logic2 --annotation=_version=2.3.58 --annotation=environment=production --annotation=launchId=203cc1a6-dce4-49ac-9a9f-11dec5ecdcf9 --annotation=machineId=dd7d74f2-a3fc-4abb-91b1-1472c85195a8 --annotation=prod=Electron --annotation=release=2.3.58 --annotation=ver=19.0.6 --initial-client-fd=46 --shared-client-connection
adminis+ 164990 164959 2 11:36 pts/1 Sl+ 0:04 /tmp/.mount_Logic-KAYonU/Logic --type=gpu-process --enable-crashpad --crashpad-handler-pid=164975 --enable-crash-reporter=70e16dfb-18d8-4aff-941b-78c9cf917592,no_channel --user-data-dir=/home/administrator/.config/Logic --gpu-preferences=WAAAAAAAAAAgAAAIAAAAAAAAAAAAAAAAAABgAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAAAAAAAABAAAAAAAAAAgAAAAAAAAACAAAAAAAAAAIAAAAAAAAAA== --shared-files --field-trial-handle=0,i,5499783548097853741,5400071577588175167,131072 --disable-features=OutOfBlinkCors,SpareRendererForSitePerProcess
adminis+ 164998 164910 0 11:36 pts/1 Sl+ 0:00 /tmp/.mount_Logic-KAYonU/Logic --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-GB --service-sandbox-type=none --enable-crashpad --crashpad-handler-pid=164975 --enable-crash-reporter=70e16dfb-18d8-4aff-941b-78c9cf917592,no_channel --user-data-dir=/home/administrator/.config/Logic --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,5499783548097853741,5400071577588175167,131072 --disable-features=OutOfBlinkCors,SpareRendererForSitePerProcess --enable-crashpad
adminis+ 165011 164910 15 11:36 pts/1 Sl+ 0:31 /tmp/.mount_Logic-KAYonU/Logic --type=renderer --enable-crashpad --crashpad-handler-pid=164975 --enable-crash-reporter=70e16dfb-18d8-4aff-941b-78c9cf917592,no_channel --user-data-dir=/home/administrator/.config/Logic --app-path=/tmp/.mount_Logic-KAYonU/resources/app.asar --no-sandbox --no-zygote --node-integration-in-worker --max-active-webgl-contexts=64 --lang=en-GB --num-raster-threads=2 --enable-main-frame-before-activation --renderer-client-id=4 --launch-time-ticks=67340558354 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,5499783548097853741,5400071577588175167,131072 --disable-features=OutOfBlinkCors,SpareRendererForSitePerProcess --enable-crashpad
adminis+ 165097 164962 0 11:36 pts/1 Sl+ 0:00 /tmp/.mount_Logic-KAYonU/Logic --type=utility --utility-sub-type=device.mojom.XRDeviceService --lang=en-GB --service-sandbox-type=utility --enable-crashpad --crashpad-handler-pid=164975 --enable-crash-reporter=70e16dfb-18d8-4aff-941b-78c9cf917592,no_channel --user-data-dir=/home/administrator/.config/Logic --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,5499783548097853741,5400071577588175167,131072 --disable-features=OutOfBlinkCors,SpareRendererForSitePerProcess
adminis+ 166194 165915 0 11:39 pts/3 S+ 0:00 grep --color=auto Logic

Thanks,
Lior.

I’m having the same issues with windows so I’ll follow this discussion ,
Matan

@sasi.lior1 Thanks! So it looks like everything is running correctly, but for some reason the Python script can’t connect. Do you have a firewall running? Anything that might be blocking loopback/127.0.0.1 traffic?

The output of ifconfig would also be useful to see if there is anything specific about your networking setup that would give a clue.

You could also trying running your script with the environment variables GRPC_TRACE=connectivity_state,channel,client_channel GRPC_VERBOSITY=debug set. This will output some extra GRPC debugging information (more info here: grpc/environment_variables.md at master · grpc/grpc · GitHub).

Ryan

Hey Ryan,
Thanks for your answer!
I’m trying to use the environmental variables you said and I’m not getting any new information on the screen.
I wanted to ask , since we are using corporate proxy , is there any way to execute the script with http proxy?

thanks,
Matan

Hi,

Yes, there is a way, but from my understanding it is enabled by default.

gRPC options (enable_http_proxy highlighted): grpc/grpc_types.h at v1.46.x · grpc/grpc · GitHub

We don’t currently expose the ability to set these options in the Python API, but we could add that. The relevant location in the Python API is here: logic2-automation/automation.py at develop · saleae/logic2-automation · GitHub

And the gRPC docs for insecure_channel: gRPC — gRPC Python 1.46.2 documentation

According to grpc/environment_variables.md at master · grpc/grpc · GitHub, you can set the proxy URI using an environment variable.

Regarding your corporate proxy, does that affect loopback/127.0.0.1 traffic? I don’t think I specifically asked before, but is Logic 2 and the python script running on the same machine?

Ryan

Hi,

First, the logic and the python script are running on the same machine, and secondly , I think maybe it does affect the loopback:

I tried again the debugging environmental variables you advised , and this time I caught some more information –

It looks like it’s trying to loopback through proxy , and retrying again and again without success:

Hi @matan2.cohen ,

You might be able to use the environment variable no_grpc_proxy (no_grpc_proxy=127.0.0.1 or similar, the env variables are linked in my previous post) to disable the proxy. In the next release I’ll see if I can add an argument for the grpc options to pass-through to the grpc API.

Ryan

Hi,
I’m trying to run the example in the Automation API documentation and I’m having trouble running the code. I’m using Windows and the Logic 2.3.59 version and python 3.9.

File “C:\FOCUS_Workspace\Binho\TestAutomation\saleae_example.py”, line 26, in
with manager.start_capture(device_serial_number=‘F4241’,
File “C:\Users\EVOO\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\saleae\automation.py”, line 490, in start_capture
reply: saleae_pb2.StartCaptureReply = self.stub.StartCapture(
File “C:\Users\EVOO\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\grpc_channel.py”, line 946, in call
return _end_unary_response_blocking(state, call, False, None)
File “C:\Users\EVOO\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\grpc_channel.py”, line 849, in _end_unary_response_blocking
raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.INTERNAL
details = “Assertion failed”
debug_error_string = “{“created”:”@1661541260.832000000",“description”:“Error received from peer ipv4:127.0.0.1:10430”,“file”:“src/core/lib/surface/call.cc”,“file_line”:953,“grpc_message”:“Assertion failed”,“grpc_status”:13}"

What am I doing wrong?

Thanks,
Julian.

It’s working!!!

set no_proxy=127.0.0.1

worked for me finally!

Thank you so much for all your help,

Matan

1 Like

I had the same issue in Windows 10 using Logic 2.3.58. It went away when I downgraded to version 2.3.58. Separately, though, it looks like you’re using the device_serial_number from the instructions, which will be different from your own. I got mine by going to Device Settings->3 dot hamburger->Device Info.

Sorry @julian and @jbrasch, we had a set of breaking changes in the latest Automation API Beta that were not mentioned in the changelog, and the documentation itself did not include the latest .whl and example. This is my fault, and has since been updated: Getting Started — Saleae 0.9.0 documentation.

If you upgrade to 2.3.59+ you will need to use the latest .whl package (0.9.0)

We will be releasing the 1.0.0 version very soon, and it is unlikely to break gRPC or Python compatibility with 2.3.59.

Great to hear, thanks for the update @matan2.cohen.

@sasi.lior1 Since you were seeing the same error, I’m curious if this change also resolves the issue for you.

Ryan

Hi,

I was exploring the functionality of data export for Demo simulation, as we have a Custom Analyzer we’re providing a “Simulation binary” file in order to get the analyzer-specific data which is working fine from the UI, but if I do the same sequence from the automation APIs I couldn’t get the analyzer-specific data I was trying to simulate with the external binary file instead what I was getting is the same simulation data that Logic software provides by default.

I’ve made sure that all the configurations for the custom analyzer were done correctly and after the capture was completed, I confirmed the same by loading the generated raw capture (.sal) file and the settings/parameters for the Analyzer are as intended.

It seems like the data simulation behavior when captured with the provided simulation binary is somehow not being taken while doing it from API calls.

Logic2 version: v2.3.58
Automation pkg: v0.0.1

Not sure if I’m missing something but the steps and observations seem correct, I would appreciate any input regarding my issue.

Thanks,
Abhiram

Hi @saiabhiram73865,

Would you be able to share the python code or the specific export API you are using? Is it the digital data, or the analyzer data that is incorrect?

which is working fine from the UI

If you export from the UI, does the exported data also look correct?

Thanks!

Ryan

It’s not the digital data for sure, it’s the analyzer data - I’m using:

#Export Analyzer Legacy as txt:

capture.export_analyzer_legacy(data_path,async_serial_analyzer_2,automation.RadixType.HEXADECIMAL)

Indeed it’s working!

Thanks Ryan!

1 Like

Hi huffman,

Here is the code blocks you can take a look and the API call for the export,

analyzer_uart = capture_instance.add_analyzer('Async Serial', label=f'UART_ANALYZER', settings={
          'Input Channel': 0,
          'Bit Rate (Bits/s)': 1_000_000
})
capture_instance.export_data_table(
            filepath=analyzer_export_file,
            analyzers=[analyzer_uart]
)

I’ve tried the export with the in-build analyzer itself, and there seems to be an issue here as well. It’s the analyzer export I’m looking for, the digital export still has data because it will be just the channel data though it can’t be analyzer-specific data generated as per simulation.

If you export from the UI, does the exported data also look correct?

Yes, if I start the simulation from UI and export it the analyzer export data is reflecting the actually generated analyzer-specific simulation.

Let me know if you get my issue or any specific details you need.

Thanks,
Abhiram