This is useful to allow frontends to react upon close failures in a
way they see fit (e.g. a popup in the GUI, or error message in the CLI).
They can also still ignore the error if they want, of course.
libsigrok can now be told at which loglevel to work, i.e., how many
debug/error/warning output to generate. You can also query the current
loglevel.
In sigrok-cli it is now possible to set the loglevel via -l. For example:
- Disable all output: sigrok-cli -l 0
- Only show errors: sigrok-cli -l 1
- Show errors, warnings, info, and debug messages: sigrok-cli -l 4
They're not too useful as they mostly consist of a list of function names,
and that list is already available in the respective struct. The wiki
API docs and the code in the various hardware/output drivers serve as
useful examples already, no need for additional files.
The g_malloc()/g_malloc0() versions exit/segfault if not enough memory
is available, which is not a good thing in libsigrok.
Instead, we use the g_try_malloc()/g_try_malloc0() variants, which
return NULL if not enough memory is available, so that the caller can
handle the error properly.
Only output new lines in gnuplot output if there have been changes in
the samples (similar to what VCD does). As long as the first and last
sample are output, the resulting plot looks OK.
This reduces the size of the output file from roughly 200MB to just 60KB
in one specific test setup (depends on the number of probes and on the
signal, of course). The time and CPU load required to generate the gnuplot
output and the resulting plot (PNG or other) is also drastically reduced
from multiple minutes to roughly 30 seconds (again, depends on various
things).
Thanks Ken Mobley of ChronoVu for the report.
We should use these (internal) functions in libsigrok exclusively from
now on, i.e. no more use of glib's g_debug() etc.
These functions are only for libsigrok, the frontends use whatever
logging mechanism is suitable there.
The struct entry 'extension' is not really a (filename) extension, but
rather a unique ID used for input or output formats, e.g. in the sigrok
CLI or GUI interface. Thus, rename it accordingly.
support for metadata in recent versions of the FPGA code
moved constants and structs out to separate header file
got rid of all device instance-specific globals
When no firmware file is found, return the right error code so sigrok
doesn't continue running with no firmware loaded.
Thanks Martin Stensgård <mastensg@ping.uio.no> for the patch!