Commit Graph

701 Commits

Author SHA1 Message Date
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
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