Giter Club home page Giter Club logo

Comments (9)

dreamsource-tai avatar dreamsource-tai commented on August 22, 2024

@maciekish
The difference between DSView and sigrok is that when calling self. wait(), it returns a tuple, while sigrok returns a list.

from dsview.

dreamsource-tai avatar dreamsource-tai commented on August 22, 2024

@maciekish
This decoder is a sub decoder, so it can use without edit. But it miss the "tag" attribute.
You can see the error message from log. You need append line as:

class Decoder(srd.Decoder):
api_version = 3
id = 'dcs_bios'
name = 'DCS-BIOS'
longname = 'DCS-BIOS Protocol'
desc = 'Decoder for the DCS-BIOS protocol over UART'
license = 'gplv2+'
inputs = ['uart']
outputs = []
tags = ['bios']

from dsview.

maciekish avatar maciekish commented on August 22, 2024

Where do i place the file to make DSView use it without editing the app on macOS?

from dsview.

dreamsource-tai avatar dreamsource-tai commented on August 22, 2024

@maciekish
On macOS, if you open DSView from the dmg file, you need to select the DSView icon, press the right button with the menu "Show Package Contents", find the "decoders" derectory, copy your new decoder files to here.

from dsview.

dreamsource-tai avatar dreamsource-tai commented on August 22, 2024

@maciekish
Maybe you need to copy the DSView app to other direcotry first.

from dsview.

maciekish avatar maciekish commented on August 22, 2024

Is it possible for you to consider reading additional decoders from another directory than the app? If users without macOS development knowledge modify the app, they just get a cryptic message saying the app is damaged and needs to be deleted. I know i can remove the signature and use the app anyway, but this is not a good solution. Perhaps you could use ~/Library/DSView/decoders or ~/.dsview/decoders or something like that in the macOS version?

from dsview.

maciekish avatar maciekish commented on August 22, 2024

@dreamsource-tai I have a second decoder that crashes DSView on launch, but works in PulseView. Any idea why please? It's not using self.wait()

import sigrokdecode as srd

class Decoder(srd.Decoder):
    api_version = 3
    id = 'dcsbios'
    name = 'DCS BIOS Protocol'
    longname = 'DCS BIOS protocol'
    desc = 'DCS BIOS protocol'
    license = 'gplv2+'
    tags = ['DCS']
    inputs = ['uart']
    outputs = []
    annotations = (
        ('sync', 'Sync bytes'),
        ('address', 'Address'),
        ('count', 'Count'),
        ('data', 'Data'),
    )
    annotation_rows = (
        ('fields', 'Fields', (0, 1, 2, 3)),
    )

    def __init__(self):
        self.reset()

    def reset(self):
        self.state = 0  # Initial state: Wait for sync
        self.sync_byte_count = 0
        self.address = 0
        self.count = 0
        self.data = 0

    def start(self):
        self.out_ann = self.register(srd.OUTPUT_ANN)

    def decode(self, ss, es, data):
        ptype, rxtx, pdata = data

        if ptype != 'DATA':
            return

        c = pdata[0]

        if c == 0x55:
            self.sync_byte_count += 1
        else:
            self.sync_byte_count = 0

        if self.sync_byte_count == 4:
            self.state = 1  # Transition to address_low state
            self.count = 0
            self.address = 0
            self.data = 0
            self.sync_byte_count = 0
            self.put(ss, es, self.out_ann, [0, ['SYNC']])
            return

        if self.state == 1:  # DCSBIOS_STATE_ADDRESS_LOW
            self.address = c
            self.state = 2
            self.put(ss, es, self.out_ann, [1, ['Address low: %02x' % c]])

        elif self.state == 2:  # DCSBIOS_STATE_ADDRESS_HIGH
            self.address = (c << 8) | self.address
            if self.address != 0x5555:
                self.state = 3  # Transition to count_low state
            else:
                self.state = 0  # Transition back to wait_for_sync state
            self.put(ss, es, self.out_ann, [1, ['Address high: %02x, Full address: %04x' % (c, self.address)]])

        elif self.state == 3:  # DCSBIOS_STATE_COUNT_LOW
            self.count = c
            self.state = 4
            self.put(ss, es, self.out_ann, [2, ['Count low: %02x' % c]])

        elif self.state == 4:  # DCSBIOS_STATE_COUNT_HIGH
            self.count = (c << 8) | self.count
            self.state = 5  # Transition to data_low state
            self.put(ss, es, self.out_ann, [2, ['Count high: %02x, Full count: %04x' % (c, self.count)]])

        elif self.state == 5:  # DCSBIOS_STATE_DATA_LOW
            self.data = c
            self.count -= 1
            self.state = 6
            self.put(ss, es, self.out_ann, [3, ['Data low: %02x' % c]])

        elif self.state == 6:  # DCSBIOS_STATE_DATA_HIGH
            self.data = (c << 8) | self.data
            self.count -= 1
            self.address += 2
            if self.count == 0:
                self.state = 1  # Transition back to address_low state
            else:
                self.state = 5  # Transition back to data_low state
            self.put(ss, es, self.out_ann, [3, ['Data high: %02x, Full data: %04x' % (c, self.data)]])

from dsview.

dreamsource-tai avatar dreamsource-tai commented on August 22, 2024

@maciekish
Another way is to compile the project yourself, so the program is not an app package and there will be no signature restrictions.
Decoder execution error, relevant information can be seen through logs. You can run the program on the terminal to view the logs, or you can use the log options to view the log content.
The upper layer protocol does not need to call self. wait(), and its data is obtained by passing parameters.

from dsview.

jeremyherbert avatar jeremyherbert commented on August 22, 2024

@dreamsource-tai I agree with @maciekish - having an extra directory that you can load decoders (in the home directory for example) from is probably the correct solution. If you edit the application itself, it can be hard to share decoders with other people, and also tricky to upgrade the software. You could also store your custom decoders in a git repository or something like that.

from dsview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.