Commit Graph

3542 Commits

Author SHA1 Message Date
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
Martin Ling 2b51d48b38 C++: Change arguments of Input::send() from std::string to data+length. 2015-04-20 10:12:39 +01:00
Uwe Hermann 8d80146722 Lower libserialport requirement to 0.1.1. 2015-04-19 18:39:35 +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
Uwe Hermann d6fe5201d5 .gitignore: Add tests/main. 2015-04-17 17:17:53 +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 2d31e8bcbd configure.ac: Drop unneeded AC_CANONICAL_SYSTEM. 2015-04-08 18:50:07 +02:00
Uwe Hermann b4aa89de4c autogen.sh: Drop obsolete MinGW/MSYS items.
For Windows builds (which require MinGW-w64) we currently support:

 - cross-builds using MXE (mxe.cc) and possibly other cross-compile setups

 - native builds using MSYS2 (sf.net/projects/msys2/)

Neither of those require explicitly specifying ACLOCAL_DIR.
2015-04-07 02:35:08 +02:00
Uwe Hermann fc8f82e965 cxx: Makefile.am: Use libtool's -no-undefined option. 2015-04-07 02:29:09 +02:00
Martin Ling ff101fca12 windows: Fix building shared library on MinGW. 2015-04-07 02:27:59 +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
Uwe Hermann ca1c21ca3e unit tests: Update for sr_session_new() API change. 2015-03-26 23:49:35 +01:00
Uwe Hermann c879dca3d7 bindings/cxx/classes.cpp: Fix sr_session_load() invocation. 2015-03-26 01:02:40 +01:00
Uwe Hermann 60f6b00144 bindings/cxx/classes.cpp: Fix a typo. 2015-03-26 01:02:40 +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
Mike Walters 7637cc60ba Add udev rule for Rigol 1000Z series 2015-03-24 15:54:53 +00:00