Commit Graph

778 Commits

Author SHA1 Message Date
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
Bartosz Golaszewski f9b0ab6b2d baylibre-acme: Close sysfs files after stopping the acquisition.
Add a missing call to dev_acquisition_close() in dev_acquisition_stop().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-06-29 16:07:59 +02:00
Daniel Lezcano 4e88b86cc8 baylibre-acme: Optimize reading of values from sysfs.
Opening a file has a cost (security, allocation, syscalls). The
read_sample() function always does an open/read/close sequence.

In order to optimize that, let's open the file at the moment the
acquisition starts, close it when the acquisition stops and make
read_sample() only lseek() to the beginning of the file and read
the value.

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-06-29 16:07:52 +02:00
Daniel Elstner fe473123ba sysclk-lwla: Do not create channels in reverse order
This was originally done as an optimization in combination with a list
reversal which has since been removed from the code.  Thus, un-reverse
the channels so that the UI lists them in the correct order again.
2015-06-27 23:56:37 +02:00
Uwe Hermann a93086528e yokogawa-dlm: Minor cosmetics, consistency fixes, typos. 2015-06-23 00:46:45 +02:00
Soeren Apel 49f49cb55e yokogawa-dlm: Return correct value for SR_CONF_HDIV 2015-06-23 00:15:56 +02:00
Soeren Apel 2dcf82e9cb yokogawa-dlm: Remove dlm_setup_channels() 2015-06-23 00:15:56 +02:00
Soeren Apel c65a021c05 yokogawa-dlm: Introduce config_channel_set() 2015-06-23 00:15:56 +02:00
Soeren Apel f3c60fb6af yokogawa-dlm: Config get/set/list handler updates 2015-06-23 00:15:56 +02:00
Soeren Apel f77afcf0aa yokogawa-dlm: Fix number of digital groups 2015-06-23 00:15:56 +02:00
Soeren Apel 6fd78a9fd0 yokogawa-dlm: Prevent duplicate channel index 2015-06-23 00:15:56 +02:00
Soeren Apel 7048bb1f35 yokogawa-dlm: Add support for the DL9000 series 2015-06-23 00:15:56 +02:00
Daniel Gröber b7c53d48a8 fx2lafw: Add DSLogic Pro and DSCope firmware loading support 2015-06-22 17:14:00 +02:00
Carl-Fredrik Sundström 65e0036635 dslogic: Fix incorrect samplerate setting. 2015-06-22 16:54:39 +02:00
Alexandru Gagniuc 9a5185c736 scpi-pps: Chroma 62000P: Get capabilities from device name
The Chroma 62000P series comes in various models with different
current and voltage capabilities. These are encoded in the *IDN
string, so just get them from there, rather than needing a profile
for every model.
2015-06-16 13:04:24 +02:00
Alexandru Gagniuc 5281993e0a scpi-pps: Add profile for Chroma 62024P-80-60 DC Source 2015-06-16 13:04:24 +02:00
Uwe Hermann 84ab9da11f saleae-logic16: Emit debug info of which bitstream is used. 2015-06-11 18:35:40 +02:00
Marcus Comstedt c868139629 saleae-logic16: Support new bitstream version 1.3 with renumbered registers 2015-06-11 18:35:40 +02:00
Uwe Hermann da005885c8 scpi: Update names of a few *_OUTPUT_* items. 2015-06-07 20:58:46 +02:00
Uwe Hermann ae1827f557 modbus: Consistently use the "Modbus" spelling.
(as per modbus.org spelling)
2015-06-07 20:42:33 +02:00
Uwe Hermann f54ebe0c06 modbus: Minor typos, cosmetics and consistency fixes. 2015-06-07 20:40:32 +02:00
Aurelien Jacobs ffb580cf73 Actual implementation for the maynuo-m97 driver. 2015-06-07 20:15:08 +02:00
Aurelien Jacobs e1ccfb1910 maynuo-m97: Initial driver skeleton. 2015-06-07 20:15:08 +02:00
Aurelien Jacobs c4b7838922 libsigrok.h: Add SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE. 2015-06-07 20:15:07 +02:00
Aurelien Jacobs 4c938fc27f modbus: add a serial RTU backend. 2015-05-12 13:22:34 +02:00
Aurelien Jacobs daa3901205 Add a modbus communication helper module. 2015-05-12 13:22:34 +02:00
Aurelien Jacobs a2632bcafc libsigrok-internal.h: add helper macro to read floats from unaligend memory. 2015-05-12 13:22:34 +02:00
Aurelien Jacobs 7a0b98b544 Rename SR_CONF_OUTPUT_* to SR_CONF_*.
All those options are currently applied only to power-supplies
but they could apply as well to electronic loads, except for the
fact that electronic loads channels are called inputs and not
outputs.
Also when you think about an SMU (or any kind of 4-quadrants
power-supply), their channels can both source and sink current,
so they can be considered as input as much as output.
Those SR_CONF_* are thus renamed so that they can be used in all
those situations.
2015-05-12 13:22:34 +02:00
Aurelien Jacobs c1603f4574 scpi-pps: don't fail acquisition start for devices with no CMD_SELECT_CHANNEL
For devices such as the HP 6632B the following invocation was failing due to
scpi_cmd(sdi, SCPI_CMD_SELECT_CHANNEL, ...) returning SR_OK_CONTINUE.

./sigrok-cli -d scpi-pps:conn=/dev/ttyUSB0:serialcomm=9600/8n1 --continuous
sr: session: sr_session_start: could not start an acquisition (not enough data to decide error status yet)
Failed to start session.
2015-05-09 23:06:10 +02:00
Aurelien Jacobs bbc42811d0 Use G_PI instead of defining our own version of PI. 2015-05-09 22:52:24 +02:00
Uwe Hermann 562a34908e scpi-pps: Minor cleanups. 2015-05-07 03:15:35 +02:00
Uwe Hermann c80cf3e02e scpi-pps: Fix a compiler warning.
CC       src/hardware/scpi-pps/profiles.lo
  src/hardware/scpi-pps/profiles.c:67:2: warning: missing initializer
  for field 'frequency' of 'const struct channel_spec'
  [-Wmissing-field-initializers]
    { "1", { 0, 60, 0.0001 }, { 0, 25, 0.1 } },
    ^
  In file included from src/hardware/scpi-pps/profiles.c:24:0:
  src/hardware/scpi-pps/protocol.h:106:8: note: 'frequency' declared
  here
    float frequency[3];
          ^
2015-05-07 02:59:28 +02:00
Uwe Hermann 8cb5affe00 scpi-pps: Make some more items static. 2015-05-07 02:49:59 +02:00
Alexandru Gagniuc 5c9e56c95b spci-pps: Add profile for Agilent N5767A DC source 2015-05-07 02:09:09 +02:00
Alexandru Gagniuc 6c0c9dd257 spci-pps/profiles: Support frequency control in Chroma 61604 2015-05-06 19:41:46 +02:00
Alexandru Gagniuc 4264f1c03b scpi-pps: Add infrastructure for controlling output frequency
This patch only adds the needed infrastructure to control output
frequency in the same manner as output voltage or current limit. This
does require a new field in the channel_spec struct, for the sake of
symmetry.
2015-05-06 19:41:46 +02:00
Alexandru Gagniuc a77585d4ae global: Add configuration key for output frequency target
This will be used to set up the output frequency of AC sources.
2015-05-06 19:41:46 +02:00
Alexandru Gagniuc b94dd07b08 global: Treat SR_CONF_OUTPUT_FREQUENCY as float instead of uint64_t
This makes 'output_frequency' symmetrical with 'output_current' and
'output_voltage'. On a more fundamental level, there's no reason why
frequency should be treated as a discrete quantity, other than
"es51919 used it this way".
2015-05-06 10:25:16 -07:00
Alexandru Gagniuc e8686e3ae3 asix-sigma: Avoid use of variable length arrays
This was only done once in sigma_write_register().
2015-05-01 13:42:25 +02:00
Alexandru Gagniuc 4ee1e2f35f spci-pps: Add profile for Chroma 61604 AC Source
Only the capabilities which map directly to SCPI commands supported by
sigrok are implemented at this time. This is sufficient to control
the most often used functionality of this AC source
2015-04-29 22:59:56 +02:00
Alexandru Gagniuc 0c08023f50 scpi: Accept *IDN responses with more than four tokens
Some devices with more than one microcontroller report the firmware
version for each of them, giving us more than four tokens. When that
happens, sigrok aborts, even though it received a valid response.

This happens, for example with the Chroma 61604:
'Chroma ATE,61604,001060,1.25,1.34,1.20'
2015-04-29 22:59:56 +02:00
Aurelien Jacobs 76372c5a9c Define our own constant for PI.
M_PI is not defined in the C standard nor in POSIX, it is a
non-standard GNU extension.
2015-04-28 22:07:03 +02:00
Aurelien Jacobs ba464a1217 strcasecmp() is defined in strings.h. 2015-04-28 22:07:01 +02:00
Aurelien Jacobs 94b138a3c3 wav: Stricter check for valid chunk ID.
isascii() is a superset of isalpha() and isblank() so the current
code doesn't really make sense.
Moreover, isascii(x) is just a funky and non standard way to
write x < 128.
2015-04-28 22:05:47 +02:00
Uwe Hermann 468665dfa7 Fix various warnings when building without libusb.
../src/backend.c: In function 'sr_init':
  ../src/backend.c:435:1: warning: label 'done' defined but not used [-Wunused-label]
   done:
   ^

  ../src/device.c: In function 'sr_dev_inst_connid_get':
  ../src/device.c:525:7: warning: unused variable 'connection_id' [-Wunused-variable]
    char connection_id[64];
         ^
  ../src/device.c:524:20: warning: unused variable 'b' [-Wunused-variable]
    int r, cnt, i, a, b;
                      ^
  ../src/device.c:524:17: warning: unused variable 'a' [-Wunused-variable]
    int r, cnt, i, a, b;
                   ^
  ../src/device.c:524:14: warning: unused variable 'i' [-Wunused-variable]
    int r, cnt, i, a, b;
                ^
  ../src/device.c:524:9: warning: unused variable 'cnt' [-Wunused-variable]
    int r, cnt, i, a, b;
           ^
  ../src/device.c:524:6: warning: unused variable 'r' [-Wunused-variable]
    int r, cnt, i, a, b;
        ^
  ../src/device.c:523:22: warning: unused variable 'drvc' [-Wunused-variable]
    struct drv_context *drvc;
                      ^
2015-04-17 17:45:07 +02:00
Uwe Hermann 17dda6c5d4 ols: Whitespace fixes. 2015-04-17 17:45:07 +02:00
Bartosz Golaszewski 192d37e728 baylibre-acme: Add a missing return value check.
Check the return value of sr_gpio_setval_export() in bl_acme_set_power_off()
and return an appropriate error if the call fails.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-04-17 16:42:36 +02:00
Bartosz Golaszewski 09d217a40a Revert "baylibre-acme: Fix a compiler warning."
This reverts commit 4cd97e5ad7.

We should actually check the return value of sr_gpio_setval_export().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-04-17 16:42:36 +02:00
Uwe Hermann 55462b8ba9 windows: Fix various compiler warnings.
Add LIBUSB_CALL where needed to avoid warnings such as the following:

  In file included from src/hardware/hantek-dso/api.c:34:0:
  src/hardware/hantek-dso/dso.h:212:13:
  note: expected 'libusb_transfer_cb_fn' but argument is of type 'void (*)(struct libusb_transfer *)'
   SR_PRIV int dso_get_channeldata(const struct sr_dev_inst *sdi,
               ^
2015-04-12 19:28:36 +02:00
Uwe Hermann 76598cda54 input/wav: windows: Fix a compiler warning.
src/input/wav.c:41:0: warning: "WAVE_FORMAT_PCM" redefined
   #define WAVE_FORMAT_PCM          0x0001
   ^
  In file included from [...]/include/windows.h:86:0,
                   from [...]/include/libusb-1.0/libusb.h:70,
                   from ./src/libsigrok-internal.h:31,
                   from src/input/wav.c:28:
  [...]/include/mmsystem.h:482:0: note: this is the location of the previous definition
   #define WAVE_FORMAT_PCM 1
   ^
2015-04-12 18:54:43 +02:00
Uwe Hermann 4cd97e5ad7 baylibre-acme: Fix a compiler warning.
CC       src/hardware/baylibre-acme/protocol.lo
  ../src/hardware/baylibre-acme/protocol.c: In function 'bl_acme_set_power_off':
  ../src/hardware/baylibre-acme/protocol.c:417:6: warning: variable 'val' set but not used [-Wunused-but-set-variable]
    int val;
        ^
2015-04-12 17:26:48 +02:00
Bartosz Golaszewski 7c91c22a31 baylibre-acme: Set update_interval when modifing samplerate.
Both ina2xx and tmp401 linux drivers used by baylibre-acme expose
the standard hwmon update_interval attribute, which affects the internal
update interval of the chip.

When setting samplerate for data acquisition try to modify this
attribute accordingly.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-04-12 17:16:32 +02:00
Bartosz Golaszewski 1fe04eb8d6 baylibre-acme: Dynamically check per probe config options.
PROBE_FACTOR and POWER_OFF options are advertised for all ACME probes
(channel groups) regardless of whether they actually have given capability.

Check these options in config_list() at runtime and only advertise them
for probes which support them.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-04-12 17:16:32 +02:00
Uwe Hermann 1190c65397 Fix a USB timeout related issue in sr_session_iteration().
This issue could lead to e.g. crashes when an OLS was used.

This fixes bug #571.
2015-04-12 17:16:32 +02:00
Uwe Hermann b65630f78d uni-t-dmm: Add a missing NULL (fixes a crash on Android).
This caused an non-terminated driver list, which lead to a crash
on Android (at least on ARM).
2015-04-09 23:13:30 +02:00
Uwe Hermann d93c14707e dslogic: Fix FPGA bitstream upload. 2015-04-09 20:04:32 +02:00
Uwe Hermann 4df5739a9f dslogic: Add #defines for timeouts and delays. 2015-04-09 20:04:32 +02:00
Uwe Hermann eac0c61327 rigol-ds: Drop unneeded check of g_strdup_printf() result. 2015-04-08 19:14:05 +02:00
Uwe Hermann 032da34b78 sr_driver_list() now takes a context pointer.
This requires sr_hw_cleanup_all() and sanity_check_all_drivers()
to also take a context.

The (runtime) generation of the driver list now happens in sr_init()
and sr_driver_list() always returns that pre-generated list. This fixes
a segfault when (correctly) invoking multiple sr_init() and sr_exit()
calls with different contexts (caught by the unit tests).

This fixes bug #565.
2015-04-07 02:09:56 +02:00
Uwe Hermann 07962655ec link-mso: Eliminate unneeded NUM_CHANNELS. 2015-04-07 02:02:43 +02:00
Uwe Hermann 0f26276329 fx2lafw: Use libusb_error_name() for reporting transfer status. 2015-04-03 21:05:02 +02:00
Uwe Hermann 07ffa5b315 Replace some magic numbers with a #define. 2015-04-01 00:23:25 +02:00
Uwe Hermann dc89faeace Reduce unnecessarily high indentation level in some places. 2015-04-01 00:23:25 +02:00
Uwe Hermann 2ea67fc9bf Minor cosmetics and consistency fixes. 2015-04-01 00:23:25 +02:00
Uwe Hermann b1f8310376 Don't check g_free() arguments for NULL.
The g_free() call is guaranteed to not segfault when NULL is passed.
2015-04-01 00:23:25 +02:00
Uwe Hermann e742b88f9a cem-dt-885x: Add a missing break statement. 2015-04-01 00:23:25 +02:00
Uwe Hermann 72d69b7cd1 zeroplus: Add a missing break statement.
This fixes a bug when trying to trigger on a channel being 0/low.
2015-04-01 00:23:24 +02:00
Uwe Hermann 2cca921d91 Fix a typo in a for loop (wrong variable). 2015-04-01 00:23:24 +02:00
Uwe Hermann ce3ecb7049 sysclk-lwla: Use ARRAY_SIZE instead of G_N_ELEMENTS.
Both do exactly the same, but we consistently use ARRAY_SIZE
in the rest of the code-base.
2015-03-26 23:53:52 +01:00
Martin Ling f05406117d uni-t-dmm: Declare each meter type in only one place. 2015-03-26 23:52:06 +01:00
Martin Ling bb5f61105b Call libusb_get_next_timeout() to get minimum timeout for g_poll().
We should have been doing this all along, but we get away with it
on Linux where libusb can do everything with fds, and we get away
with it for many drivers that have a short timeout on their events.

On Windows though, handling this correctly is essential.

Fixes bug #343.
2015-03-26 01:02:40 +01:00
Martin Ling 4ed5d21d04 Store a context pointer in struct sr_session. 2015-03-26 01:02:40 +01:00
Martin Ling 61e6e2da45 Make sr_session_new() and sr_session_load() require a context. 2015-03-26 01:02:40 +01:00
Uwe Hermann c72981ac41 Revert "session_file.c: Use config_*() wrappers."
This temporarily reverts commit 421bc3eba0.

We cannot yet use the sr_config_*() wrappers, otherwise loading *.sr
files is broken. A fix is being worked on.
2015-03-24 23:35:29 +01:00
Martin Ling f6c30de4b0 Initial fix attempt for a thread-related issue on Windows.
This is a partial fix for bug #343, which lead to a large amount of
handles being created, and eventually to a frontend "hang".

It's not yet a "full" fix as some issues are still observable,
but it successfully improves the situation on Windows to the extent
that frontend hangs due to large amounts of handles no longer seem
to happen.

Thanks to Boris Gjenero <boris.gjenero@gmail.com> for the debugging
efforts, testing, and updating of this patch!

Additionally, this seems to also fix a "SysClk LWLA hanging" bug
and apparently not receiving any samples during an acquisition
(tested on an LWLA1034).

This closes bug #328.
2015-03-24 20:14:04 +01:00
Uwe Hermann 515ab0889e Various #include file cosmetic fixes.
Generally include system headers before local headers, unless there's
a technical reason to use another order.
2015-03-24 19:30:16 +01:00
Uwe Hermann 98fec29ecb Various NULL-check consistency fixes. 2015-03-24 19:30:16 +01:00
Uwe Hermann a95f142e88 Some more g_try_*alloc() fixes.
As per documented rules in HACKING, we don't check "small" allocations.
2015-03-24 19:30:16 +01:00
Uwe Hermann 1a46cc62e2 Improve readability and clarity of some numbers. 2015-03-24 19:30:16 +01:00
Uwe Hermann f3f19d1131 Fix a bunch of typos. 2015-03-24 18:01:18 +01:00
Uwe Hermann 8249889dfa demo: Fix SR_CONF_DEVICE_OPTIONS variant type. 2015-03-22 02:15:31 +01:00
Uwe Hermann 0f34cb4723 Channel names consistency fixes and simplifications. 2015-03-22 02:15:30 +01:00
Uwe Hermann db24496ac8 Remove unneeded #endif comments. 2015-03-22 02:15:30 +01:00
Uwe Hermann 93b118da4f Consistency and whitespace fixes for switch statements. 2015-03-22 02:15:30 +01:00
Uwe Hermann d0148a506e Make memset() invocations consistent across all files. 2015-03-22 02:15:30 +01:00
Uwe Hermann 0c5f2abc66 Random whitespace and other minor fixes. 2015-03-22 02:15:30 +01:00
Uwe Hermann 421bc3eba0 session_file.c: Use config_*() wrappers. 2015-03-22 02:15:30 +01:00
Uwe Hermann dcd438ee35 Simplify a few config_set() callbacks.
Also, extended logging and random whitespace fixes.
2015-03-22 02:15:30 +01:00
Uwe Hermann 329733d92c Constify a few arrays and variables. 2015-03-21 20:30:53 +01:00
Uwe Hermann 53cda65a6b Remove unneeded explicit array size specification. 2015-03-21 19:40:19 +01:00
Uwe Hermann 1beccaed46 Various minor whitespace fixes. 2015-03-21 19:28:54 +01:00
Uwe Hermann e8be616955 tondaj-sl-814: Add missing SR_PRIV. 2015-03-21 19:01:10 +01:00
Uwe Hermann 145d794fac serial-dmm: Use g_malloc()/g_free(). 2015-03-21 18:46:00 +01:00
Uwe Hermann c35276dd92 vc870: Fix a compiler warning.
src/dmm/vc870.c: In function 'flags_valid':
  src/dmm/vc870.c:380:54: warning: unused parameter 'info'
  [-Wunused-parameter]
   static gboolean flags_valid(const struct vc870_info *info)
2015-03-21 18:43:17 +01:00
Uwe Hermann 1a8639164e Minor cosmetics, cleanups. 2015-03-21 18:28:02 +01:00
Uwe Hermann 8852eb75d1 serial-dmm: Drop obsolete extern declaration. 2015-03-21 13:17:51 +01:00
Martin Ling bcbef5ed70 serial-dmm: Declare each meter type in only one place. 2015-03-21 13:13:34 +01:00
Martin Ling 4f840ce965 Pass driver struct pointer to driver callbacks.
This lays the groundwork for subdrivers to share callbacks without
needing a separate wrapper function for each subdriver.
2015-03-21 13:09:40 +01:00
Martin Ling 9e60a31fb9 Construct driver array at runtime, from an array of per-file arrays.
This lays the groundwork for drivers to define their own array of
subdrivers, rather than having to list each subdriver here.
2015-03-21 13:09:39 +01:00
Martin Ling 702f42e8eb rigol-ds: Add DS1000Z series support.
Tested on an MSO1104Z with firmware 00.04.02.SP4.

The analog channels are captured correctly. For the MSO series, with digital
channels, there are two outstanding issues:

1. Logic data is retrieved per-channel, one byte per sample, with the value
   in the LSB of each byte. The current datafeed logic format doesn't allow
   this format to be passed on directly. I suggest we resolve that rather than
   making the driver buffer and interleave the data.

   As stands, the code will retrieve data for all channels and pass it onto
   the datafeed with unitsize=1. Channel D0 can used correctly if selected
   alone. For other channels, data is passed to the frontend but the API does
   not provide a way to associate it with the correct channel.

2. Channels CH3 and CH4 are multiplexed with D0-7 and D8-15 respectively, so
   enabling these is mutually exclusive. We don't currently have a way to
   express this constraint to the frontend.
2015-03-21 01:55:55 +01:00
Uwe Hermann c36f78f772 Add initial Voltcraft VC-870 support.
There are a few details that have yet to be implemented or
reverse engineered and tested.
2015-03-20 21:27:04 +01:00
Bartosz Golaszewski 350b8b07f0 baylibre-acme: Fix a double free in bl_acme_set_shunt().
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-03-20 16:54:02 +01:00
Martin Ling cfcdf57677 scpi-pps: Add profile for Rigol DP821A. 2015-03-20 15:33:49 +01:00
Martin Ling 7d4f1741e3 scpi-pps: Initialise sdi with status SR_ST_INACTIVE.
Without this change a segfault occurs at exit after scan, because
dev_close() is called and the device is believed to be open.
2015-03-20 15:33:49 +01:00
Martin Ling 40c2c9159c rigol-ds: Fix broken channel group check in config_list(). 2015-03-19 23:01:50 +00:00
Martin Ling f579d08bc5 rigol-ds: Data source is a device option, not per channel group. 2015-03-19 23:01:50 +00:00
Martin Ling 98bfc4741f rigol-ds: Use sr_scpi_get_bool(). 2015-03-19 23:01:50 +00:00
Martin Ling bff16ba817 rigol-ds: Fix double free.
std_dev_clear() frees all channel groups, so this one is not required.
2015-03-19 23:01:50 +00:00
Martin Ling 16aca7661b rigol-ds: Fix wrong channel group malloc size. 2015-03-19 23:01:50 +00:00
Martin Ling 6f1346fbd7 Change API of channel accessor functions to take struct sr_channel *. 2015-03-19 21:57:31 +00:00
Martin Ling 837b08660a Add sdi pointer to struct sr_channel. 2015-03-19 21:41:51 +00:00
Martin Ling 5e23fcab88 Simplify channel creation.
We always follow sr_channel_new() with a call to add the channel to the sdi.
Tidy up a bit by adding this functionality to sr_channel_new() instead.
2015-03-19 21:37:33 +00:00
Uwe Hermann bc49777251 fx2lafw: Replace obsoleted strncmp() calls.
The fixed lengths for strncmp() can no longer be used since strings of
various lengths can be passed to match_manuf_prod(). Use strcmp() instead.
2015-03-19 18:25:55 +01:00
eightdot 6fcf3f0a22 Various fixes/updates to make the driver compile.
This patchset was originally done by eightdot <gituser@eightdot.eu> by
manually forward-porting parts of the changes done by Bert Vermeulen (see
previous commits), but then heavily modified by Uwe Hermann to be based on
top off the (git-)rebased patches from Bert Vermeulen instead.

Note: This initial DSLogic code is *not* yet in a working or usable
state. It should be considered as a basis for further work only, for now.
2015-03-19 18:25:55 +01:00
Bert Vermeulen b9d530920f fx2lafw: Basic acquisition support for DSLogic. 2015-03-19 18:25:55 +01:00
Bert Vermeulen a7d7f93c1b fx2lafw: scan/firmware support for DSLogic. 2015-03-19 18:25:55 +01:00
Bartosz Golaszewski c04cf9aa81 output: Accept analog packets in csv output module.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-03-16 13:05:45 +01:00
Uwe Hermann f7ab2f231a ols: Fix a compiler warning (unused variable).
CC       src/hardware/openbench-logic-sniffer/api.lo
  ../src/hardware/openbench-logic-sniffer/api.c: In function 'scan':
  ../src/hardware/openbench-logic-sniffer/api.c:103:10: warning: unused
  variable 'probefd' [-Wunused-variable]
    GPollFD probefd;
            ^
2015-03-13 19:12:47 +01:00
Uwe Hermann ed936ccc7c ols: Fix detection and acquisition on Windows.
Use the more portable sp_input_waiting() instead of g_poll() with FDs.
Thanks to Martin Ling for the hints. This is tested on Linux and Win7
using an OLS; scanning for the device and starting an acquisition works.

Also, add some more debug output.

This fixes bug #562.
2015-03-13 18:08:49 +01:00
Bartosz Golaszewski 5fabeeac6a baylibre-acme: correctly handle channel group options
Split device options into general and channel group settings, and
adjust config_list() callback appropriately.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-03-11 18:23:41 +01:00
Martin Ling bf622e6d00 Rename SR_CONF_NUM_TIMEBASE to SR_CONF_NUM_HDIV. 2015-03-02 12:24:12 +01:00
Uwe Hermann 6df8e239de ut372: Minor cosmetics. 2015-03-02 12:23:32 +01:00
Martin Ling 12318aab96 ut372: Support count mode. 2015-03-01 23:30:48 +00:00
Martin Ling 8c9092b00b ut372: Handle flags correctly.
Packets will now be rejected if the device is not displaying RPM.
2015-03-01 23:26:33 +00:00
Martin Ling 118268a2fe ut372: Break out character-pair decoding to a separate function. 2015-03-01 22:54:45 +00:00
Martin Ling 472bef3990 ut372: Implement initial protocol parser.
For now this only works correctly if the device is in the default
state showing current RPM. The flags are not checked.
2015-03-01 22:36:52 +00:00
Martin Ling f3cde30904 ut372: Initial sub-driver skeleton. 2015-03-01 22:30:57 +00:00
Baruch Even 2cb63065f5 serial-dmm: Add MASTECH MS8250B as a supported DMM.
It is an alias and uses the FS9721 driver.
2015-02-27 15:10:19 +01:00
Uwe Hermann d9c3331d12 asix-sigma: Use the more portable g_usleep(). 2015-02-26 11:15:02 +01:00
Bartosz Golaszewski 380ee96fdf baylibre-acme: don't report ACME as detected if no probes are present
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-02-20 11:22:26 +01:00
Uwe Hermann 3d14ce49e4 baylibre-acme: Fix vendor/device name. 2015-02-17 17:03:41 +01:00
Uwe Hermann e00b3f5897 Various Doxygen updates. 2015-02-17 15:57:21 +01:00
Uwe Hermann d258022db0 baylibre-acme: Drop unneeded comment.
There's indeed no g_fclose() unfortunately. The g_*() wrappers for file
handling are mainly there to deal with portability issues in file names
(encoding, character sets, etc) on different platforms.
2015-02-16 01:57:35 +01:00
Uwe Hermann 3452785431 baylibre-acme: Fix a compiler warning.
Use PRIu64 to avoid the following compiler warning:

    CC       src/hardware/baylibre-acme/gpio.lo
  protocol.c: In function 'bl_acme_set_shunt':
  protocol.c:341:2: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'uint64_t' [-Wformat=]
    g_fprintf(fd, "%llu\n", MOHM_TO_UOHM(shunt));
    ^
2015-02-16 01:57:35 +01:00
Uwe Hermann 391e23a97f baylibre-acme: Minor coding-style, cosmetics. 2015-02-16 01:57:35 +01:00
Bartosz Golaszewski 740ad48ac8 baylibre-acme: Add support for SR_CONF_POWER_OFF.
Allow to remotely cut the power at ACME probe level.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-02-16 01:20:08 +01:00
Bartosz Golaszewski 289eebd7ca baylibre-acme: Add Linux-specific GPIO helpers.
These functions allow to export, read and set GPIOs using Linux
sysfs interface.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-02-16 01:20:08 +01:00
Bartosz Golaszewski 61f2b7f74c baylibre-acme: Add support for probe factor setting.
Implement support for SR_CONF_PROBE_FACTOR setting in BayLibre ACME
driver. Given the channel-group parameter this allows to set the
shunt resistance for each probe.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-02-16 01:20:08 +01:00
Bartosz Golaszewski d3c81725ae SR_CONF_PROBE_FACTOR: New option.
Add new configuration option allowing to modify the probe factor
for oscilloscopes and power-monitors.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-02-16 01:20:07 +01:00
Bartosz Golaszewski 6b80b80dcf baylibre-acme: Driver implementation.
Implement basic functionalities for baylibre-acme. Add support
for common config options, device detection and sample reading.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-02-16 01:20:07 +01:00
Bartosz Golaszewski dfaee1de17 baylibre-acme: Initial driver skeleton.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-02-16 01:20:07 +01:00
Aurelien Jacobs 96cb7faac3 rigol-ds: fix the smallest supported vdiv for the DS2000 series. 2015-02-15 21:15:27 +01:00
Aurelien Jacobs 81b85663f3 rigol-ds: return the actual hardware num_vdiv and vdiv list. 2015-02-15 21:15:21 +01:00
Aurelien Jacobs c33ff3771b rigol-ds: fix search for the closest vdiv.
We try to find the smallest diff by comparing each diff with
the previously known smallest diff, so initially, this smallest diff
should be INFINITY so that we are sure to find a smaller one.

This fixes the following exception:
sr: rigol-ds: Negative vdiv index: -1.
Caught exception: not applicable
2015-02-15 21:15:04 +01:00
Uwe Hermann f44f7e61a3 rigol-ds: Add missing "break" statements. 2015-02-14 19:32:25 +01:00
Uwe Hermann d50725e012 rigol-ds: Add missing 20/50/100V vdiv entries.
These are available on e.g. Rigol DS1102E (or "upgraded" DS1052E).

Without this, if one of the channels happens to have been set to
one of the missing vdiv settings frontends (e.g. PulseView) will
have some trouble using the scope:

  sr: hwdriver: sr_config_get(): key 30012 (vdiv) sdi 0x11bcb70 cg CH1
  sr: rigol-ds: Negative vdiv index: -1.
  std::exception
2015-02-14 19:32:15 +01:00
Uwe Hermann e1b5b7e735 rigol-ds: Add more debug output. 2015-02-14 18:34:04 +01:00
Aurelien Jacobs d5c4144e2c rigol-ds: handle full word trigger slope in config_get().
Some scope can return POSITIVE/NEGATIVE instead of POS/NEG,
so accept this as well.

This closes bug #558.
2015-02-13 16:37:24 +01:00
Aurelien Jacobs b0c9d1d1c2 rigol-ds: SR_CONF_TRIGGER_SLOPE is actually listable. 2015-02-12 17:58:32 +01:00
Aurelien Jacobs 73931b7cc7 input/vcd: fix parse_header() return value check.
Mixing tests for both a boolean and an SR_ERR at the same time is not
really a good idea.
parse_header() actually returns a boolean so only check if it returns FALSE.

This fixes the following gcc-5 warning:

src/input/vcd.c: In function 'receive':
src/input/vcd.c:506:34: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
   if (!parse_header(in, in->buf) != SR_OK)
                                  ^
2015-02-12 17:58:06 +01:00
Aurelien Jacobs 2617c81a4b Remove the inline qualification from sr_rational_set().
Inlining can only happen in the same compilation unit where the
function was defined, so there is no sense declaring an inline
function in a header if this function is not defined in this
same header.

This fixes the following gcc-5 warning:

In file included from include/libsigrok/libsigrok.h:1066:0,
                 from src/version.c:21:
include/libsigrok/proto.h:36:20: warning: inline function 'sr_rational_set' declared but never defined
 SR_API inline void sr_rational_set(struct sr_rational *r, uint64_t p, uint64_t q);
                    ^
2015-02-12 11:24:11 +01:00
Aurelien Jacobs ee29d92e14 Correctly copy sr_datafeed_meta in sr_packet_copy().
Commit 5801d558 replaced g_slist_copy_deep() by some incorrect code
that actually leaks the newly allocated memory, instead of doing
a deep copy.

This new version should be more correct, more concise, and it fixes
the following warning:

src/session.c: In function 'sr_packet_copy':
src/session.c:1025:38: warning: passing argument 2 of 'g_slist_foreach' from incompatible pointer type [-Wincompatible-pointer-types]
   g_slist_foreach(meta_copy->config, (GCopyFunc)copy_src, NULL);
                                         ^
In file included from /usr/include/glib-2.0/glib/gmain.h:26:0,
                 from /usr/include/glib-2.0/glib/giochannel.h:33,
                 from /usr/include/glib-2.0/glib.h:54,
                 from src/session.c:24:
/usr/include/glib-2.0/glib/gslist.h:125:10: note: expected 'GFunc {aka void (*)(void *, void *)}' but argument is of type 'void * (*)(const void *, void *)'
void     g_slist_foreach                 (GSList           *list,
         ^
2015-02-12 11:14:37 +01:00
Uwe Hermann c4f9582714 sr_strerror_name(): Add missing SR_ERR_IO entry. 2015-02-11 16:26:12 +01:00
Bartosz Golaszewski 3c5582595a SR_ERR_IO: new error code
Add new error code which can be used to notify the user about
general input/output errors.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-02-11 16:25:30 +01:00
Uwe Hermann 187cfc604e backend: Add basic transform module sanity checks. 2015-02-11 15:24:38 +01:00
Uwe Hermann d74d30bb14 transform: Add an "invert" transform module.
This inverts the data values:

 - An analog value of x becomes 1/x.

 - A digital value of 0 becomes 1 (and vice versa).
2015-02-11 15:24:34 +01:00
Uwe Hermann 43caa46623 transform: Add a "scale" transform module. 2015-02-11 15:24:30 +01:00
Uwe Hermann 39f1752eff transform: Add a "nop" transform module.
This doesn't do anything, just passes input packets on unmodified.
2015-02-11 12:23:02 +01:00
Uwe Hermann c0a1e532f5 transform: Hook up transforms. 2015-02-11 12:23:02 +01:00
Uwe Hermann 988357ca2f transform: Add a basic set of API calls. 2015-02-11 12:23:02 +01:00
Uwe Hermann 790320f605 transform: Add struct sr_transform and struct sr_transform_module. 2015-02-11 12:23:02 +01:00
Daniel Elstner 57ba5f3d56 sysclk-lwla: Widen constant to 64 bit before shifting
(lwla_convert_trigger): Fix trigger mask computation bug introduced
by recent change:  Widen constant to 64 bit before shifting so that
channel nunmbers beyond 32 are processed correctly.
2015-01-31 21:09:01 +01:00
Uwe Hermann 5801d558e7 Lower dependency to glib 2.32.
By avoiding g_slist_copy_deep() for now, we can easily allow libsigrok
to build against glib 2.32 (less hassle for users of stable/older
distros or OSes).
2015-01-29 13:55:55 +01:00
Uwe Hermann 8656a71790 output/gnuplot: Use .dat as suggested file extension.
Gnuplot doesn't have any "official" file name extension(s). It uses
(at least) two different types of files basically:

 - "control files": These can have many different somewhat commonly
   used extensions such as .gpi, .gnu, .gnuplot, .gp, .plt, .gih,
   others. These files don't contain data, only Gnuplot commands such
   as 'set yrange [75:105]', 'set ylabel "foo" offset 1', and so on.

 - "data files": This is what libsigrok reads and writes. These files
   contain actual data to be graphed by Gnuplot (with the help of a
   specially-crafted control file, see above). The data is usually in
   a tab-separated format. The common file extension is usually .dat,
   though many others are possible as well.
2015-01-27 18:05:30 +01:00
Uwe Hermann 4fb0a5f8a0 in/out: Minor consistency renames.
- 'struct sr_input *' variables are consistently named 'in'.
 - 'struct sr_input_module *' variables are consistently named 'imod'.

 - 'struct sr_output *' variables are consistently named 'o'.
 - 'struct sr_output_module *' variables are consistently named 'omod'.
2015-01-27 18:05:30 +01:00
Joel Holdsworth a82c83c6a5 output/wav: Improved description 2015-01-27 18:05:30 +01:00
Joel Holdsworth 8a174d2342 output: Added preferred file extension field
This fixes parts of bug #541.
2015-01-27 18:05:29 +01:00
Joel Holdsworth c7bc82ffa1 input: Added preferred file extension field
This fixes parts of bug #541.
2015-01-27 18:05:25 +01:00
Uffe Jakobsen 19643b96e2 Fix FreeBSD issue with libusb_get_port_numbers()
Currently (as of date 20150122) an ioctl problem within the
FreeBSD kernel is preventing libusb_get_port_numbers() from working.
Hence calls to libusb_get_port_numbers() will always return 0.
This makes it impossible to establish a physical path the the usb device.

This problem has existed "forever" -
meaning that libusb_get_port_numbers() has never worked.

A fix is committed to FreeBSD "current" head  -
and will later be merged (MFC'ed) to maintenance branches.
See: https://svnweb.freebsd.org/base?view=revision&revision=277417

Additionally FreeBSD requires that devices prior to calling
libusb_get_port_numbers() have been opened with libusb_open().

The patch is "forwards-compatible".
Currently it acts specificly to libusb_get_port_numbers()
currently returning 0 on FreeBSD.
In these situations it constructs an artificial path to the device.
When FreeBSD kernels appears with proper working ioctl
supporting libusb_get_port_numbers() the code will construct
proper physical paths for newer kernels - while still generating
artificial physical paths for older defective kernels.
2015-01-25 23:36:29 +01:00
Bartosz Golaszewski 7a8a1aba37 demo: implement averaging support
Add support for averaging and avg_samples option to the demo device.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-01-25 18:00:42 +01:00
Bartosz Golaszewski 9ed444e622 new config options: averaging
Add new config options to libsigrok - 'averaging', which allows to
enable averaging of samples and 'avg_samples' for setting the number
of samples to be averaged over in each cycle.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-01-25 18:00:40 +01:00
Uwe Hermann 7a54232ba0 sr_input_new(): Add missing @param comment.
This fixes a Doxygen warning:

  src/input/input.c:209: warning: The following parameters of sr_input_new(const struct sr_input_module *imod, GHashTable *options) are not documented:
    parameter 'imod'
2015-01-19 08:47:40 +01:00
Uwe Hermann 718a9d382f Fix two warnings when libserialport is not used.
CC       src/fallback.lo
  src/fallback.c: In function 'sr_serial_list':
  src/fallback.c:26:59: warning: unused parameter 'driver' [-Wunused-parameter]
   SR_API GSList *sr_serial_list(const struct sr_dev_driver *driver)
                                                             ^
  src/fallback.c: In function 'sr_serial_free':
  src/fallback.c:31:51: warning: unused parameter 'serial' [-Wunused-parameter]
   SR_API void sr_serial_free(struct sr_serial_port *serial)
2015-01-17 21:47:59 +01:00
Mathias Katzer 3b95bd9152 scpi: Fix incomplete data issue for e.g. Hameg HMO1024.
On a Hameg HMO1024 you get incomplete data because the USB transfer takes
longer than the scpi->read_timeout_ms of 1 second that is defined in
scpi_dev_inst_new(). Therefore reset the timeout in sr_scpi_get_string()
whenever the device sends a partial response.
2015-01-11 01:43:13 +01:00
Mathias Katzer f62f595bfc hameg-hmo: Fix double-free issue. 2015-01-11 01:43:12 +01:00
Mathias Katzer a1b61e6e04 hameg-hmo: Set SR_CONF_GET | SR_CONF_SET for frame limit.
Reading analog data from an HMO1024 (Firmware 04.527) failed because the
frame limit could not be set.
2015-01-11 01:43:12 +01:00
Janne Huttunen 787ec9dbd9 Limit frames instead of samples.
Since every individual measurement is represented by a single frame
and a "sample" isn't all that meaningful concept in this context,
it makes more sense to define possible limit in number of frames.
Make the es51919 driver to support setting a frame limit instead of
a sample limit.
2015-01-06 20:10:17 +01:00
Janne Huttunen a6413fa58e Use frames to group a single measurement result together.
In most, but not all, modes the ES51919 reports two separate
analog values for each measurement sample. These values are
mapped to two separate channels and sent in two separate
packets.

A client program needs a way to determine which results are
parts of the same measurement and also know when a complete
measurement is received so it can process the sample. Use
the frame begin and end packets to separate groups that each
represent a single complete measurement.
2015-01-06 20:10:17 +01:00
Janne Huttunen bb983c666a Fix the channel indexes of the es51919 driver.
Set the channel indexes to unique values instead of setting
them all zero.
2015-01-06 20:10:17 +01:00
Uffe Jakobsen 15eea61a47 Fix compile error on FreeBSD 2015-01-05 22:16:48 +01:00
Uwe Hermann b1a7ca3b60 serial.c: Cosmetics/consistency/documentation fixes. 2015-01-03 18:03:50 +01:00
Aurelien Jacobs 24287ea9e3 Add a public API to list available serial ports. 2015-01-03 17:51:51 +01:00
Aurelien Jacobs 5e1b68c6e7 Only save enabled channels to a session file.
This reverts bc96d5f08f which is not
needed anymore since we have a better fix for #410 and #495.
2014-12-05 01:14:22 +01:00
Aurelien Jacobs a160a0c344 session_file: Enable only the probes that are actually listed in metadata.
This is a better fix for #410 and #495.
2014-12-05 01:14:22 +01:00
Bert Vermeulen 974fb0fffa saleae-logic16: Show libusb transfer status name instead of code. 2014-11-28 00:21:56 +01:00
Uwe Hermann a11e10ec91 saleae-logic16: Change two errors into warnings.
Related to #466, convert two more sanity checks from errors into warnings.
This may allow more devices to work with libsigrok.
2014-11-27 23:22:05 +01:00
Bert Vermeulen 5cfcab6603 saleae-logic16: Clearer error message. 2014-11-27 01:01:13 +01:00
Aurelien Jacobs e743a47d6d beaglelogic: Add SR_CONF_CAPTURE_RATIO support. 2014-11-25 22:13:36 +01:00
Aurelien Jacobs 5a971f66a3 saleae-logic16: Add SR_CONF_CAPTURE_RATIO support. 2014-11-25 22:13:36 +01:00
Aurelien Jacobs 7bfcb25cf1 fx2lafw: Add SR_CONF_CAPTURE_RATIO support. 2014-11-25 16:56:34 +01:00
Aurelien Jacobs fe5a735553 soft-trigger: Add support for pre-triggering. 2014-11-25 16:56:34 +01:00
Bert Vermeulen bc96d5f08f Always save all channels to a session file.
This works around limitations of the current API that screw up saving
only enabled channels. See bug 410. And bug 495.
2014-11-24 02:21:52 +01:00
Uwe Hermann 9f42e2e6be sr_session_trigger_{get,set}: Document, add error checks. 2014-11-24 00:50:11 +01:00
Uwe Hermann b6085eb179 manson-hcs-3xxx: Fix incorrect SR_CONF_SCAN_OPTIONS handling.
The SR_CONF_SCAN_OPTIONS key must be listable with or without sdi,
otherwise the device will not be detected by frontends.
2014-11-23 21:13:16 +01:00
Vincent Palatin 2f004b4bc1 usb_get_port_path(): fix libusb error checking
When libusb cannot access a device, libusb_get_port_numbers() will return
an error. Check the return code rather than doing invalid pointer
operations (out-of-bound read).

Avoid segfaults at sigrok-cli startup on my setup where some USB devices are
not accessible and also make Valgrind happier.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-23 17:58:21 +01:00
Bert Vermeulen 68ac991dba Publish config key capabilities on session driver. 2014-11-23 17:48:29 +01:00
Bert Vermeulen 90cefe0cc7 Add sr_rational_set() convenience function. 2014-11-23 17:48:29 +01:00
Tim Hatch cd3c4df35a saleae-logic16: Downgrade error during capture to a message.
Some clone doesn't set this to the exact same value, and both bits in 0x48 are
marked as unknown at
http://sigrok.org/wiki/Saleae_Logic16/Firmware#FPGA_variables

This fixes bug #466.
2014-11-23 13:47:45 +01:00
Uwe Hermann cc8be68f22 trigger: Add some more error handling.
All of these error conditions are checked via the unit tests.

Also, add the following missing entries (analog trigger types):

 - SR_TRIGGER_RISING
 - SR_TRIGGER_EDGE
2014-11-22 21:03:39 +01:00
Uwe Hermann a445f8aa08 trigger: Add API documentation. 2014-11-22 19:32:28 +01:00
Uwe Hermann 54ab1dcdc4 Add missing entries to sr_config_info_data[].
Newly added keys:

 - SR_CONF_SAMPLE_INTERVAL
 - SR_CONF_NUM_TIMEBASE
 - SR_CONF_NUM_VDIV
 - SR_CONF_CENTER_FREQUENCY
 - SR_CONF_DEVICE_MODE
 - SR_CONF_SCAN_OPTIONS
 - SR_CONF_DEVICE_OPTIONS
 - SR_CONF_DEVICE_MODE
 - SR_CONF_TEST_MODE

Also, keep the same ordering and grouping as in libsigrok.h.
2014-11-22 17:02:57 +01:00
Uwe Hermann 91219afc75 Use g_malloc0() consistently, simplify error handling.
Use g_malloc0() for small allocations and assume they always
succeed. Simplify error handling in a few places accordingly.

Don't always sanity-check parameters for non-public (SR_PRIV)
functions, we require the developers to invoke them correctly.
This allows further error handling simplifications.
2014-11-22 17:02:57 +01:00
Uwe Hermann c368e6f3d2 Don't check sr_channel_new() return value (always succeeds).
We now use g_malloc0() for the allocation and assume the allocation
will always succeed, thus sr_channel_new() will always return a
valid new channel.
2014-11-21 12:10:05 +01:00
Uwe Hermann f57d8ffe66 Consistently use g_malloc0() for allocating devc.
We assume the allocation will always succeed, hence no need for
checking the returned value.
2014-11-21 12:09:01 +01:00
Uwe Hermann aac29cc192 Eliminate sr_dev_inst_new(). 2014-11-21 02:01:36 +01:00
Bert Vermeulen a9b2283fd0 Fix invalid pointer dereference. 2014-11-20 03:08:55 +01:00
Aurelien Jacobs cf0280fa1b yokogawa-dlm: Publish driver options. 2014-11-19 23:54:01 +01:00
Aurelien Jacobs 413f1944d1 motech-lps-30x: Publish driver options. 2014-11-19 23:53:35 +01:00
Aurelien Jacobs f3ba3c119c manson-hcs-3xxx: Publish driver options. 2014-11-19 23:53:10 +01:00
Aurelien Jacobs 6ec3ef9b92 hameg-hmo: Publish driver options. 2014-11-19 23:52:51 +01:00
Aurelien Jacobs 8a58419d37 Finish fixing broken sr_config_list() logic. 2014-11-19 17:34:19 +01:00
Martin Ling a24da9a813 Make sr_analog_*_to_string() functions allocate the necessary buffers. 2014-11-19 17:34:19 +01:00
Uwe Hermann e07edc83d6 mic-985xx: Correctly report SR_CONF_THERMOMETER/_HYGROMETER.
Some models only log temperature, others log temperature and humidity
(so they need different drvopts).
2014-11-18 23:43:38 +01:00
Uwe Hermann 20a7cd07c9 mic-985xx: Drop unneeded #define. 2014-11-18 23:26:10 +01:00
Uwe Hermann d6e1e6c4e1 mic-985xx: Publish driver options. 2014-11-18 23:26:10 +01:00
Uwe Hermann 489c338884 center-3xx: Drop unneeded #define. 2014-11-18 23:20:09 +01:00
Uwe Hermann 6685e9a6b3 center-3xx: Publish driver options. 2014-11-18 23:20:09 +01:00
Bert Vermeulen 5c868fef43 Revert "victor-dmm: Set spec digits to 3, matching the display."
This reverts commit 28b4243493.
2014-11-18 18:10:19 +01:00
Bert Vermeulen 63ea6141b6 ols: Publish driver options. 2014-11-18 17:41:36 +01:00
Bert Vermeulen f9dada0b60 agilent-dmm: Now really fix driver options. 2014-11-18 17:31:58 +01:00
Bert Vermeulen 42a47a9a4b appa-55ii: Publish driver options. 2014-11-18 16:50:47 +01:00
Bert Vermeulen 5ecd9049e5 hantek-dso: Fix driver options. 2014-11-18 16:46:39 +01:00
Bert Vermeulen 1f889afd61 atten-pps3xxx: Fix driver options. 2014-11-18 16:44:58 +01:00
Bert Vermeulen 023c73ae05 cem-dt-885x: Fix driver options. 2014-11-18 16:44:14 +01:00