The session and demo device code contain a hack to make the demo device work on
Windows. This was neccessary since polling on windows requires special handling
and we can not just pass in the raw fd to poll.
With the previous patches which added support for non-fd based event sources
this hack is no longer required. The patch moves the GIOChannels used by the
demo device to the demo device context and uses sr_session_source_add_channel
to register a source for the channels instead of using the raw pipe fds.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
All frontends will have to include <libsigrok/libsigrok.h> from now on.
This header includes proto.h and version.h, both installed from the
distribution into $INCLUDE/libsigrok/ as well.
The only dynamically changed header is now version.h, which has both
libsigrok and libtool compile-time versions in it.
Only one limit should be active at a time. Make sure that the sample limit is
disabled when a time limit is set and vice versa.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Start/stop acquisition callbacks: Consistently name the 'void *' parameter
cb_data for now. The per-device-instance device pointer is called
'session_dev_id' everywhere for now, but this should be renamed to
something more clear.
This will come back in some form or another later, but for now
don't clutter the API with non-working stuff. Removing stuff from APIs
is not possible without breaking the API, adding stuff later is simpler.
Use SR_API to mark public API symbols, and SR_PRIV for private symbols.
Variables and functions marked 'static' are private already and don't
need SR_PRIV. However, functions which are not static (because they need
to be used in other libsigrok-internal files) but are also not meant to
be part of the public libsigrok API, must use SR_PRIV.
This uses the 'visibility' feature of gcc (requires gcc >= 4.0).
Details: http://gcc.gnu.org/wiki/Visibility
In the lib, we should only #include "sigrok.h" or "sigrok-internal.h",
but not the (possibly installed and thus different/older versions) via
<sigrok.h> or <sigrok-internal.h>.
Frontends should of course use <sigrok.h> and <sigrok-internal.h>.
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.
When initialized, the driver starts a thread that generates signal data.
This data is written to a pipe (write file descriptor).
The other end of the pipe (read file descriptor), is connected to the
main polling code, like any other driver.
Note: This patch adds a new dependency on libgthread.
At the moment, you can list the driver's device:
$ ./cli/sigrok-cli -D
The following devices were found:
ID Device
0 Sigrok project Demo Driver v1.0 with 8 probes
And use it for random signal generation:
$ /opt/sigrok/bin/sigrok-cli -d 0 --samples 50 -f bits -p 1-8
sigrok 0.1pre2
Acquisition with 8/8 probes at 0 Hz
1:10111100 11010110 00001011 00011110 00111010 11110100 10
2:11010110 00111111 01001010 11111101 11010011 00010010 11
3:11000101 01000001 10100011 10100100 10110000 11110011 00
4:00100111 11110100 10011101 01100111 00100101 01001110 10
5:00011100 00101100 10111000 11001101 01011101 01011011 01
6:10110101 10111110 10010110 10111000 11011010 10000100 11
7:11111111 01001111 11110110 11010010 10000101 01001111 00
8:01000101 01111110 01010111 00000111 00010010 00000101 11
The next step is to make demo driver customisable (per-probe signal clock,
reference sample signals : serial, I2C, CAN...).
Thanks Olivier Fauchon <olivier@aixmarseille.com> for the patch.
Use libtool "noinst" local helper libs and use one Makefile.am per
subdir, which is the usual/preferred method. These helper libraries are
purely local and will not be installed.
This also fixes out-of-tree builds of sigrok, i.e. building in a
directory other than the sigrok source directory, e.g.
$ cd /home/user
$ git clone ...sigrok
$ cd sigrok
$ ./autogen.sh
$ mkdir /tmp/foo
$ cd /tmp/foo
$ /home/user/sigrok/configure
$ make
$ make install
This will place all build results (.o files, .la files, etc) in the
local build directory (/tmp/foo) instead of the source directory
(/home/user/sigrok in this example). The installation directory is
selected via the --prefix configure option (/usr/local per default).