Hello, It makes a difference whether your LA implements triggers in hardware that your driver needs to control or whether it simply provides raw data and libsigrok needs to emulate trigger functionality using what we call soft triggers.
API-wise, you need to list the values to whichever SR_CONF_TRIGGER_* config key is suitable for your needs (e.g. SR_CONF_TRIGGER_MATCH) so that only accepted trigger types can be chosen by the user. Then, before acquisition, you need to call sr_session_trigger_get(), which will give you an array of triggers, each containing at least one trigger stage. Each stage is fulfilled if all of its matches are fulfilled, see https://sigrok.org/gitweb/?p=libsigrok.git;a=blob;f=include/libsigrok/libsigrok.h;h=7dcea492f4450f0dadfa543e2b8346a7698581ca;hb=HEAD#l405 The handling of these triggers, stages and matches is what your driver would need to do internally unless you use soft triggers. Those do this for you internally - the demo device uses them, for example. Finally, when a trigger fires, you simply send out a SR_DF_TRIGGER packet to the session bus: https://sigrok.org/gitweb/?p=libsigrok.git;a=blob;f=src/input/trace32_ad.c;h=8ddb28848c49452921a37db81b06034c1a6e9a68;hb=HEAD#l583 The location of the trigger is determined by the samples you send out, so it makes a difference whether you send out the trigger first or the next batch of samples first. Hope that helps -Soeren On Tue, 2020-03-17 at 11:50 +0300, Inessa Kavalenka wrote: > Hi, > > I'm struggling to implement triggers for my LA, but I couldn't find a > way to understand how triggers work in sigrok, neither could I find > any specs. Where should I start? > > Kind regards. > > пт, 28 февр. 2020 г. в 15:17, Inessa Kavalenka < > ines.kavale...@gmail.com>: > > Thanks a lot! It worked! > > > > чт, 27 февр. 2020 г. в 23:04, Soeren Apel <soe...@apelpie.net>: > > > Exactly, see > > > > > > https://sigrok.org/gitweb/?p=libsigrok.git;a=blob;f=src/hardware/demo/api.c;h=3b77d40cdd36bf3f127c6bd90ef132f56204b050;hb=HEAD#l452 > > > > > > for an example of what Fabian is refering to. > > > > > > Regards > > > -Soeren > > > > > > > > > On Thu, 2020-02-27 at 19:12 +0100, Fabian Schwartau wrote: > > > > Hi, > > > > back then I wrote this: > > > > My device supports that, but I have to implement the config_* > > > > functions > > > > to let pulseview know that it can do it. > > > > > > > > If I remember correctly, there is some sort of script to > > > generate a > > > > default driver. That was ver helpful. > > > > > > > > Best regards, > > > > Fabian > > > > > > > > Am 27.02.20 um 18:52 schrieb Inessa Kavalenka: > > > > > Hi Fabian! > > > > > > > > > > My device *is *a logic analyzer. I wrote in > > > > > src/hardware/mydevice/api.c : > > > > > > > > > > static const uint32_t scanopts[] = { > > > > > SR_CONF_NUM_LOGIC_CHANNELS, > > > > > }; > > > > > > > > > > static const uint32_t drvopts[] = { > > > > > SR_CONF_LOGIC_ANALYZER, > > > > > }; > > > > > > > > > > How can I make PV recognize it? Maybe I need to declare the > > > LA > > > > > capabilities somewhere else too? > > > > > > > > > > > > > > > чт, 27 февр. 2020 г. в 20:47, Inessa Kavalenka < > > > > > ines.kavale...@gmail.com > > > > > <mailto:ines.kavale...@gmail.com>>: > > > > > > > > > > Hi Fabian! > > > > > > > > > > My device *is *a logic analyzer. I wrote in > > > > > src/hardware/mydevice/api.c : > > > > > > > > > > static const uint32_t scanopts[] = { > > > > > SR_CONF_NUM_LOGIC_CHANNELS, > > > > > }; > > > > > > > > > > static const uint32_t drvopts[] = { > > > > > SR_CONF_LOGIC_ANALYZER, > > > > > }; > > > > > > > > > > How can I make PV recognize it? Maybe I need to declare > > > the LA > > > > > capabilities somewhere else too? > > > > > > > > > > > > > > > чт, 27 февр. 2020 г. в 20:30, Fabian Schwartau < > > > > > fab...@opencode.eu > > > > > <mailto:fab...@opencode.eu>>: > > > > > > > > > > I asked exactly the same question a few weeks back. I > > > may > > > > > cite > > > > > Soeren: > > > > > > > > > > That's because PV only shows devices with a device > > > > > capability of a > > > > > logic analyzer or an oscilloscope as is the case with > > > e.g. > > > > > demo: > > > > > > > > > > > > > > > > > > https://sigrok.org/gitweb/?p=libsigrok.git;a=blob;f=src/hardware/demo/api.c;h=3b77d40cdd36bf3f127c6bd90ef132f56204b050;hb=HEAD#l56 > > > > > > > > > > I'm assuming this isn't the case for your device > > > driver. > > > > > > > > > > All the best, > > > > > -Soeren > > > > > > > > > > Am 27.02.20 um 17:33 schrieb Inessa Kavalenka: > > > > > > Hi everyone! > > > > > > > > > > > > I am trying to use sigrok with my own device. I > > > added > > > > > corresponding > > > > > > "api" and "protocol" code, and my device is > > > recognized > > > > > with > > > > > sigrok-cli > > > > > > (libsigrok$ sigrok-cli -d mydevice --scan -l 5). > > > But when > > > > > I run > > > > > > PulseView -> "connect to device", my device is not > > > listed > > > > > in > > > > > the driver > > > > > > combobox. I also noticed that *sigrok-cli -L* lists > > > a lot > > > > > of > > > > > drivers, > > > > > > but only a few of them are available from PulseView > > > GUI. > > > > > Why > > > > > is that? > > > > > > How do I add my driver to PulseView ? > > > > > > > > > > > > Thank you! > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > sigrok-devel mailing list > > > > > > sigrok-devel@lists.sourceforge.net > > > > > <mailto:sigrok-devel@lists.sourceforge.net> > > > > > > > > > https://lists.sourceforge.net/lists/listinfo/sigrok-devel > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > sigrok-devel mailing list > > > > > sigrok-devel@lists.sourceforge.net > > > > > <mailto:sigrok-devel@lists.sourceforge.net> > > > > > > > > https://lists.sourceforge.net/lists/listinfo/sigrok-devel > > > > > > > > > > > > > > > > > > > > -- > > > > > С уважением, > > > > > Инесса > > > > > > > > > > > > > > > > > > > > -- > > > > > С уважением, > > > > > Инесса > > > > > > > > > > > > > > > _______________________________________________ > > > > > sigrok-devel mailing list > > > > > sigrok-devel@lists.sourceforge.net > > > > > https://lists.sourceforge.net/lists/listinfo/sigrok-devel > > > > > > > > > > > > > > > > > _______________________________________________ > > > > sigrok-devel mailing list > > > > sigrok-devel@lists.sourceforge.net > > > > https://lists.sourceforge.net/lists/listinfo/sigrok-devel > > > > > > > > > > > > _______________________________________________ > > > sigrok-devel mailing list > > > sigrok-devel@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/sigrok-devel > > > > > > -- > > С уважением, > > Инесса > > _______________________________________________ sigrok-devel mailing list sigrok-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sigrok-devel