Applying a preset to Logic2 Automation API Capture

Hi,

I am using Automation API to capture all digital lines. After that I want to analyze by loading it in Logic 2. Unfortunately I cannot load my preset to this capture. This is becoming a big problem as I have named the ports based on pins that I am capturing and now I just see Channel 0, Channel 1 …, Channel 15.

Am I missing something or is this feature not present? If this feature is not present could you please provide some support for this feature?

Thanks.

@gautam.nbhat This is unfortunately not possible at the moment… and I wished your idea could have worked as a workaround since naming channels using our Automation API is also not possible.

In the meantime, I’ve added a comment for you in the feature request post we are tracking for this below

We’ve been heads down on other projects lately, some of which I’m hoping we can share more details on soon. Because of this, we’ve had to hold off on working on some must-have features like this one.

For what its worth, I did a quick experimental hack – given that the *.sal file is really just a ZIP archive with a set of *.bin analog and/or digital files and a meta.json file describing everything stored.

If you want to rename the channels manually, you can just:

  • open the *.sal file in the Logic 2 software
  • manually rename the channels
  • save the changes back to a *.sal file

Likewise, you can also rename the channels by the following steps:

  • unzip the *.sal file
  • modify the label/strings in the meta.json file
  • zip the modified meta.json and *.bin files back into a *.sal file

This modified *.sal file should have the channel labels you desire.

Note: the meta.json includes a "version" key that indicates the revision of the *.sal JSON format. So, if you do actually try to hack this yourself, just realize that the *.sal format is subject to change and you may need to modify your ‘rename the channels’ script accordingly in the future.

Meanwhile, if you also have saved presets, you could export the presets and use the corresponding *.logic2Preset file – as it is also just a JSON file with similar contents as the meta.json file described above. So, hypothetically – a script could be written that reads a *.logic2Preset file and applies the channel labels to one (or more) *.sal saved capture file(s).

Note: if you are curious – the support documentation has some information on the .sal file format, which points to a saleae discussion post on the logic2 capture format. As the articles above point out, the Saleae file formats are not officially documented and subject to change in any given release of Logic 2 application. Thus, if you go down this path, I recommend you pay close attention to the "version" values to handle any future JSON format/schema changes.

Perhaps Saleae could upload the schema(s) for each JSON "version" of the *.sal and/or *.logic2Preset file format(s) to GitHub? Disclosing some level of internal details could allow 3rd party/open source solutions to be developed in lieu of having the internal development team bridging all of these feature/capability gaps. In fact, some python ‘helper functions’ could be added to the current Logic2 Automation GitHub that could do what was described here and cover both the near-term request and provide the JSON schemas for future/3rd party reference, too :wink:

Finally, a StackOverflow article about modifying a string within a file within a ZIP archive may help to streamline the above steps (depending on how Saleae tweaks the JSON format in the future).

With that article, it might be as simple as a quick str().replace() of "Channel 0""Channel 15" (or "Channel 7" … ?) strings based on your desired labels and using the python zipfile module. Note: each channel string/label appears twice: once for "type":"Digital" and once for "type":"Analog" … so it really depends on how smart your channel renaming script needs to be and which channels you’re actually capturing in the *.sal file.

@BitBob : Thanks a lot. Let me try this out.

FYI –

For anyone interested, see:

for my first attempt to solve this based on my reply above.

Note: I’m still quite new to python, so any feedback is quite welcome :slight_smile: