For session sources without a file descriptor to poll a negative number
should be passed for the fd parameter. The hung-chang-dso-2100 driver
currently passes 0 instead, which is the stdin stream. Fix the issue by
passing -1 for the fd parameter.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
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>
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>
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>
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>
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>
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>
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.
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(
^
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>
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>
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>
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>
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>
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.
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.
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().
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>