Commit Graph

3759 Commits

Author SHA1 Message Date
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
Daniel Elstner 04f2428354 sysclk-lwla: Use static array for init sequence 2015-12-22 16:09:39 +01:00
Daniel Elstner 786485772f sysclk-lwla: Work around short transfer quirk
Detect whether the FX2 firmware of the LWLA device exhibits the
short transfer bug. If so, work around the problem by limiting
reads to at most 64 bytes at a time. This slows down the memory
read after acquisition quite noticably, but makes the device
usable even in adverse conditions.
2015-12-22 16:09:39 +01:00
Daniel Elstner 940805ce7d sysclk-lwla: Skip unused registers in status poll
Reduce the number of long registers read in bulk during status
polling from 10 to 5. The LWLA1034 driver used to do that already
in an earlier iteration, which was then changed to be more like
the original vendor software. The reason for bringing it back now
is that it reduces the response size to 40 bytes, which works
around the spurious 64 byte limit bug in the FX2 firmware of the
LWLA devices.
2015-12-22 16:09:39 +01:00
Daniel Elstner ef7df53d36 sysclk-lwla: Declare model_info structs as extern
This fixes bug 714.
2015-12-22 16:08:18 +01:00
Daniel Elstner fc6cbfce2b sysclk-lwla: Close USB handle on drain error 2015-12-21 17:56:52 +01:00
Daniel Elstner 407b6e2cff sysclk-lwla: Various cosmetic improvements 2015-12-21 17:56:52 +01:00
Soeren Apel 6d2897e394 Add the Lauterbach Trace32 logic analyzer data import module 2015-12-21 16:32:49 +01:00
Soeren Apel 8a66b0777c Add RL64 and RL64S endianness helper macros 2015-12-21 16:23:44 +01:00
Soeren Apel d01c4c56d5 Whitespace fixes 2015-12-21 16:23:44 +01:00
Uwe Hermann 30726a8a32 input/raw_analog: Fix two compiler warnings.
../src/input/raw_analog.c:63:67: warning: integer overflow in expression [-Woverflow]
  { "S32_LE",     { 4, TRUE,  FALSE, FALSE, 0, TRUE, { 1, INT32_MAX+1}, { 0, 1}}},
                                                                   ^
../src/input/raw_analog.c:65:67: warning: integer overflow in expression [-Woverflow]
  { "S32_BE",     { 4, TRUE,  FALSE, TRUE,  0, TRUE, { 1, INT32_MAX+1}, { 0, 1}}},
                                                                   ^
2015-12-21 16:23:39 +01:00
Uwe Hermann 21cbe810fe input/raw_analog: Use ARRAY_SIZE. 2015-12-21 16:10:20 +01:00
Stefan Brüns 221cec31fc input/raw_analog: set scale and offset appropriately 2015-12-21 15:56:31 +01:00
Stefan Brüns e6b15cb5e6 input/raw_analog: Add input module for raw analog signals 2015-12-21 15:56:31 +01:00
Stefan Brüns 4d376e082c analog: add conversion from various integer formats to float 2015-12-21 15:53:01 +01:00
Stefan Brüns 74c9a8d2bd input/wav: initialize channel list before going into ready state
The sr_input_dev_inst_get API documentation guarantees an input is fully
initialized as soon as the device instance is returned. An sdi
implementation should not set sdi_ready any earlier.

This fixes parts of bug #387.
2015-12-21 15:37:32 +01:00
Stefan Brüns 7cccc9155c bindings/cxx: make sure the config value reference is kept
fixes glib warning:
GLib-CRITICAL **: g_variant_unref: assertion 'value->ref_count > 0' failed
2015-12-04 23:18:14 +01:00
Tilman Sauerbeck 8dd5d426f7 z60_libsigrok.rules: Add udev rule for LeCroy LogicStudio16. 2015-12-04 10:35:04 +01:00
Tilman Sauerbeck c7b17bcba3 lecroy-logicstudio: Initial driver implementation.
This supports both 8 and 16 channel modes with samplerates up to
500 MHz. Voltage thresholds are currently fixed at 1.58V.
2015-12-04 10:35:04 +01:00
Tilman Sauerbeck 17b93fd7c0 Add the RB64 macro.
Reads an unsigned 64 bit integer from memory.
2015-12-04 01:04:33 +01:00
Marcus Comstedt 8eb4299c5b bindings: Fix doc extraction for enums
The source file enum.hpp was not found when not building in the source
tree.  Also, extraction of the brief description did not work correctly
when there was additional XML markup inside the <para> element.
2015-12-03 22:01:21 +01:00
Hannu Vuolasaho 8abdf0066e korad-kaxxxxp: Workaround for Korad device bug
The sixth character from ISET? is read and discarded. If the device is
turned off and on again, this won't be there and causes 10 ms delay in
every ISET? Luckily, this value isn't queried that often. To get the
sixth byte, the *IDN? command has to be issued before ISET?.
2015-12-01 10:46:51 +01:00
Hannu Vuolasaho bcf9384d3d korad-kaxxxxp: Fix typo in Korad driver device enum 2015-12-01 10:46:40 +01:00
Stefan Brüns 17124cf9ad output/wav: use the right buffer for SR_DF_ANALOG 2015-11-29 02:30:38 +01:00
Stefan Brüns 8b5aefc681 input/wav: fix and simplify conversion of integer samples
Size of individual samples is specified by unitsize, not samplesize.
The sample immediate is not necessary.
2015-11-29 02:30:37 +01:00
Stefan Brüns b944e336d6 input/wav: increase search range for data chunk, report errors 2015-11-29 02:30:37 +01:00
Stefan Brüns 288f8ce23c input/wav: fix error in offset calculation 2015-11-29 02:30:37 +01:00
Stefan Brüns c7224164a0 output/wav: track and free memory for float conversion buffer 2015-11-29 01:14:54 +01:00
Stefan Brüns c01378c95f input: fix leak of config data in several input modules 2015-11-29 01:13:58 +01:00
Stefan Brüns da3d141f04 output: fix options memory leak 2015-11-29 01:13:58 +01:00
Stefan Brüns 2dbe445d55 output/analog: track and free memory for float conversion buffer
==18779== 800,000 bytes in 196 blocks are definitely lost in loss record 29 of 29
==18779==    at 0x4C29110: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==18779==    by 0x4E635C3: receive (analog.c:319)
==18779==    by 0x40870B: datafeed_in (session.c:316)
==18779==    by 0x4E59D4E: sr_session_send (session.c:1201)
==18779==    by 0x4E59F8B: sr_session_send (session.c:1159)
==18779==    by 0x4E62595: send_chunk (wav.c:234)
==18779==    by 0x4E62A06: process_buffer (wav.c:290)
==18779==    by 0x40954A: load_input_file_module (input.c:123)
==18779==    by 0x4097AB: load_input_file (input.c:157)
==18779==    by 0x40531E: main (main.c:288)
2015-11-29 01:13:58 +01:00
Stefan Brüns 877a6d09d5 session: free memory for datafeed callbacks, reported by valgrind
==17549== 32 (16 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record 22 of 39
==17549==    at 0x4C29110: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==17549==    by 0x5359200: g_malloc (in /usr/lib64/libglib-2.0.so.0.4200.2)
==17549==    by 0x536EE2D: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.4200.2)
==17549==    by 0x5370165: g_slist_append (in /usr/lib64/libglib-2.0.so.0.4200.2)
==17549==    by 0x4E595C3: sr_session_datafeed_callback_add (session.c:512)
==17549==    by 0x409527: load_input_file_module (input.c:111)
==17549==    by 0x4097AB: load_input_file (input.c:157)
==17549==    by 0x40531E: main (main.c:288)
2015-11-29 01:13:58 +01:00
Stefan Brüns fe7b8efc6b session: fix use after free of session->devs as reported by valgrind
==7478== Invalid write of size 8
==7478==    at 0x4E59182: sr_session_dev_remove_all (session.c:302)
==7478==    by 0x4E591CD: sr_session_destroy (session.c:265)
==7478==    by 0x4095D9: load_input_file_module (input.c:143)
==7478==    by 0x4097AB: load_input_file (input.c:157)
==7478==    by 0x40531E: main (main.c:288)
==7478==  Address 0x7877eb8 is 88 bytes inside a block of size 96 free'd
==7478==    at 0x4C2A37C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7478==    by 0x4E5F454: sr_input_free (input.c:573)
==7478==    by 0x4095C3: load_input_file_module (input.c:140)
==7478==    by 0x4097AB: load_input_file (input.c:157)
==7478==    by 0x40531E: main (main.c:288)
2015-11-29 01:13:58 +01:00
Uwe Hermann b3cfc6e98e Make all sizeof() consistently use parenthesis. 2015-11-29 00:23:53 +01:00
Daniel Elstner 09ffac33b7 sysclk-lwla: Simplify trigger mask generation 2015-11-28 23:27:45 +01:00
Daniel Elstner 93ed0241aa sysclk-lwla: Drain pending replies on initialization
When opening the device, drain any pending data from the USB
buffers so that the device won't get stuck on crashes etc.
2015-11-28 23:27:45 +01:00
Daniel Elstner 567674b4f8 sysclk-lwla: Remove double USB set configuration
This was a pointless attempt to make the reset hiccups go away.
It didn't help, the problem must be something else.
2015-11-27 21:26:13 +01:00
Daniel Elstner 7ed808179f sysclk-lwla: Cut down on size_t overuse
Do not use size_t for values whose width is defined by the device,
not the host. Also don't use size_t for simple indices with known
small range, unless type compatibility considerations apply.
2015-11-27 15:07:56 +01:00