Created attachment 227 [details]
When using demo to create 100 samples it becomes clear that the last state change doesn't create an annotation when it should (see screenshot). Not sure whether this is a PV or libsigrokdecode issue but it needs fixing either way.
I think this is a generic issue with the way decoders are written, there's a similar bug open for the parallel PD.
The PD needs to know the start/end samplenumbers to be able to emit annotations. For many PDs the end sample number of an annotation is an edge on some pin, so annotations usually go from edge X to edge X+1 or such.
The PD cannot know how long the stream from the LA/file will be (live), so it has to wait until edge X+1 appears in the data to be able to emit the last annotation (from edge X to edge X+1). In the example above there is no such edge though, the file/stream just ends and the PD doesn't know about that. As far as the PD is concerned another packet with more logic data could come in at any time.
So the "last annotation doesn't appear" issue is not easily fixable. The only way to do that would be to have some kind of "stream ends now" notification for srd/PV/PDs, but even then the PD would have to make an assumption of whether the sample *after* the last sample it has seen (high/low state of all pins), in order to be able to decide whether or not it has to emit a specific annotation still.
is this a duplicate of bug 292, which is specifically reported for 'parallel'?
*** This bug has been marked as a duplicate of bug 292 ***