output/csv: use intermediate time_t var, silence compiler warning There are platforms where timeval and time_t disagree on the width of the data type of the field which holds seconds. Passing a pointer to an unexpected type results in warnings (and probably unreliable execution). Assign the value which is gotten from a timeval to an intermediate time_t variable, so that the ctime() invocation becomes portable.
output/srzip: reduce text line length, remove "dead code" Move an instruction to reduce its text line length. Also happens to put the calculation of remaining buffer space and the current write position in closer proximity, improving maintainability in the process. Remove an assignment after appending to the archive and before iterating the input samples loop again. Eliminates code that never took effect. The value gets determined at the loop body's start anyway.
output/srzip: accept arbitrary input and output unit sizes Commit c03aaf342c3f introduced a check and refused to store sample data when the feed would not exactly match an expected width that was derived from the device's or input's total count of logic channels. Earlier versions assumed the match but never checked (immediately forwarded session feed content to the ZIP archive). Existing applications may not be prepared to process the resulting archive where meta data and samples disagree on essential properties. The fatal condition aborted execution, which was perceived as a regression. A message was added later to communicate that the condition was hit, but its WARN severity was misleading, and its meaning still was obscure to users. This commit extends the reception of sample data in the session feed and its accumulation in the local buffer before ZIP archive appends. Any combination of input and output unit sizes are accepted. It's perfectly legal for sources to not communicate data for disabled channels, as well as to communicate wider data images than strictly necessary to simplify their support for a variety of input formats or device models. Details are available to users at higher log levels (INFO). Default levels only communicate fatal conditions (which should be implementation flaws now exclusively). The issue reproduces especially well with input formats that are rather flexible, or device drivers which support a range of devices with many configurations or models of differing capabilities. The issue was most recently reported for the OLS driver and an Arduino SUMP firmware. Given how many input modules and device drivers can feed into a few output modules, it's assumed that addressing the general issue in a common location is preferrable over local adjustment of individual input modules or device drivers. Adjusting both places doesn't harm either, increases overall robustness. The implementation results in a negligable runtime overhead for the regular case of matching unit sizes (a few integer checks). And an acceptable overhead when the session feed is wider than the srzip archive's unit size (multiple memcpy() calls where previously was only one which would have been incorrect without the consistency check). The code path which needs to apply padding to the output is most expensive, but the implementation is only as expensive as it needs to be. The added cost only occurs in the case of mismatches, which were not handled at all before this change. The combination of extensive diagnostics and internal consistency checks shall increase robustness and help during future maintenance. Reported-By: Pavel Fedin <redacted>
output/srzip: rename variable for archive unit size The srzip output module needs to deal with two unit sizes. One that got derived from the device's or input's logic channels' total count, and will end up being used in the ZIP archive. And one which is seen when the session feed provides sample data. Rename the identifier to reflect this distinction. See a word diff for the essence of the change. Also rephrase the zip_append_queue() invocation for improved readability. Use line breaks to illustrate parameter sets which are related, and separate them from other parameters which are unrelated.
scpi-pps: Add support for SR_CONF_OVER_CURRENT_PROTECTION_DELAY Prepare the driver for the 'over-current protection delay' feature. For now, this feature is disabled for all currently supported devices. Signed-off-by: Marc Schink <redacted>
greatfet: feed the session with constant width sample data Rename identifiers to tell the sigrok session feed's width and the width of sample data in device firmware communication apart. Always feed the session with sample data of a width which corresponds to the device's channels count. Some output modules and applications may not be prepared to handle different cases.
strutil: support special case in power of two calculation The sr_next_power_of_two() helper routine rejected input value 0 (an index), considered this case invalid. It is not, requires 1 bit to hold the value. Return a "power of two" value of 1 for that input, callers expect that result.
hantek-dso: eliminate the "forced trigger" option value Commit c93f113879a0 introduced a hack on top of an unfortunate choice. It seems counter intuitive to open code a default trigger source on an arbitrary channel, and have users override it with the "forced" value to _not_ use a trigger. The normal approach would be to specify a trigger when a trigger should be used, and to not specify a trigger when no trigger should be used. Eliminate the "forced" choice in the trigger_sources[] list. Start with a not-set value. Accept when a value is specified (a "genuine" choice). Don't bother adding support to "un-set" the previously specified choice. This leaves the intuitive support for trigger specs that shall be used, and only uses triggers when they were specified. Does not provide means to "un-set" an earlier specified trigger config as the implementation did before the 2023-09 change, which would be the 2021-02 status. If the approach implemented here should be considered undesirable, then a "none" option value should be introduced, something that much better communicates to users what's happening and what the consequence of a config choice would be. This commit also adjusts the "ugh" code path which differed from the "capture empty" code path. Fixes a resource leak in the config set path. The "set trigger source" and "set trigger and samplerate" commands don't agree on the phrase for the trigger source in the wire format. But have been doing that before the forced trigger introduction, behaviour remains unchanged here.