Commit Graph

68 Commits

Author SHA1 Message Date
Uwe Hermann 6bf4273ee8 Fix two FreeBSD build issues related to libusb-1.0.
FreeBSD's libusb-1.0 compatible library has a few differences compared
to the "normal" libusb-1.0 from libusb.org which we have to work around.

LIBUSB_CLASS_APPLICATION doesn't exist in FreeBSD's libusb, and
libusb_handle_events_timeout_completed() doesn't exist either.
The latter is basically libusb_handle_events_timeout() with an extra
(unused by us) parameter, so the workaround is relatively simple.

This fixes bug #185.
2013-10-28 22:59:32 +01:00
Uwe Hermann c02dc3e261 metex14: Add support for pF (picofarad).
This is used on some Metex DMMs.
2013-10-23 18:41:13 +02:00
Aurelien Jacobs bfb926c1d2 es519xx: restore correct packet size 2013-10-21 00:35:23 +02:00
Uwe Hermann 93d719cde6 es519xx: Fix incorrect packet size, and a typo. 2013-10-07 00:36:18 +02:00
Uwe Hermann 72e1672fc9 es519xx: Cosmetics, coding style, minor fixes. 2013-10-07 00:36:18 +02:00
Aurelien Jacobs c01bdebc57 add cyrustek es519xx generic protocol parser 2013-10-07 00:36:18 +02:00
Bert Vermeulen f438e0c923 Add sr_session_append(): add captured data to an existing session file
This extends the session file format to contain logic data files named
either "logic-1" as before, or "logic-1-1", "logic-1-2", ...
representing chronologically ordered chunks of captured data.

The chunks are transparently concatenated together by sr_session_load().
2013-09-18 13:28:07 +02:00
Uwe Hermann e52bb9be83 Voltcraft VC-830: Fix diode mode handling.
This DMM is not using the standard bits in the FS9922 protocol/structure
to indicate the "volt" and "diode mode" flags. Instead, it only sets the
user-defined bit "z1" to indicate both "diode mode" and "volt".

This fixes #142.
2013-09-01 15:27:21 +02:00
Uwe Hermann 1861be0baf Make sr_session_iteration() static.
This function is not used outside of session.c at the moment, so make
it static for now.
2013-08-07 16:21:57 +02:00
Bert Vermeulen f6eb2cb555 Make sr_session_iteration() private 2013-07-18 15:06:37 +02:00
Uwe Hermann f6beaac55c std: Drop hw_ from function names.
The per-driver API calls no longer have a hw_ prefix (e.g. hw_init()
became init() and so on), so drop the 'hw_' from the std versions
for those API callbacks too.
2013-06-02 16:46:18 +02:00
Uwe Hermann 6078d2c996 Use consistent API callback function names.
This now matches what the 'new-driver' tool generates.
2013-05-10 20:01:37 +02:00
Uwe Hermann 2451a20ff5 fs9721: Factor out common code from serial-dmm.
These functions are FS9721 specific (and DMM specific), and can be used
from various drivers (e.g. serial-dmm or uni-t-dmm or possibly others).
2013-05-01 02:16:55 +02:00
Uwe Hermann 4853559466 uni-t-dmm/serial-dmm: Handle Voltcraft VC-840 temperature. 2013-05-01 01:58:42 +02:00
Uwe Hermann 7381251e33 common/dmm: Drop obsolete *is_packet_start() functions. 2013-04-26 20:05:44 +02:00
Uwe Hermann 913abe8321 fs9922: Use common DMM API.
Use the same functions and structs as the other DMM protocol parsers
in hardware/common/dmm. Among other things, this allows the functions
to be used from drivers in a generic way, e.g. in serial-dmm, uni-t-dmm,
and possibly other drivers.
2013-04-26 20:05:44 +02:00
Uwe Hermann 50985c2019 GPL headers: Use correct project name. 2013-04-23 22:24:30 +02:00
Uwe Hermann 522a34343f Drop obsolete g_match_info_unref() workaround.
We hard-depend on glib >= 2.32.0 now anyway, so this is no longer needed.
2013-04-20 13:43:48 +02:00
Bert Vermeulen ae5859fff0 Allow for sdi->priv helper function in std_dev_clear 2013-04-17 00:49:41 +02:00
Bert Vermeulen 49f00e13f7 Add driver helper std_dev_clear() 2013-04-16 17:57:08 +02:00
Alexandru Gagniuc 33c6e4c5a4 session: Make sr_session_stop thread-safe
With the sigrok session running in a worker thread, if sr_session_stop is called
from another thread, it shuts down the pollfds used by the hardware drivers,
without ensuring that the sigrok event loop is no longer using those pollfds.

On the demo driver, this involves shutting down the GIOChannels, causing a
segfault when the sigrok event loop tries to use them. This is evident when
using the Stop button in PulseView, while the session is running.

This isn't a problem with just the demo driver; any driver's resources may be
freed by sr_session_stop concurrently with the sigrok session running.

To solve this problem, we don't touch the session itself in sr_session_stop().
Instead, we mark it for decommissioning and return. The session polls this flag,
and shuts itself down when requested.

This fixes bug 4.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-04-14 23:39:15 +02:00
Bert Vermeulen 722db131a4 Add sr_config_free()
Due to struct sr_config now containing a GVariant, this needs to be
cleaned up after use properly. This is a helper function for that.
2013-04-11 18:32:06 +02:00
Bert Vermeulen bc1c2f001a Use GVariant for sr_config_*() functions
sr_config_get() provides a GVariant owned by the caller, so it must be
released with g_variant_unref() when done.

sr_config_set() takes a GVariant from the caller which may be floating;
it will be properly sunk and release after use by this function. Thus
the output of g_variant_new_*() may be used as an argument.

sr_config_list() also provides a GVariant owned by the caller, to be
unreferenced when done.

sr_config_make() can take a floating reference.
2013-04-11 18:32:06 +02:00
Bert Vermeulen 13d8e03c4f Bump copyright year 2013-04-11 18:32:06 +02:00
Uwe Hermann 3ebce226a2 s/sr_config_make/sr_config_new/.
This matches the naming of other/similar functions better.
2013-03-23 14:16:00 +01:00
Uwe Hermann cd2f0fe22c Add/use std_hw_dev_acquisition_stop_serial(). 2013-02-08 23:32:45 +01:00
Uwe Hermann 4afdfd4628 Add and use std_session_send_df_header().
This is a small helper function which sends the SR_DF_HEADER packet that
drivers usually emit in their hw_dev_acquisition_start() API callback.
It simplifies and shortens the hw_dev_acquisition_start() functions
quite a bit.

It also simplifies the input modules which send an SR_DF_HEADER packet, too.

This patch also automatically removes some unneeded malloc/free in some
drivers for the 'packet' and 'header' structs used for SR_DF_HEADER.
2013-02-07 10:46:28 +01:00
Uwe Hermann bf6f8399fc Make 'struct rs9lcd_info' non-empty.
Empty structs can be an issue (compiler-dependent), so add a dummy entry
for this one.
2013-02-02 12:14:26 +01:00
Uwe Hermann 063e7aef6d Factor out common hw_init() driver code.
Most drivers do pretty much the same things in their hw_init()
right now, so factor out that code to std_hw_init() in std.c.
2013-01-29 12:56:02 +01:00
Bert Vermeulen 4c0e310ca3 Add small helper for creating struct sr_config 2013-01-21 23:32:49 +01:00
Bert Vermeulen 5635705c83 cleanup of obsolete definition 2013-01-13 18:07:05 +01:00
Uwe Hermann fe0c0b98c6 Add Cyrustek ES51922 DMM chip parser. 2013-01-03 01:13:06 +01:00
Bert Vermeulen 9116262931 add USBTMC device search helper 2012-12-30 01:44:58 +01:00
Joel Holdsworth bf53457d1d Pass sr_datafeed_packets and payloads with const pointers
This patch marks packet structures and their payloads as const.
This indicates to packet receivers that modifications to these are
not allowed. In general all pointers should be marked const unless
modification of the referenced data is explicitly allowed.
2012-12-20 07:51:21 +00:00
Alexandru Gagniuc e7ed87a469 serial-dmm: Use dummy info struct for rs9lcd parser
The rs9lcd parser, which is used for the RadioShack 22-812 does not use its
*info parameter, and therefore did not have a rs9lcd_info struct declared.

With recent re-factoring of the receive data callbacks, it became necessary to
pass a struct pointer. This made the RECV_DATA macro look like:

- RECV_DATA(RADIOSHACK_22_812, metex14)

giving the wrong impression that the RadioShack 22-182 uses the
metex14 protocol, which is not the case.

Create a dummy rs9lcd_info struct, and correctly identify the parser
as rs9lcd in the RECV_DATA macro:

+ RECV_DATA(RADIOSHACK_22_812, rs9lcd)

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-13 23:16:34 +01:00
Bert Vermeulen 7ae6a75826 usb: sr_usb_find() uses standardized connection string to find a USB device 2012-12-04 23:25:11 +01:00
Peter Stuge 1ebe4b4e69 hw_init(): Save struct sr_context * parameter in struct drv_context 2012-12-03 12:07:40 +01:00
Alexandru Gagniuc 21829e6708 radioshack-dmm: Integrate into serial-dmm
Use the infrastructure of serial-dmm to handle the RadioShack 22-812,
and completely remove radioshack-dmm.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-02 22:22:07 +01:00
Alexandru Gagniuc 05f134abc2 radioshack-dmm: Separate protocol parser from driver
Move the parsing part of radioshack-dmm into a separate protocol
parser, following the model from hardware/common/dmm.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-02 22:18:22 +01:00
Uwe Hermann 9871215c83 metex14: Add dB mode and hFE mode support.
This is found e.g. on the Metex M-3640D DMM.
2012-12-02 14:22:51 +01:00
Uwe Hermann ce3777ada9 serial-dmm: Add Metex ME-31 support. 2012-12-02 14:22:46 +01:00
Uwe Hermann 1fbab46626 metex14: Pass 'info' as a void pointer.
This is done so that the function prototype of all sr_*_parse() DMM
functions is the same, which will be needed later.
2012-12-02 14:21:17 +01:00
Uwe Hermann 93357bc3ce fs9721: Pass 'info' as a void pointer.
This is done so that the function prototype of all sr_*_parse() DMM
functions is the same, which will be needed later.
2012-12-02 14:21:17 +01:00
Uwe Hermann a54dd31e38 serial: Use OS-independent flags for serial port opening.
Add SERIAL_RDWR, SERIAL_RDONLY, and SERIAL_NONBLOCK (for now), which are
mapped to the respective OS-specific mechanism in serial_open().
2012-12-02 12:45:54 +01:00
Bert Vermeulen 71caaad46b serial: allow for extra rts and dtr options in conn string
Options in addition to the usual "9600/8n1" syntax start with a
slash, and take the form of key=value, where different options are
also separated by slashes. For example:

	"9600/8n1/rts=0/dtr=1"

This sets RTS low and DTR high.
2012-11-27 00:55:08 +01:00
Uwe Hermann ac913e5c35 Add Metex 14-byte ASCII protocol parser. 2012-11-17 22:27:54 +01:00
Uwe Hermann 766456be1c Move serial_stream_detect() to serial.c. 2012-11-14 18:40:07 +01:00
Bert Vermeulen 299bdb249e serial: revamp internal API
The only thing to get passed around now is the struct sr_serial_dev_inst
pointer. This should make things more portable as well.
2012-11-12 00:27:17 +01:00
Alexandru Gagniuc a99e0d2a0c ols: Do not randomly probe serial ports
ols driver used to probe a series of available serial ports obtained
by regexp matching of common serial port names.
There are a number of problems with this approach:
1. It will probe all serial devices, including devices that do not
like to be probed, potentially causing them to act up.
2. It will try to probe serial ports which may already be opened in
other applications for other purposes.
3. It assumes the naming of the serial ports is set in stone, and
creates an unnecessary OS-specific list.
4. It produces unnecessary debug output even when an OLS device is
not connected.
5. etc...

Do not implicitly probe serial ports. Only probe the port specified
by the frontend, if any; otherwise, just quit.
Also get rid of all functionality in serial.c which was designed
specifically for random probing.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-11-11 03:12:10 +01:00
Bert Vermeulen b87f8504dc g_get_monotonic_time() takes a signed int64 2012-11-07 01:23:24 +01:00