Commit Graph

701 Commits

Author SHA1 Message Date
Uwe Hermann 428d79a810 Drop obsolete SR_CONF_MEASURED_2ND_QUANTITY. 2015-09-13 21:43:17 +02:00
Daniel Elstner 6ec6c43b47 Build: Include <config.h> first in all source files
Since Autoconf places some important feature flags only into the
configuration header, it is necessary to include it globally to
guarantee a consistent build.
2015-09-13 18:54:46 +02:00
Daniel Elstner 4d6a50085e libsigrok-internal.h: Remove unused prototypes
The sr_source_* prototypes are not used anywhere, so remove them.
Also get rid of the SERIAL_PARITY_* aliases for SP_PARITY_*.
2015-09-13 18:24:15 +02:00
Daniel Elstner cbc1413f31 serial: Make serial device event sources more robust
Disallow polling for input/error and output-ready events at the
same time, and ensure only a single FD event source is installed.
Also, do not leak if the FD event source is removed by means
other than calling serial_source_remove().
2015-09-13 18:24:15 +02:00
Daniel Elstner 0c536bcd00 Fix two more format warnings uncovered by MinGW build 2015-09-13 15:39:04 +02:00
Daniel Elstner 7419638d4c Build: Force ISO-conforming format syntax on MinGW
On MinGW, two implementations of printf() are available: either
the Microsoft native one or a standard-conforming replacement from
gnulib. Since we build in C99 mode, headers such as <inttypes.h>
already select the standard-conforming variant. However, MinGW's
GCC does not seem to know about this and assumes MS-style format
syntax by default, which triggers a lot of wrong warnings.

Thus, on MinGW, explicitly decorate sr_log() with the gnu_printf
format flavor attribute. Also use GLib's printf replacements in
the logging implementation to make sure we link to a conforming
printf on any platform, independently of the compiler flags.

This gets rid of the mistaken -Wformat warnings for sr_log(), but
does not cover functions such as g_strdup_printf() which do not
explicitly specify the gnu_printf flavor in the format attribute.
This can be overcome by adding "-D__printf__=__gnu_printf__" to
CPPFLAGS, but it would be inappropriate for libsigrok to define
this on its own.
2015-09-13 15:11:27 +02:00
Daniel Elstner 22c50ed973 log: Bring back the "sr: " default log prefix
This got lost accidentally with the removal of the logdomain API.
2015-09-13 12:34:55 +02:00
Daniel Elstner 782b16447b log: Remove sr_log_logdomain_{get,set} from the API
The confusingly named sr_log_logdomain_set() simply set a global
string prefixed to the log message by the default log callback.
This is pretty much useless, misleadingly named, and not used by
either sigrok-cli or PulseView.
2015-09-13 12:08:54 +02:00
Daniel Elstner 6433156c32 Fix log varargs bugs indicated by -Wformat
A few of these were pretty serious, like missing arguments,
passing integers where a string was expected, and so on.
In some places, change the types used by the code rather than
just the format strings.
2015-09-13 02:29:38 +02:00
Daniel Elstner 6d9da8efbf log: Output timestamps at level SR_LOG_DBG too
SR_LOG_DBG and above are targeted at developers, so it makes sense
to extend timestamp output to that. Also sanitize the calculation
of the timestamp components a bit.
2015-09-13 00:58:36 +02:00
Daniel Elstner be92d5b4ee log: Use generalized sr_log() to implement logging helpers
Get rid of the specicialized sr_err(), sr_warn(), etc. functions.
Instead, define the logging helper macros in terms of sr_log(),
and remove the sr_log() helper macro so that no function is hidden
by a macro anymore.

Decorate sr_log() with G_GNUC_PRINTF to detect varargs errors. This
unearthed a gazillion warnings all over the place which will have
to be fixed.

Also convert the helper macros to ISO C99 __VA_ARGS__ style instead
of relying on a GNU C extension. Paste the log prefix directly into
the format string to make this work.
2015-09-12 23:46:16 +02:00
Daniel Elstner ab0b34584c session: Return immediately if there are no event sources
Some drivers, such as zeroplus-logic-cube, run everything they do
right away in dev_acquisition_start(), never installing any event
sources. Handle that evilness by returning from sr_session_run()
immediately if there are no sources.
2015-09-11 19:15:55 +02:00
Daniel Elstner c2bf5506ee session: Port to GLib main loop
Replace the custom session main loop with the GLib main loop.
This is phase one of the port, which leaves the session and
driver APIs unchanged while replacing the internals.
2015-09-10 22:46:20 +02:00
Daniel Elstner 041b579d53 serial: On Windows, include <windows.h> for HANDLE 2015-09-10 22:42:27 +02:00
Daniel Glöckner c940446918 hung-chang-dso-2100: Add driver
The Hung-Chang DSO-2100 is a parallel port PC oscilloscope sold back
in 1999 under brand names like Protek and Voltcraft.

This inital version of the driver has the following limitations:

 - Hardcoded calibration values. All parameters are set to 50%.
 - No support for auto triggering
 - No support for TV sync trigger modes
 - No support for the "scroll acquisition" mode

In scroll acquisition mode the device behaves more like a multimeter
and reports the current voltage of a probe on request. While in this
mode the sample rate is limited by the parallel port interface, it is
the only way to capture both channels at the same time (well, sort of).

Calibration would need auto triggering. The calibration values are very
temperature dependent and the device takes literally hours to reach its
final temperature. Every vdiv setting needs its own set of calibration
values. Without hardware modifications, the calibration settings wear
of in less than a second while waiting for a trigger because the
capacitors storing those values are not recharged in state 0x21.
2015-09-10 14:42:12 +02:00
Daniel Glöckner 05ac4a9828 hung-chang-dso-2100: Initial driver skeleton. 2015-09-10 14:42:12 +02:00
Uwe Hermann 7237e91262 portability: Use g_strerror() in favor of strerror(). 2015-09-09 15:20:10 +02:00
Uwe Hermann 34577da641 portability: Use g_ascii_strcasecmp() in favor of strcasecmp().
This is more portable and guaranteed locale-independent.
2015-09-09 15:20:10 +02:00
Soeren Apel 42f4619d6b Fix #550 by allowing an empty trigger match list
1e7659609b is related
to this change and required to fix #550 as well.
2015-09-08 19:09:54 +02:00
Bert Vermeulen 1e7659609b Don't free trigger when destroying the session.
The trigger must be freed by the client.
2015-09-08 15:44:47 +02:00
Daniel Elstner 1b8d3a6d09 session: Compile USB-specific code only if available 2015-09-08 00:08:16 +02:00
Daniel Elstner c1adbb1e23 Build: Add configure check for libusb event-abstraction
This is intended to make people notice when libusb is too old
for the new Windows code. However, this is not foolproof, since
the libusb version may be different at runtime.
2015-09-08 00:08:16 +02:00
Daniel Elstner 534b634ce2 USB: Handle live changes to the set of FDs to poll
Introduce new internal session API for changing the set of polled
file descriptors for an already installed event source. Use the
new API to apply changes to the USB poll FDs when requested to do
so by libusb. Doing so is necessary to make the generic USB code
work on Windows.
2015-09-08 00:08:16 +02:00
Daniel Elstner 1b0c6b6d15 USB: On Windows, assume G_IO_IN for the event mask 2015-09-08 00:08:16 +02:00
Daniel Elstner 3a1a6d6b04 session: More main loop debug output 2015-09-08 00:08:16 +02:00
Daniel Elstner 4b9e253213 USB: Remove Windows-specific event handling code
For the generic code to work on Windows, a version of libusb
with the experimental event-abstraction changes is required.
2015-09-08 00:04:22 +02:00
Martin Lederhilger aff94d065e scpi: Fix incorrect serial_read_nonblocking call().
There was a problem in scpi_serial.c in the scpi_serial_read_data()
function. Incoming data was written at the read position in the buffer,
although it should be written at the count position in the buffer.
2015-09-07 22:49:58 +02:00
Daniel Elstner dd7a4a71ca drivers: Match dummy FD passed to source add/remove 2015-09-07 14:33:30 +02:00
Daniel Elstner 5a7d8dac90 USB: Handle the case of a callback removing its event source 2015-09-05 04:21:26 +02:00
Daniel Elstner 358c4ed5b8 USB: On Windows, block to wait for libusb events
This is another attempt at getting the mess that is libusb event
handling on Windows under control. Until libusb makes its HANDLEs
available for polling, we have no choice but to block while waiting
for libusb events. Since we do not want to force drivers to deal
with multi-threading issues, that means we have to block in the
session main loop.

Fortunately, it turns out that our drivers aren't using multiple
event sources, so it is actually possible to block the main loop
without disrupting too much. This also gets rid of the USB thread
on Windows. Thankfully, libusb does not seem to care that we are
now calling libusb_handle_events_timeout_completed() twice per
iteration: first a blocking call (with timeout) in the callback
wrapper, followed by the non-blocking call in the driver-supplied
callback.
2015-09-04 19:04:23 +02:00
Daniel Elstner 92248e7821 session: Allow multiple poll FDs per event source
Turns out that having one event source per libusb poll FD is
a bad idea. There is only a single callback for all poll FDs,
and libusb expects to be called only once per poll iteration,
no matter how many FDs triggered.

Also, they should all share the same timeout, which should get
reset on events from any polled FD. The new timeout handling made
this problem apparent, as it caused the callback to be invoked
multiple times on timeouts, once for each separate event source.

In order to fix this, change the implementation to allow for an
arbitrary number of poll FDs per event source. This number is
zero for timer FDs, one for normal I/O sources, and one or more
for libusb sources (Unix only).

Also, on Windows, do not get an additional timeout from libusb
in the event loop. This is only appropriate when polling the
libusb FDs directly, which we aren't doing on Windows.
2015-09-03 19:37:09 +02:00
Daniel Elstner 7637fa35b5 session: More poll spewing 2015-09-03 19:37:09 +02:00
Daniel Elstner 15408b51f3 log: Output time stamps at log level spew 2015-09-03 19:37:09 +02:00
Daniel Elstner c650d3ecbf drivers: Use timer sources instead of polling stdin 2015-09-03 19:37:09 +02:00
Daniel Elstner 027bf07796 demo: Use simple timer source instead of pipe
Get rid of the Unix pipe and the GIOChannel wrapping it. Instead,
install a simple timer event source with the appropriate timeout.
2015-09-03 19:37:09 +02:00
Daniel Elstner b5887bd0c3 session: Add poll debug spew 2015-09-03 19:37:09 +02:00
Daniel Elstner faa5d7d997 session: Unify handling of I/O and timer sources
Handle I/O sources and timer ("dummy") sources within the same
polling loop, so that both may be used together. Slightly change
the API to improve consistency: a timeout value of -1 now disables
the timeout, and 0 makes the source always time out immediately.
The "dummy" sources already behaved that way, although it wasn't
documented as such.

Make sure that I/O events are processed preferentially: Skip any
timeout callbacks if an I/O event occurred within the same poll
iteration. This applies to both timer/idle sources and timeouts
of I/O sources.

Do not create dummy GPollFDs for timer/idle sources. Instead,
split the sources array into an I/O section and a timer section,
and create corresponding GPollFDs only for the I/O section. Use
GArray to simplify the handling of the dynamic arrays.
2015-09-03 19:37:09 +02:00
Daniel Elstner 62d7945f80 session: Properly accumulate event source timeouts
Keep track of when source timeouts are due and properly compare
against accumulated elapsed time between invocations. This prevents
sources with short timeouts from blocking other sources with longer
timeouts indefinitely.
2015-09-03 19:37:09 +02:00
Daniel Elstner 4399cc0f41 session: Do not expect meaningful errno on non-UNIX
Looking at the g_poll() implementations for various systems, it
appears that on Windows the return value is 0 if the wait was
interrupted, and errno is never set. Also, the MacOS X wrapper
around select() does not clear revents on timeout.

To deal with these issues, check for EINTR only on Unices, and
assume revents to be invalid unless g_poll() returned a positive
value.
2015-09-03 19:37:09 +02:00
Daniel Elstner 32af282c5e session: Check for errors from g_poll()
If the call to g_poll() in sr_session_iteration() fails, report
the error back to the caller. Do not treat EINTR as error though.

Check for session abort only if a source callback was actually
invoked, or at least once if none of the callbacks are invoked.
Stop checking for abort if the session has already been stopped,
just in case a callback sets abort_session again.

Also change the documentation to match the actual behavior.
2015-09-03 19:37:09 +02:00
Daniel Elstner 89efe06460 session: Fix USB timeout handling
In sr_session_iteration(), remove the inverted evaluation of the
block parameter if a USB source is present. This stops the deluge
of USB event callbacks due to the timeout always being zero.

Also, just for cleanliness, initialize the revents member of each
GPollFD instance to zero.
2015-09-03 19:37:09 +02:00
Bert Vermeulen b05409d792 Remove SR_OK_CONTINUE.
This brings error reporting back to the usual: either return codes
are SR_OK (0) or they are < 1 indicating an error.

This fixes bug #633.
2015-08-31 16:23:10 +02:00
Bert Vermeulen b93006789f output/csv: Avoid using SR_OK_CONTINUE. 2015-08-30 21:13:51 +02:00
Bert Vermeulen 2d05415f2e scpi: Avoid using SR_OK_CONTINUE. 2015-08-30 20:42:54 +02:00
Bert Vermeulen 2634b77812 serial: Check event ptr before using.
This avoids a NULL dereference when called twice.
2015-08-30 20:42:54 +02:00
Bert Vermeulen 661cc2ec46 Convert SR_CONF_MEASURED_QUANTITY to SR_T_MQ. 2015-08-30 20:40:56 +02:00
Bert Vermeulen 83478149b1 deree-de5000: Drop SR_CONF_MEASURED_QUANTITY functionality.
This was superfluous -- there is no need to be able to query the
last MQ(s) sent by the device, since they're already being sent
along with the measurements in analog packets.

Since there is also no way to change the MQ (that is done with the
buttons on the device), there is no need to even list the possible
MQs.
2015-08-30 20:40:56 +02:00
Bert Vermeulen 75772c721d Change SR_T_MQLIST to SR_T_MQ.
The need to make this a list no longer applies.

SR_T_MQ is thus a type consisting of a tuple with two elements: the first
item is the MQ (type G_VARIANT_TYPE_UINT32), and the second is the MQ
flags value (G_VARIANT_TYPE_UINT64).
2015-08-30 20:40:56 +02:00
Daniel Glöckner 4ec436c4d5 sr_session_send: pass transformed packet to datafeed callbacks
After the packet has been passed through the transformation modules,
the transformed data is in packet_in but the following code uses
the packet variable which still points to the original input.

This fixes bug #631.
2015-08-30 18:54:13 +02:00
Daniel Glöckner 1e6b5b9303 hantek-dso: fix memory leak
This fixes bug #632.
2015-08-30 18:53:21 +02:00
Daniel Glöckner 96127d0fea lascar-el-usb: fix memory leak
This fixes bug #630.
2015-08-30 18:51:18 +02:00
Daniel Glöckner 80e20c10e3 es51919: fix memory leak
This fixes bug #629.
2015-08-30 18:48:50 +02:00
Uwe Hermann d40b8557a9 Don't set _POSIX_C_SOURCE for VXI/RPC related files.
Make vxi.h the first #include in all affected files and #undef the
_POSIX_C_SOURCE macro in vxi.h.

This avoids various build issues on e.g. FreeBSD or Mac OS X where
setting _POSIX_C_SOURCE leads to the unavailability of certain types
such as u_long (as used in the VXI/RPC code).
2015-08-29 17:15:26 +02:00
Uwe Hermann ca7dbb5616 Various key lists: Add reminders of what needs updates upon changes. 2015-08-28 16:32:14 +02:00
Uwe Hermann 55c9f09dbc session.c: Fix key order. 2015-08-28 16:29:07 +02:00
Uwe Hermann f7bcc68604 analog.c: Fix key order, add missing items. 2015-08-28 16:29:07 +02:00
Uwe Hermann c984f2f997 output/analog: Fix key order, add missing items. 2015-08-28 16:29:07 +02:00
Uwe Hermann 29ae6f0880 hwdriver.c: Fix key order, add missing items. 2015-08-28 16:29:07 +02:00
Uwe Hermann 607dcdeae1 kern-scale: Add initial driver contents.
This currently supports (and is tested on) the KERN EW 6200-2NM,
other models will be added later.
2015-08-28 11:59:31 +02:00
Uwe Hermann 9380ec2f05 kern-scale: Initial driver skeleton. 2015-08-28 11:43:04 +02:00
Uwe Hermann e5d953b559 Add a protocol parser for KERN scales.
(KERN & SOHN GmbH, http://www.kern-sohn.com/)
2015-08-28 11:43:04 +02:00
Uwe Hermann 34eaf4bcbb output/analog: Support mass related units / MQ flags. 2015-08-28 11:43:04 +02:00
Bert Vermeulen a1f7c854c5 Add SR_T_MQLIST.
This type consists of an array, with each item a two-member tuple,
representing an MQ/MQflags pair: the first item is the MQ (type
G_VARIANT_TYPE_UINT32), and the second is the MQ flags value
(G_VARIANT_TYPE_UINT64).

A GVariant of type SR_T_MQLIST can thus always represent more than
one MQ/MQflag pair.
2015-08-26 01:54:34 +02:00
Bert Vermeulen 0176c92fea Add key info tables for MQ and MQflags. 2015-08-26 01:54:34 +02:00
Bert Vermeulen 2fb60e2329 Replace sr_config_info with sr_key_info.
The tables defined with this struct can now be used for information
on items other than config keys.

Functions to access these tables have been renamed sr_key_info_[name_]get.
These take an extra argument, keytype, which should be set to SR_KEY_CONFIG
to get the config key tables. Other key types will be added.
2015-08-26 01:08:42 +02:00
Bert Vermeulen 0b2b92f6c3 scpi/usbtmc: Use sr_usb_close(). 2015-08-25 19:13:17 +02:00
Bert Vermeulen 67e95ed37d Add sr_usb_close(). 2015-08-25 19:13:17 +02:00
Bert Vermeulen 558d438d1f scpi: Strip leading/trailing spaces from *IDN? response. 2015-08-25 19:13:17 +02:00
Bert Vermeulen c0d257790a scpi: Propagate error codes in API functions.
This allows client drivers to detect e.g. timeout conditions.
2015-08-25 19:13:17 +02:00
Bert Vermeulen 9c24d16a1d Make sr_next_enabled_channel() from scpi-pps available library-wide. 2015-08-25 19:13:17 +02:00
Bert Vermeulen 91ef511db2 scpi: Make helper functions from scpi-pps available library-wide. 2015-08-25 19:13:17 +02:00
Bert Vermeulen 5a1afc0907 scpi: Move SCPI-related definitions to separate header file. 2015-08-25 19:13:16 +02:00
Uwe Hermann 731c01f248 FreeBSD: Fix compile/link error due to missing libusb_get_version().
The FreeBSD libusb-1.0 API implementation doesn't have libusb_get_version().
Use our CONF_LIBUSB_1_0_VERSION macro instead.
2015-08-18 18:27:55 +02:00
Daniel Elstner 2cbde15198 Build: Properly namespace the version defines
Use the CONF_ prefix for the configured host define as well as
the various build-time version macros.
2015-08-16 18:53:32 +02:00
Daniel Elstner b9eb8e1a8c Consistently use SR_PACKAGE_VERSION instead of VERSION 2015-08-16 18:28:13 +02:00
Daniel Elstner c1aae90038 Build: Set local include directories in Makefile.am
Move the include flags for files in the source tree from
configure.ac to Makefile.am where they belong.  Also use
AM_CPPFLAGS instead of CFLAGS/CXXFLAGS to make sure the
files in the build/source tree are always picked up first.

Also, remove the include/libsigrok sub-directory from the
search path, thereby making the <libsigrok/> prefix mandatory
when building libsigrok itself.  This matches the convention
already imposed on users of the library.
2015-08-16 18:28:12 +02:00
Soeren Apel 3cd4b38174 Introduce OutputFlag 2015-08-15 23:53:12 +02:00
Soeren Apel 7df31ae897 output/srzip: Prevent memory leak in case filename is empty 2015-08-15 23:53:12 +02:00
Uwe Hermann bd7b83cf63 backend: Output lib versions, host, and endianness in sr_init().
This should help to more easily debug issues reported by users.
2015-08-15 21:06:30 +02:00
Aurelien Jacobs 6d930b4159 brymen-bm86x: add some error checking 2015-08-15 17:23:28 +02:00
Uwe Hermann c442ffda0f Various minor cosmetics and consistency fixes. 2015-08-15 17:19:57 +02:00
Uwe Hermann ad0293f19c Drop comment mentioning non-existing function. 2015-08-15 17:19:42 +02:00
Uwe Hermann dff0a89435 Doxygen consistency fixes (@foo instead of \foo). 2015-08-15 17:19:42 +02:00
Uwe Hermann 8d5228015d Various errno/strerror() related fixes.
- Don't #include <errno.h> in files that don't actually need it.

 - Don't use strerror() on error codes from functions that don't set
   errno. Replace strerror() with sr_strerror() for libsigrok functions.
2015-08-15 17:19:42 +02:00
Hubert CHAUMETTE 6c7d80afca libsigrok: demo: close pipes on dev_acquisition_stop()
Fixes a bug where new acquisition failes due to leftover pipes from
previous acquisitions:
	sr: demo: dev_acquisition_start: pipe() failed
Indeed, PulseView had 2024 pipes opened. With this fix, it stabilizes at
33 with sampling thread active.

Signed-off-by: Hubert CHAUMETTE <hchaumette@baylibre.com>
2015-08-01 00:02:56 +02:00
Soeren Apel 37875f7506 output/srzip: Use sr_output->filename instead of option
This fixes parts of bug #570.
2015-07-30 19:22:07 +02:00
Soeren Apel 81b3ce374c Add filename field to sr_output and make it accessible
This fixes parts of bug #570.
2015-07-30 19:21:42 +02:00
Uwe Hermann a394bd2813 ols: Don't #include <libserialport.h> directly.
The driver is not using sp_* calls directly, so no need to #include
the header file.
2015-07-25 16:59:04 +02:00
Uwe Hermann 338143ea03 Convert a few more occurrences of d->priv to d->context. 2015-07-10 18:19:24 +02:00
Soeren Apel 41812aca43 Fix #442 by renaming sr_dev_driver.priv to .context 2015-07-10 01:22:15 +02:00
Uwe Hermann c11a1e6122 fx2lafw: Use the USB_INTERFACE #define. 2015-07-10 01:22:15 +02:00
Uwe Hermann dc2903bbdb fx2lafw: Fix segfault wrt libusb_detach_kernel_driver().
Move the libusb_detach_kernel_driver() call after the code that
sets the usb->devhdl pointer, otherwise it'll be NULL and result
in a segfault.

  #0  libusb_kernel_driver_active (dev=0x0, interface_number=0) at libusb/core.c:1711
  #1  dev_open (sdi=0x12d99f0) at src/hardware/fx2lafw/api.c:374
  [...]

Tested on a device with the default Cypress VID/PID and one with
the Saleae Logic VID/PID, both works fine.
2015-07-10 01:05:54 +02:00
Soeren Apel 39e4517759 fx2lafw: Fix #445 by detaching the kernel driver (if any)
This avoids the need to run "rmmod usbtest" on Linux for devices
with the standard Cypress FX2 USB VID/PID (04b4:8613).
2015-07-10 01:03:54 +02:00
Daniel King 536141ff49 Demo: Fix #314 by always honoring sample limit changes 2015-07-09 20:22:51 +02:00
Soeren Apel e2b99f04d8 Fix #505 by providing a separate property list for the analog group 2015-07-09 20:22:51 +02:00
Soeren Apel 815e3cb83e Fix #574 by setting up the transfer first, then starting acquisition 2015-07-06 12:16:10 +02:00
Bartosz Golaszewski d586a7f4bd baylibre-acme: Remove unnecessary close().
The timerfd descriptor is closed automatically by
g_io_channel_shutdown(). No need to close it manually.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-07-01 12:30:09 +02:00
Bartosz Golaszewski 7a1a3a36a9 baylibre-acme: Use SR_HZ_TO_NS() when configuring the timerfd.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-07-01 10:47:38 +02:00
Bartosz Golaszewski 7e5a048ff2 baylibre-acme: Add a workaround for slow data acquisition.
At high sampling rates and maximum channels we are not able to acquire
samples fast enough, even though frontends still think that samples
arrive on time. This causes visible shifts in frontend plots.

To compensate for the delay introduce the following workaround: check
if we are late (if any clock events have been missed) and resend the
last frame n times (n == number of missed clock events).

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-07-01 00:03:58 +02:00
Daniel Lezcano a0648b1a12 baylibre-acme: Use timerfd instead of a fake pipe.
Currently baylibre-acme uses a fake pipe as the input channel required by
libsigrok API and calls sleep() in the data acquisition callback to create
intervals between measurements.

Switch to a more elegant approach: use Linux' timerfd and set a periodic
timer equal to the sampling rate. Then read the data every time the timer
expires.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-07-01 00:00:33 +02:00