Commit Graph

3696 Commits

Author SHA1 Message Date
Aurelien Jacobs e922790220 configure: replace buggy AX_RUBY_EXT by a proper implementation
This actually allows to get the proper DLEXT expected by Ruby on
the target system.
2016-01-28 22:48:44 +01:00
Aurelien Jacobs e469259a57 configure: check for swig version >= 3.0.8 for Ruby bindings 2016-01-28 22:45:28 +01:00
Wolfram Sang 3f48fc82b5 input: vcd: by default do not limit number of channels
Accept (and set to default) 0 for numchannels which means 'unlimited'.
I think it is convenient to read all channels of a vcd file by default.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-01-28 19:03:53 +01:00
Wolfram Sang ab464eb3dc input: vcd: register channels when parsing header not when initializing
Benefits:

* only channels really used in vcd will be added
* we can give them the proper name found in the vcd file
* less code :)

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-01-28 19:03:53 +01:00
Wolfram Sang 34724ffa34 input: vcd: support 1 bit vectors
Use the new process_bit() function to parse 1 bit vectors, too.

This is the first step to fix bug #723. Minimal testcase vcd:

$timescale 1 ns $end
$var wire 1 n0 addr_0 $end
$var wire 1 n1 addr_1 $end
$enddefinitions $end
#0
0n0
b1 n1
#1
1n0
b0 n1
#2
0n0
b1 n1
#3
1n0
b0 n1

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-01-28 19:03:53 +01:00
Wolfram Sang 36dacf17bc input: vcd: refactor parsing a bit
Move to a separate function which we want to reuse later.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-01-28 19:03:53 +01:00
Wolfram Sang a66175c2b1 input: vcd: avoid needless copying
Current code moves the identifier string one byte to the front to
overwrite the bit value, so 'tokens[i]' is a string to compare against
the desired value. This copying is unnecessary, just pass a properly
setup pointer.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-01-28 19:03:53 +01:00
Wolfram Sang 76bc28c3f1 input: vcd: try to continue when a vector was found
No need to bail out on vectors. As long as there are tokens left, we can
try to parse the rest. Also, print a message so the user knows what's
going on. Here is a testcase vcd:

$timescale 1 ns $end
$var wire 1 n0 addr_0 $end
$var wire 1 n1 addr_1 $end
$enddefinitions $end
#0
0n0
b1 n1
#1
1n0
b0 n1
#2
0n0
b1 n1

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-01-28 19:03:53 +01:00
Wolfram Sang 73f052d329 input: vcd: properly bail out on missing identifiers
If we hit the missing identifier case, then we reached the end of the
token list. So, we should break out of the loop, and not continue.
Otherwise we will go past the end of the array as this minimal testcase
shows:

$timescale 1 ns $end
$var wire 1 n0 addr_0 $end
$enddefinitions $end
1

gives:

$ ./sigrok-cli -I vcd -i no_mod.vcd -O vcd -o /tmp/o.vcd
Segmentation fault

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-01-28 19:03:53 +01:00
Wolfram Sang e85e550d92 input: vcd: allow optional index item
A $var block can have an optional index item which looks like '[<sth>]'.
Parse it, too, and append it to the channel name.

This fixes bug #322. A first version was posted by Simon Richter. This
version is rebased and simplified.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-01-28 19:03:53 +01:00
Uwe Hermann 650847e7d3 hameg-hmo: Fix some compiler warnings. 2016-01-28 19:03:53 +01:00
Soeren Apel 8fff75196f hameg-hmo: Replace floating point comparison for vdiv
This should fix bug #731.
2016-01-28 19:03:53 +01:00
Soeren Apel a5be5d5bc0 Trace32 import module: Send trigger only once
As we're downsampling, several record time stamps can match the specified
trigger time. For this reason, it's possible that several trigger packets
are sent when a file is loaded. This prevents the issue and sends a
trigger packet only on the first matching record.
2016-01-28 19:03:52 +01:00
Aurelien Jacobs 27d44cf6e0 Implement Ruby bindings on top of SWIG/C++ bindings. 2016-01-28 19:03:52 +01:00
Aurelien Jacobs 0441038e2f Makefile: use PYSIGROK_FLAGS only for building python bindings 2016-01-11 16:25:35 +01:00
Uwe Hermann 1b4aedc06f Use ALL_ZERO in a few more places. 2016-01-07 23:50:17 +01:00
Uwe Hermann ff7c7cda93 lecroy-logicstudio: Fix some compiler warnings on MinGW.
src/hardware/lecroy-logicstudio/protocol.c: In function 'handle_fetch_samples_done':
src/hardware/lecroy-logicstudio/protocol.c:261:3: warning: passing argument 6 of 'libusb_fill_bulk_transfer' from incompatible pointer type
   recv_bulk_transfer, (void *)sdi, USB_TIMEOUT_MS);
   ^
In file included from ./src/libsigrok-internal.h:31:0,
                 from src/hardware/lecroy-logicstudio/protocol.h:26,
                 from src/hardware/lecroy-logicstudio/protocol.c:23:
/home/uwe/sr_mingw/include/libusb-1.0/libusb.h:1546:20: note: expected 'libusb_transfer_cb_fn' but argument is of type 'void (*)(struct libusb_transfer *)'
 static inline void libusb_fill_bulk_transfer(struct libusb_transfer *transfer,
                    ^
src/hardware/lecroy-logicstudio/protocol.c: In function 'fetch_samples_async':
src/hardware/lecroy-logicstudio/protocol.c:314:4: warning: passing argument 6 of 'write_registers_async' from incompatible pointer type
    handle_fetch_samples_done);
    ^
src/hardware/lecroy-logicstudio/protocol.c:200:12: note: expected 'libusb_transfer_cb_fn' but argument is of type 'void (*)(struct libusb_transfer *)'
 static int write_registers_async(const struct sr_dev_inst *sdi,
            ^
src/hardware/lecroy-logicstudio/protocol.c: In function 'lls_start_acquisition':
src/hardware/lecroy-logicstudio/protocol.c:1122:3: warning: passing argument 6 of 'libusb_fill_interrupt_transfer' from incompatible pointer type
   recv_intr_transfer, (void *) sdi, USB_TIMEOUT_MS);
   ^
In file included from ./src/libsigrok-internal.h:31:0,
                 from src/hardware/lecroy-logicstudio/protocol.h:26,
                 from src/hardware/lecroy-logicstudio/protocol.c:23:
/home/uwe/sr_mingw/include/libusb-1.0/libusb.h:1602:20: note: expected 'libusb_transfer_cb_fn' but argument is of type 'void (*)(struct libusb_transfer *)'
 static inline void libusb_fill_interrupt_transfer(
                    ^
2016-01-07 23:50:17 +01:00
Uwe Hermann d64b5f43cc sysclk-lwla: Minor whitespace and consistency fixes. 2016-01-07 23:50:17 +01:00
Uwe Hermann 0cadb8a350 Minor whitespace and cosmetic fixes. 2016-01-07 23:50:17 +01:00
Wolfram Sang 3591481e87 dmm: vc870: drop unused variable
There is no status bit for RMS. We know about RMS if certain modes are
active. So, drop this superfluous variable.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-01-05 22:25:29 +01:00
Wolfram Sang ee2e9be21b dmm: vc870: support effective voltage & current
And rename the status variable because in sigrok the term RMS is used
instead of "effective value".

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-01-05 22:25:29 +01:00
Wolfram Sang 2e1c4817c7 dmm: vc870: render POWER_FACTOR as such and not as frequency
The primary display is the power factor, the secondary is the frequency.
This got mixed up, so change the order. We also need to fix the
conversion factor.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-01-05 22:25:29 +01:00
Wolfram Sang 4867dd177f dmm: vc870: keep the order when processing modes
is_power_apparent_power is index 0 of function 0x39, so it is better to
process it first and the later indices after that (we need to add
another one with a different patch later).

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-01-05 22:25:29 +01:00
Wolfram Sang b4a0770ef8 dmm: vc870: fix AC conversion factors
Testing showed that AC current needs to be handled different from DC.
Note that ACA is still untested because of limited testing equipment.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-01-05 22:25:29 +01:00
Wolfram Sang b89462e457 dmm: vc870: show display value properly in debug output
It was confusing to see the display value (5 digits) printed in debug
output as a float. Print it the same way as shown on the real device,
without comma, of course.
This also allows to simplify the code a little.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-01-05 22:25:29 +01:00
Daniel Elstner 32ba0d8005 resource: Replace ssize_t with gssize to avoid unistd.h 2016-01-04 20:53:30 +01:00
Martin Ling c61e208d26 python: Provide sensible __str__ and __repr__ functions for enum values.
This fixes bug #668.
2016-01-04 20:49:35 +01:00
Uwe Hermann f014a8fd4c proto.h: Add missing unistd.h #include.
The ssize_t and size_t usage requires the unistd.h #include.

Thanks to Daniel Glöckner for the bug report.

This fixes bug #721.
2016-01-03 03:00:45 +01:00
Uwe Hermann e43887683c baylibre-acme: Replace g_close() with close() for now.
This g_close(), the only one in the whole code-base, would unnecessarily
raise the minimum glib version to 2.36.

Thanks to Daniel Glöckner for the report.

This fixes bug #724.
2016-01-03 02:59:00 +01:00
Daniel Elstner 8c52989811 C++: Avoid std::map::emplace() for GCC 4.7 compatibility
This fixes bug #720.
2016-01-03 00:51:37 +01:00
Uwe Hermann 6954fdbca9 src/backend.c: Add missing winsock2.h #include. 2016-01-03 00:39:44 +01:00
Martin Ling fa69e191b2 win32: Call WSAStartup() at sr_init() time.
Should fix bug #692.
2016-01-02 17:40:00 +01:00
Uwe Hermann 8141a0325c Rename sr_driver_scan_options() to sr_driver_scan_options_list(). 2015-12-31 19:04:34 +01:00
Uwe Hermann 0c697a4b33 Rename sr_dev_config_capabilities() to sr_dev_config_capabilities_list(). 2015-12-31 19:04:28 +01:00
Uwe Hermann 7d7fd93c94 Restore number "categories" in sr_configkey. 2015-12-31 19:00:16 +01:00
Martin Ling e318f01b2f Make SR_CONF_MASK an internal constant. 2015-12-31 19:00:16 +01:00
Martin Ling cffdc3e63b Make SR_CONF_{SCAN,DEVICE}_OPTIONS into internal constants.
These are no longer needed in the public API as we have new wrapper functions.
They are still used internally by drivers.
2015-12-31 19:00:16 +01:00
Martin Ling 36bb818d6f bindings: New configuration enumeration API.
The new methods wrap the new libsigrok C API helper functions and eliminate
the need to pass complex types back to the user and wrap them with SWIG.

Fixes bugs #479 and #480.
2015-12-31 19:00:16 +01:00
Martin Ling 8f3168b89b Add new sr_driver_scan_options() helper function.
This function replaces the pattern of calling config_list() with
SR_CONF_SCAN_OPTIONS to obtain a list of scan options.
2015-12-31 19:00:16 +01:00
Martin Ling e7136c626f Add new sr_dev_options() helper function.
This function replaces the pattern of calling config_list() with
SR_CONF_DEVICE_OPTIONS to obtain a list of device options. Note
that this does not include the SR_CONF_{GET,SET,LIST} bitmask,
which is now retrieved for a specific key by calling
sr_dev_config_capabilties().
2015-12-31 19:00:16 +01:00
Martin Ling 71e9c54dab Add new sr_dev_config_capabilities() helper function. 2015-12-31 19:00:15 +01:00
Martin Ling 12f2f640cb bindings: Wrap enum sr_configcap as Capability class. 2015-12-31 18:27:56 +01:00
Martin Ling c57aa1ac19 Make SR_CONF_{GET,SET,LIST} into a new enum. 2015-12-31 18:27:56 +01:00
Uwe Hermann 039a2fd78a src/usb.c: Only allow hex characters in CONN_USB_VIDPID.
(and also allow case-insensitive specification)

Thanks to Hannu Vuolasaho for the fix.
2015-12-29 13:21:01 +01:00
Wolfram Sang 52fb2d4484 modbus: silence a build warning
Refactor handling the size of modbus_devs, so it doesn't produce a build
warning and still allows the compiler to remove unused code.

This fixes bug #637. It could be reverted once modbus_devs
unconditionally has a member in the struct.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2015-12-29 13:19:36 +01:00
Uwe Hermann 0a1f7b09b3 Prefer postfix-increment for consistency across the code-base.
Only when there are technical reasons use prefix-increment.
2015-12-26 14:37:33 +01:00
Uwe Hermann a078d3ec52 korad-kaxxxxp: Add workaround for a Korad KA3005P issue.
In some situations, the reply to the *IDN? command contains an
additional trailing 0x01 byte for unknown reasons.

This issue seems to be reproducible by changing the voltage using the knobs
on the device, then turning on the output and turning it off again.

The next korad-kaxxxxp scan() operation would contain the trailing 0x01
byte, which would lead to the detection of the device in libsigrok no
longer working until the next power-cycle.

Work around this issue by treating both the ID string with and without
the trailing 0x01 byte as valid.
2015-12-25 23:29:35 +01:00
Uwe Hermann ae9ca5b1df korad-kaxxxxp: Add support for the Velleman PS3005D. 2015-12-24 01:19:11 +01:00
Daniel Elstner 1d80e1c641 sysclk-lwla: Use static array for LWLA1034 init sequence
Just as in the LWLA1016 initialization, make use of a static array
for the constant part of the LWLA1034 capture setup sequence.
2015-12-22 23:42:36 +01:00
Daniel Elstner e35a459248 sysclk-lwla: Attempt initialization three times
This is a desperate measure to improve the success rate of device
initialization even after it got into a bad state. Combine this
with a reduced USB timeout (1 second) so that if it fails, it fails
quickly. Also ignore USB errors from the initial dummy read of the
device test ID.
2015-12-22 16:09:39 +01:00