Bug 1215

Summary: Properly handle session structure when using reset() on file devices
Product: PulseView Reporter: Soeren Apel <soeren>
Component: File handlingAssignee: Nobody <nobody>
Status: CONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unreleased development snapshot   
Target Milestone: PulseView 0.6.0   
Hardware: All   
OS: All   

Description Soeren Apel 2018-06-03 10:32:16 CEST
We want PV to support a common use case: user gathers data using an external tool, exports its data to a file, imports that file in PV, updates the file and wants to click "Run" to update the file's data in PV.

In order to support this, reset() was introduced in libsigrok's input modules. It resets the input module's internal state so that file data can be fed to it again. However, one limitation is that the libsigrok channels must only be created once (in init()) because PV doesn't remove the sigrok channels from the session when using this mechanism.
The reason for this is that removing the channels would remove everything that the user set up: channel naming, channel display settings, channel conversions, channel assignments to PDs.

With input modules where the number of channels is determined by the file's contents however, this is a big problem. What if the number of channels changes? Or the order in which they appear? Currently, this would lead to wrong data or crashes (#1167).

Ideally, PV would be able to clear the libsigrok channels while keeping the corresponding signal instances around. When the channels are re-created, they need to be reconnected (e.g. using the internal names), deleted (when a channel no longer exists) or created (when a channel didn't exist before).

This bug report can be closed when this is implemented and a new libsigrok bug should be opened then that removes reset(). Also, a new bug for PV should then be opened to replace reset() by calls to cleanup() and init(). That way, this entire mechanism is invisible to the input modules.