Allow the acquisition to be constrained by time in addition to
a sample count limit. Since the LWLA protocol actually provides
only a duration natively, implement the sample count limit on top
of the new duration limit.
With this change, limiting an acquisition in external clock mode
should finally work properly.
This adds sine wave generation capabilities for the analog channels in the demo
driver. The frequency of the sine wave depends on the configured sample rate of
the demo device. The frequency of the sine wave is always 20 times smaller than
the sample rate, in other words we always have 20 samples per period.
CC libsigrok_hw_common_la-usb.lo
usb.c:241:18: warning: no previous prototype for 'usb_thread'
[-Wmissing-prototypes]
SR_PRIV gpointer usb_thread(gpointer data)
^
usb.c:256:13: warning: no previous prototype for 'usb_callback'
[-Wmissing-prototypes]
SR_PRIV int usb_callback(int fd, int revents, void *cb_data)
^
The sample rate on the Hameg scopes changes depending on the number of channels
turned on and on the current timebase.
Update the sample rate if any of the above change.
The current vertical division setting (per channel) and the timebase are stored
as a floating point number. This is suboptimal since clients expect us to send
this information to them in form of a rational number.
Store only the index of the current setting since all the supported settings are
already stored inside of an array.
The DF_END packet was send out after all configured frames were fetched, but
devices may stop the acquisition at any point in time and an DF_END will not be
send out in this case.
Send the DF_END packet inside of acquisition_stop() so this can't happen.
The device is after a scan left open and clients that don't call unconditionally
dev_open() will never fetch the initial device state.
Close the device after the scan so clients know they need to open it.
Most of the supported gear uses the ANSI C locale for communication, and if the
client sets up an incompatible locale parsing would fail.
This function ignores the client's locale and parses floating point numbers
using the ANSI C locale. This function should be always used when parsing
floating point numbers coming from the instrument.
With drivers that support multiple devices we need to know the device model
while listing options. That information is most of the time saved in the private
part of the dev_inst structure.
Pass the pointer to the dev_inst structure as an function argument so we have
access to this information.
parse_size_string() incorrectly parses a real number, e.g. 1.5 kHz ends up
being 1Hz.
This patch fixes parse_size_string() to take the fractional part as well into
account. The fractional part is parsed as an double precision floating point
number while ignoring the locale.
(lwla_setup_acquisition): Set the clock divider bypass
flag to 1 for the external clock modes as well.
(capture_setup): Set the clock divide count to 0 if an
external clock source is selected.
(lwla_send_bitstream): Unref the mapped file earlier in order
to simplify the error handling.
(lwla_receive_reply): Do not treat a reply buffer length of
zero as silent no-op. That logic was left over from an earlier
iteration, before the distinction between reply buffer size and
expected read length was introduced.
(lwla_set_clock_source): Checking whether an enum value is greater
than or equal to zero apparently results in a warning with some
compilers. Assign the enum to an unsigned variable to avoid this,
and return SR_ERR_BUG if the range is exceeded, as this indicates
a bug in the driver code itself.
The g_ascii_formatd() function expects the "format" argument to start
with a '%' character, e.g. it should be "%f" or such (this is not
clearly documented in the glib API docs, but visible from the source code).
The usage of "CH%f" for example will trigger an assertion and thus make the
LWLA device unusable in practice (e.g. in PulseView on Windows no probenames
would be shown, and sampling wouldn't work).
Example:
GLib-CRITICAL **: g_ascii_formatd: assertion 'format[0] == '%'' failed
(not exposed in all glib versions or builds of glib on all distros
apparently, some may need G_MESSAGES_DEBUG=all or other measures)
From the glib g_ascii_formatd() code:
g_return_val_if_fail (format[0] == '%', NULL);
We now use g_snprintf() instead for simplicity. This has been tested to
fix this specific issue (i.e. the probenames now do show up in PulseView).
This closes bug #270.