Author Topic: How to install custom Sigrok Pulseview protocol decoder?  (Read 346 times)

0 Members and 1 Guest are viewing this topic.

Offline AndySymonsTopic starter

  • Newbie
  • Posts: 5
  • Country: gb
How to install custom Sigrok Pulseview protocol decoder?
« on: September 22, 2024, 11:51:18 am »
I want to create my own protocol decoder (PD) for a proprietary protocol used by Scantronic 9651 alarm systems to communicate with keypads over a 200m bus.  It is part of a reverse-engineering project to discover and re-use that protocol: https://github.com/AndySymons/KELLY-Scantronic-9940-Keypad

As a first step, I just copied the I2C decoder and changed its name to 'SAKIP' (Scantronic Alarm Keypad Interface Protocol). The Sigrok documentation (https://sigrok.org/wiki/Protocol_decoder_HOWTO and https://sigrok.org/wiki/Protocol_decoder_API) tells me how to create the PD, but not how to link it to PulseView (on MacOS). Simply including the code inside the PulseView 'decoders' directory (inside the .app package), alongside all the other decoders, does not cause it to be recognised.

Can anyone tell me how to get SAKIP to show up in the list of available decoders in Pulseview??
 

Online voltsandjolts

  • Supporter
  • ****
  • Posts: 2429
  • Country: gb
Re: How to install custom Sigrok Pulseview protocol decoder?
« Reply #1 on: September 22, 2024, 12:23:00 pm »
No experience of custom decoders, but noticed here:
https://sigrok.org/wiki/Protocol_decoder_API#Decoder_registration
Quote
id
A short unique identifier for this protocol decoder. It should be all-lowercase, and only contains a-z, 0-9 and underscores. This must match the PD's Python module name (subdirectory name in the decoders directory). The sigrok-cli tool uses this to specify PDs on the command-line. Examples: 'jtag', 'sdcard_spi', 'uart'.
 

Offline AndySymonsTopic starter

  • Newbie
  • Posts: 5
  • Country: gb
Re: How to install custom Sigrok Pulseview protocol decoder?
« Reply #2 on: September 24, 2024, 05:45:27 pm »
Yeah 'registration' is not 'installation' and I do have the API spec (https://sigrok.org/wiki/Protocol_decoder_API).

By trial-and-error I found that on MacOS the procedure is
  • Find pulseview.app in your Applications folder
  • Right click and select 'show package contents'
  • Navigate to /Contents/share/libsigrokdecode/decoders/
  • Either create your own folder here or copy and existing one then change the name
  • Within that folder create or edit the copied files __init__.py and pd.py as described in the HowTo guide (https://sigrok.org/wiki/Protocol_decoder_HOWTO#Files). If you copied an existing protocol to use as a template, you need at least to change its name to a unique one (search for the old name and replace it, preserving the capitalisation).
  • (Re)start the Pulseview app
  • Now if you press press the decoders button, the resulting list should include your new decoder
     
I Have no idea how to install the PD in any other environment!
 
It is remiss of Sigrok not to include this information in the HOWTO guide.
 
 
 
The following users thanked this post: voltsandjolts

Offline bson

  • Supporter
  • ****
  • Posts: 2448
  • Country: us
Re: How to install custom Sigrok Pulseview protocol decoder?
« Reply #3 on: September 24, 2024, 10:53:53 pm »
On Linux (Fedora 40) the default installation (from dnf) is /usr/share/libsigrokdecode/decoders/

They can live there, or in ~/.local/share/libsigrokdecode/decoders.  I just verified the latter works by copying the i2c decoder there and renaming it foo2c. Shows up as expected:

« Last Edit: September 24, 2024, 10:56:31 pm by bson »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf