Commit Graph

3465 Commits

Author SHA1 Message Date
Uwe Hermann 5360d6d706 mic-985xx: Fix blocking serial write timeout.
This fixes bug #433.
2015-09-13 23:47:16 +02:00
Uwe Hermann 896e1a45e0 manson-hcs-3xxx: Fix blocking serial write timeout.
This fixes bug #437.
2015-09-13 23:22:21 +02:00
Uwe Hermann 32c45845f7 tondaj-sl-814: Fix blocking serial write timeout.
This fixes bug #436.
2015-09-13 23:21:04 +02:00
Uwe Hermann 428d79a810 Drop obsolete SR_CONF_MEASURED_2ND_QUANTITY. 2015-09-13 21:43:17 +02:00
Daniel Elstner 000f504f24 classes.cpp: Define _XOPEN_SOURCE for isascii()
The GNU libstdc++ headers use isascii(), which is not part of any
POSIX standard. On BSD, this breaks the build. It is however part
of XOPEN, which on Linux is apparently enabled implicitly for C++.

This should fix #649.
2015-09-13 20:12:12 +02:00
Daniel Elstner 56c8705e37 Build: Move _POSIX_C_SOURCE definition to config.h
Do not redefine it though when already set, so that it can be
overridden by the user, or indirectly by the compiler settings.
2015-09-13 18:54:46 +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 Elstner 69f68553ae sigrok.m4: Remove SR_PROG_MAKE_NO_PRINT_DIRECTORY 2015-09-10 19:38:10 +02:00
Daniel Elstner bcc3694ff7 Build: Use GNUMAKEFLAGS for --no-print-directory 2015-09-10 19:35:17 +02:00
Daniel Elstner 96e05afa77 hung-chang-dso-2100: Enable only if libieee1284 is available 2015-09-10 18:36:30 +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
Uwe Hermann ba3070ff34 Makefile.am: Use @ORDER@ instead of |.
This is set to | (or left empty) by SR_PROG_MAKE_ORDER_ONLY for
portability reasons, since not all Make implementations support
order-only prerequisites.
2015-09-09 15:20:10 +02:00
Martin Ling fd31865ef4 Don't rebuild Python or Java bindings unless C++ interface changes. 2015-09-09 11:19:05 +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 4512ccd36c Build: Show compiler versions in summary 2015-09-08 04:57:59 +02:00
Daniel Elstner a6e8a8f766 sigrok.m4: Add SR_PROG_VERSION macro 2015-09-08 04:57:59 +02:00
Daniel Elstner c178386178 sigrok.m4: Suppress make variable for ORDER 2015-09-08 04:10:44 +02:00
Daniel Elstner 39cf2004dc Build: Fix restore of LIBS after temporary change 2015-09-08 04:02:04 +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
Daniel Elstner 2defc4116b sigrok.m4: Update serial 2015-09-07 23:57:03 +02:00
Daniel Elstner 3841c4c58d Build: Use SR_PROG_MAKE_NO_PRINT_DIRECTORY 2015-09-07 23:54:00 +02:00
Daniel Elstner 82b01e42f8 sigrok.m4: Add SR_PROG_MAKE_NO_PRINT_DIRECTORY macro 2015-09-07 23:54:00 +02:00
Daniel Elstner 6aa7fcf16a Build: Show compiler and flags in configure summary 2015-09-07 23:20:17 +02:00
Daniel Elstner 5b9e9bba74 Build: Use SR_PROG_MAKE_ORDER_ONLY
As of now, the resulting substitution @ORDER@ is unused.
2015-09-07 23:20:17 +02:00
Daniel Elstner c2b0f42989 sigrok.m4: Add SR_PROG_MAKE_ORDER_ONLY macro 2015-09-07 23:20:17 +02:00
Daniel Elstner 8c2024e021 Build: Implement libieee1284 check via SR_ARG_OPT_CHECK 2015-09-07 23:20:17 +02:00
Daniel Elstner 38662688e8 sigrok.m4: Add generic macro for optional dependencies
Provide SR_ARG_OPT_CHECK, a generalized variant of SRG_ARG_OPT_PKG
that can be used with custom check commands. Implement the latter
in terms of SR_ARG_OPT_CHECK.
2015-09-07 23:20:17 +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