]> sigrok.org Git - libsigrok.git/log
libsigrok.git
8 years agosrzip: zip_append_analog(): Fix memory leaks
Lars-Peter Clausen [Thu, 28 Apr 2016 15:44:29 +0000 (17:44 +0200)]
srzip: zip_append_analog(): Fix memory leaks

zip_append_analog() does not free most of the memory it allocates. Address
this by moving all sanity checks that do not rely on anything else at the
beginning of the function before any allocations are done. And then make
sure to properly free all allocated memory on all paths leaving the
function.

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agosrzip: Fix handling of analog channels with index 0
Lars-Peter Clausen [Thu, 28 Apr 2016 15:43:15 +0000 (17:43 +0200)]
srzip: Fix handling of analog channels with index 0

0 is a valid index for a channel. Using it as the value for the terminating
entry of analog_index_map causes zip_append_analog() to falsely assume that
no channel was found when a packet for a channel with index 0 was received.
This prevents the data for the channel to be added to the sigrok session
file.

Instead use -1, which is not a valid channel index, as
the terminating entry value.

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agogitignore: Add files generated when building Ruby bindings
Marvin Schmidt [Fri, 13 May 2016 10:35:03 +0000 (12:35 +0200)]
gitignore: Add files generated when building Ruby bindings

8 years agobuild: Replace AX_CXX_COMPILE_STDCXX_11 with latest AX_CXX_COMPILE_STDCXX
Marvin Schmidt [Fri, 13 May 2016 10:27:14 +0000 (12:27 +0200)]
build: Replace AX_CXX_COMPILE_STDCXX_11 with latest AX_CXX_COMPILE_STDCXX

The former appended the necessary switch to enable C++11 to the CXXFLAGS
whereas AX_CXX_COMPILE_STDCXX appends it to CXX which has the benefit
that all C++ sources are compiled using the same C++ standard. Therefore
it is no longer necessary to manually hardcode '-std=c++11' anywhere
like we did in the Ruby bindings linker command and assures that the
compilation of them is done with C++11 support as well.

This fixes bug #795

8 years agobuild: Fix distribution of Ruby bindings
Marvin Schmidt [Fri, 13 May 2016 15:44:12 +0000 (17:44 +0200)]
build: Fix distribution of Ruby bindings

The bindings file was not listed in EXTRA_DIST and therefore not
distributed. We also need to provide an target to uninstall the Ruby
bindings and add it to UNINSTALL_EXTRA in order to make `make distcheck`
happy.

This fixes bug #741

8 years agoruby: Fix out-of-tree build of the bindings.
Aurelien Jacobs [Thu, 12 May 2016 21:08:21 +0000 (23:08 +0200)]
ruby: Fix out-of-tree build of the bindings.

This closes bug #797.

8 years agoscan(): Consistently start out with SR_ST_INACTIVE.
Uwe Hermann [Sat, 23 Apr 2016 19:27:59 +0000 (21:27 +0200)]
scan(): Consistently start out with SR_ST_INACTIVE.

A later call to open() will set the status to SR_ST_ACTIVE.

Only in the case of firmware/bitstream upload start with
SR_ST_INITIALIZING first.

8 years agofx2lafw: Fix a -Wself-assign compiler warning.
Uwe Hermann [Wed, 11 May 2016 20:24:59 +0000 (22:24 +0200)]
fx2lafw: Fix a -Wself-assign compiler warning.

This closes bug #793.

8 years agoRemove unnecessary std_init() wrapper functions
Lars-Peter Clausen [Sun, 8 May 2016 13:23:13 +0000 (15:23 +0200)]
Remove unnecessary std_init() wrapper functions

Now that the signature of std_init() matches that of the driver init()
callback we can remove all wrapper functions around std_init() and use it
directly as the init() callback.

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agostd_init(): Drop check if pass in driver is non-NULL
Lars-Peter Clausen [Sun, 8 May 2016 13:47:31 +0000 (15:47 +0200)]
std_init(): Drop check if pass in driver is non-NULL

std_init() checks if the pass in struct sr_dev_driver is non-NULL and
prints a error message and returns an error if it is NULL.

std_init() is exclusively called from driver init() callbacks for which the
core already checks if the struct sr_dev_driver is non-NULL before invoking
the callback. This means the check in std_init() will always evaluate to
false. So drop this check.

This also means that the prefix parameter that was used in the error
message is no longer needed and can be removed from the function signature.
Doing so will make the std_init() function signature identical to the
init() callback signature which will allow to directly use it as such.

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agoMatch std_init() parameter order to the driver init() callback
Lars-Peter Clausen [Sun, 8 May 2016 12:55:15 +0000 (14:55 +0200)]
Match std_init() parameter order to the driver init() callback

The std_init() callback has the order of the first two paramters opposite
to the init() callback. This is primarily due to historical development.

Since the std_init() function is usually called from a driver's init()
callback aligning the order will allow direct register pass through rather
than having to swap them around. It also allow to eventually use the
std_init() function directly as the init() callback.

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agozeroplus-logic-cube: Fix USB device list
Lars-Peter Clausen [Fri, 6 May 2016 11:27:09 +0000 (13:27 +0200)]
zeroplus-logic-cube: Fix USB device list

The zeroplus-logic-cube driver uses libusb_get_device_list() but neglects
to call the matching libusb_device_list_free() on the error path. This will
leak the memory allocated for the list as well as all the devices.

To address the issue use sr_usb_open() instead of open-coding its
functionality. sr_usb_open() correctly handles freeing the device list.

The issue was discovered using the following coccinelle semantic patch:
// <smpl>
@@
identifier devlist;
expression ctx, ret;
statement S;
@@
(
 libusb_get_device_list(ctx, &devlist);
|
 ret = libusb_get_device_list(ctx, &devlist);
 if (ret < 0) S
)
... when != libusb_free_device_list(devlist, ...)
*return ...;
// </smpl>

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agovictor-dmm: Fix USB device list leak
Lars-Peter Clausen [Fri, 6 May 2016 11:26:02 +0000 (13:26 +0200)]
victor-dmm: Fix USB device list leak

The victor-dmm driver uses libusb_get_device_list() but neglects to call
the matching libusb_device_list_free() on the error path of libusb_open().
This will leak the memory allocated for the list as well as all the
devices.

To address the issue use sr_usb_open() instead of open-coding its
functionality. sr_usb_open() correctly handles freeing the device list.

The issue was discovered using the following coccinelle semantic patch:
// <smpl>
@@
identifier devlist;
expression ctx, ret;
statement S;
@@
(
 libusb_get_device_list(ctx, &devlist);
|
 ret = libusb_get_device_list(ctx, &devlist);
 if (ret < 0) S
)
... when != libusb_free_device_list(devlist, ...)
*return ...;
// </smpl>

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agotesto: Fix USB device list leak
Lars-Peter Clausen [Fri, 6 May 2016 11:25:14 +0000 (13:25 +0200)]
testo: Fix USB device list leak

The testo driver uses libusb_get_device_list() but neglects to call the
matching libusb_device_list_free() on the error path. This will leak the
memory allocated for the list as well as all the devices.

To address the issue use sr_usb_open() instead of open-coding its
functionality. sr_usb_open() correctly handles freeing the device list.

The issue was discovered using the following coccinelle semantic patch:
// <smpl>
@@
identifier devlist;
expression ctx, ret;
statement S;
@@
(
 libusb_get_device_list(ctx, &devlist);
|
 ret = libusb_get_device_list(ctx, &devlist);
 if (ret < 0) S
)
... when != libusb_free_device_list(devlist, ...)
*return ...;
// </smpl>

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agolascar-el-usb: lascar_scan(): Fix USB device list leak
Lars-Peter Clausen [Fri, 6 May 2016 11:22:19 +0000 (13:22 +0200)]
lascar-el-usb: lascar_scan(): Fix USB device list leak

lascar_scan() calls libusb_get_device_list() but never the matching
libusb_free_device_list(). This will leak the memory allocated for the
device list as well as all the devices. To fix this add the missing
libusb_free_device_list().

While we are at it also make sure to handle errors returned by
libusb_get_device_list().

The issue was discovered using the following coccinelle semantic patch:
// <smpl>
@@
identifier devlist;
expression ctx, ret;
statement S;
@@
(
 libusb_get_device_list(ctx, &devlist);
|
 ret = libusb_get_device_list(ctx, &devlist);
 if (ret < 0) S
)
... when != libusb_free_device_list(devlist, ...)
*return ...;
// </smpl>

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agoInput/trace32_ad: Make the sample rate an option
Soeren Apel [Mon, 2 May 2016 19:49:00 +0000 (21:49 +0200)]
Input/trace32_ad: Make the sample rate an option

8 years agoInput/wav: Add reset() function
Soeren Apel [Mon, 2 May 2016 16:17:34 +0000 (18:17 +0200)]
Input/wav: Add reset() function

8 years agoInput/vcd: Add reset() function
Soeren Apel [Mon, 2 May 2016 16:16:38 +0000 (18:16 +0200)]
Input/vcd: Add reset() function

8 years agoInput/trace32_ad: Add reset() function
Soeren Apel [Mon, 2 May 2016 16:16:21 +0000 (18:16 +0200)]
Input/trace32_ad: Add reset() function

8 years agoInput/raw_analog: Add reset() function
Soeren Apel [Mon, 2 May 2016 16:16:09 +0000 (18:16 +0200)]
Input/raw_analog: Add reset() function

8 years agoInput/csv: Add reset() function
Soeren Apel [Mon, 2 May 2016 16:10:55 +0000 (18:10 +0200)]
Input/csv: Add reset() function

8 years agoInput/chronovu_la8: Add reset() function
Soeren Apel [Mon, 2 May 2016 16:02:31 +0000 (18:02 +0200)]
Input/chronovu_la8: Add reset() function

8 years agoInput/binary: Add reset() function
Soeren Apel [Mon, 2 May 2016 16:01:10 +0000 (18:01 +0200)]
Input/binary: Add reset() function

8 years agoInput: Add reset() function
Soeren Apel [Thu, 28 Apr 2016 06:13:17 +0000 (08:13 +0200)]
Input: Add reset() function

8 years agoBindings: Check for empty opts also in Configurable::config_keys()
Soeren Apel [Tue, 26 Apr 2016 16:07:03 +0000 (18:07 +0200)]
Bindings: Check for empty opts also in Configurable::config_keys()

8 years agobaylibre-acme: Drop unused last_sample_fin variable.
Uwe Hermann [Mon, 9 May 2016 10:41:50 +0000 (12:41 +0200)]
baylibre-acme: Drop unused last_sample_fin variable.

8 years agovictor-dmm: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:55:51 +0000 (13:55 +0200)]
victor-dmm: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agouni-t-dmm: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:55:39 +0000 (13:55 +0200)]
uni-t-dmm: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agotondaj-sl-814: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:55:28 +0000 (13:55 +0200)]
tondaj-sl-814: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agotesto: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:55:12 +0000 (13:55 +0200)]
testo: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agoteleinfo: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:54:26 +0000 (13:54 +0200)]
teleinfo: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agoserial-dmm: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:54:14 +0000 (13:54 +0200)]
serial-dmm: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agonorma-dmm: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:54:02 +0000 (13:54 +0200)]
norma-dmm: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agomotech-lps-30x: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:53:51 +0000 (13:53 +0200)]
motech-lps-30x: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agomic-985xx: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:53:39 +0000 (13:53 +0200)]
mic-985xx: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agomaynuo-m97: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:57:30 +0000 (13:57 +0200)]
maynuo-m97: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agomanson-hcs-3xxx: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:53:23 +0000 (13:53 +0200)]
manson-hcs-3xxx: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agokorad-kaxxxxp: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:53:08 +0000 (13:53 +0200)]
korad-kaxxxxp: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agokern-scale: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:52:50 +0000 (13:52 +0200)]
kern-scale: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agocolead-slm: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:52:35 +0000 (13:52 +0200)]
colead-slm: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agocenter-3xx: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:52:22 +0000 (13:52 +0200)]
center-3xx: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agobrymen-dmm: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:52:09 +0000 (13:52 +0200)]
brymen-dmm: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agobrymen-bm86x: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:51:52 +0000 (13:51 +0200)]
brymen-bm86x: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agobaylibre-acme: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:56:57 +0000 (13:56 +0200)]
baylibre-acme: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agoappa-55ii: Use software limit helpers
Lars-Peter Clausen [Sun, 1 May 2016 11:51:08 +0000 (13:51 +0200)]
appa-55ii: Use software limit helpers

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agoAdd helper functions for software limits
Lars-Peter Clausen [Sun, 1 May 2016 11:50:08 +0000 (13:50 +0200)]
Add helper functions for software limits

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agoudev rules file: Add entry for Sainsmart DDS120.
Benjamin Larsson [Sun, 24 Apr 2016 15:55:39 +0000 (17:55 +0200)]
udev rules file: Add entry for Sainsmart DDS120.

8 years agotesto: Minor code cleanup.
Bert Vermeulen [Tue, 3 May 2016 20:09:39 +0000 (22:09 +0200)]
testo: Minor code cleanup.

8 years agoRemove unnecessary driver context checks
Lars-Peter Clausen [Mon, 2 May 2016 11:24:04 +0000 (13:24 +0200)]
Remove unnecessary driver context checks

Some drivers check in some of their driver callbacks if the driver has been
initialized and return an error if it has not.

For the scan() callback the sigrok core checks if the driver has been
initialized and if not returns an error. So it is not possible that the
scan() callback gets called if the driver is not initialized. Without the
scan() callback succeeding it is not possible to get a reference to a
device which is associated with the driver, so it is not possible that any
of the device specific callbacks is called without the driver first being
initialized either.

In conclusion these checks are not necessary since they never evaluate to
true and can be dropped. If they should ever become necessary they should
be done in the sigrok core so all drivers and all callbacks are equally
handled.

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agoDrop SR_CONF_SET flag from SR_CONF_CONTINUOUS options
Lars-Peter Clausen [Mon, 2 May 2016 11:22:46 +0000 (13:22 +0200)]
Drop SR_CONF_SET flag from SR_CONF_CONTINUOUS options

SR_CONF_CONTINUOUS is a capability option indicating whether a device
supports continuous capture or not. If the option exists the device
supports continuous capture and otherwise it doesn't. There is no value
associated with it and hence setting the SR_CONF_SET flag is nonsensical.

None of the drivers which set SR_CONF_SET for SR_CONF_CONTINUOUS handle it
in their config_set() callback and return an error if an application tried
to perform a config_set() operation for SR_CONF_CONTINUOUS.

Simply remove the SR_CONF_SET flag from all SR_CONF_CONTINUOUS options.

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agoIntroduce standard implementation of the dev_list() callback
Lars-Peter Clausen [Fri, 29 Apr 2016 13:47:04 +0000 (15:47 +0200)]
Introduce standard implementation of the dev_list() callback

Every single hardware driver has the very same implementation of the
dev_list() callback. Put this into a helper function in the standard helper
library and use it throughout the drivers. This reduces boiler-plate code
by quite a bit.

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agoRemove unnecessary dev_clear() callbacks
Lars-Peter Clausen [Fri, 29 Apr 2016 12:26:00 +0000 (14:26 +0200)]
Remove unnecessary dev_clear() callbacks

If a driver does not implement a dev_clear() callback the core will
automatically call std_dev_clear(di, NULL). Remove all driver dev_clear()
implementations that are identical to default. This reduces the amount of
boiler-plate code.

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agoIntroduce standard cleanup helper
Lars-Peter Clausen [Fri, 29 Apr 2016 11:36:05 +0000 (13:36 +0200)]
Introduce standard cleanup helper

std_init() allocates a drv_context struct which needs to be freed by the
driver in its cleanup struct. But the vast majority of drivers does never
does this causing memory leaks.

Instead of addressing the issue by manually adding code to free the struct
to each driver introduce a new helper function std_cleanup() that takes
care of this. In addition to freeing the drv_context struct std_cleanup()
also invokes sr_dev_clear() which takes care of freeing all devices
attached to the driver.

Combining both operations in the same helper function allows to use
std_cleanup() as the cleanup callback for all existing drivers, which
reduces the amount of boiler-plate code quite a bit.

All drivers are updated to use the new helper function.

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agoscpi-pps: Fix dev_clear() implementation
Lars-Peter Clausen [Fri, 29 Apr 2016 14:37:36 +0000 (16:37 +0200)]
scpi-pps: Fix dev_clear() implementation

Devices for the scpi-pps driver do have additional data attached to it that
needs to be freed when the device is freed. While the driver gets it right
for the cleanup() callback it does not for the dev_clear() callback. This
will cause memory leaks when sr_dev_clear() is called for this driver.

To fix this let the dev_clear() free the additional data.

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agoderee-de5000: Provide dev_clear()
Lars-Peter Clausen [Fri, 29 Apr 2016 14:23:17 +0000 (16:23 +0200)]
deree-de5000: Provide dev_clear()

Devices for the deree-de5000 driver do have additional data attached to it
that needs to be freed when the device is freed. While the driver gets it
right for the cleanup() callback it does not implement a dev_clear()
callback, so the default dev_clear() implementation is used which will not
free the additional data. This will cause memory leaks when sr_dev_clear()
is called for this driver.

To fix this provide a dev_clear() implementation that frees the additional
data.

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agodemo: Provide dev_clear()
Lars-Peter Clausen [Fri, 29 Apr 2016 14:28:59 +0000 (16:28 +0200)]
demo: Provide dev_clear()

Devices for the demo driver do have additional data attached to it that
needs to be freed when the device is freed. While the driver gets it right
for the cleanup() callback it does not implement a dev_clear() callback, so
the default dev_clear() implementation is used which will not free the
additional data. This will cause memory leaks when sr_dev_clear() is called
for this driver.

To fix this provide a dev_clear() implementation that frees the additional
data.

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agobeaglelogic: Use std_dev_clear() instead of open-coding it
Lars-Peter Clausen [Fri, 29 Apr 2016 12:08:42 +0000 (14:08 +0200)]
beaglelogic: Use std_dev_clear() instead of open-coding it

The beaglelogic has an open-coded version of std_dev_clear(), replace it
with std_dev_clear().

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agobaylibre-acme: Properly free GErrors returned by g_file_get_contents()
Lars-Peter Clausen [Fri, 29 Apr 2016 08:25:18 +0000 (10:25 +0200)]
baylibre-acme: Properly free GErrors returned by g_file_get_contents()

When g_file_get_contents() encounters an error a new GError will be
allocated and passed back to the application. The application is
responsible for freeing this GError.

The baylibre-acme driver currently does not do this and as a result leaks
memory during the scan process when no device is found.

Add the missing g_error_free() invocations to fix the issue.

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agoftdi-la: Properly cleanup in scan_all()
Lars-Peter Clausen [Fri, 29 Apr 2016 16:07:54 +0000 (18:07 +0200)]
ftdi-la: Properly cleanup in scan_all()

Make sure to free the FTDI device list and the FTDI context in scan_all()
otherwise memory leaks can be observed. Also make sure to free the FTDI
context in scan_device() on the error path.

Signed-off-by: Lars-Peter Clausen <redacted>
8 years agodev_open(): Don't check for sdi != NULL.
Uwe Hermann [Sat, 23 Apr 2016 18:58:46 +0000 (20:58 +0200)]
dev_open(): Don't check for sdi != NULL.

The wrapper guarantees that sdi is not NULL.

8 years agoDrop some unused or duplicated code.
Uwe Hermann [Sat, 23 Apr 2016 18:59:38 +0000 (20:59 +0200)]
Drop some unused or duplicated code.

8 years agocem-dt-885x/colead-slm: Use std_serial_dev_open().
Uwe Hermann [Sun, 24 Apr 2016 18:17:49 +0000 (20:17 +0200)]
cem-dt-885x/colead-slm: Use std_serial_dev_open().

8 years agoRandom cosmetics and whitespace fixes.
Uwe Hermann [Fri, 22 Apr 2016 15:55:44 +0000 (17:55 +0200)]
Random cosmetics and whitespace fixes.

8 years agouni-t-ut32x: Fix copy-paste error.
Uwe Hermann [Wed, 20 Apr 2016 20:12:52 +0000 (22:12 +0200)]
uni-t-ut32x: Fix copy-paste error.

8 years agodev_acquisition_start(): Ensure that sdi is always != NULL.
Uwe Hermann [Fri, 15 Apr 2016 14:26:43 +0000 (16:26 +0200)]
dev_acquisition_start(): Ensure that sdi is always != NULL.

8 years agoDrop some obsolete and unneeded comments.
Uwe Hermann [Wed, 13 Apr 2016 20:28:44 +0000 (22:28 +0200)]
Drop some obsolete and unneeded comments.

8 years agostd_serial_dev_acquisition_stop(): Drop unneeded parameter.
Uwe Hermann [Wed, 13 Apr 2016 20:11:22 +0000 (22:11 +0200)]
std_serial_dev_acquisition_stop(): Drop unneeded parameter.

8 years agodev_acquisition_{start,stop}(): Drop duplicate 'cb_data' parameter.
Uwe Hermann [Sun, 27 Mar 2016 22:40:16 +0000 (00:40 +0200)]
dev_acquisition_{start,stop}(): Drop duplicate 'cb_data' parameter.

These are always 'sdi', which is passed in already.

8 years agoConsistently don't check sdi->priv in dev_acquisition_start().
Uwe Hermann [Sun, 27 Mar 2016 21:16:59 +0000 (23:16 +0200)]
Consistently don't check sdi->priv in dev_acquisition_start().

Most drivers already assume this to be != NULL anyway, and the check
should probably be in the API wrappers anyway.

8 years agoDrop unneeded std_session_send_df_header() comments.
Uwe Hermann [Sun, 27 Mar 2016 20:53:02 +0000 (22:53 +0200)]
Drop unneeded std_session_send_df_header() comments.

8 years agoFactor out std_session_send_df_end() helper.
Uwe Hermann [Sat, 26 Mar 2016 18:45:04 +0000 (19:45 +0100)]
Factor out std_session_send_df_end() helper.

This makes the code shorter, simpler and more consistent, and also
ensures that the (same) debug messages are always emitted and the
packet.payload field is consistently set to NULL always, etc.

8 years agofx2lafw: Add working glue layer for frontends
Benjamin Larsson [Mon, 25 Apr 2016 21:46:19 +0000 (23:46 +0200)]
fx2lafw: Add working glue layer for frontends

8 years agofx2lafw: Add analog sampling handler
Joel Holdsworth [Mon, 25 Apr 2016 19:41:57 +0000 (21:41 +0200)]
fx2lafw: Add analog sampling handler

This will be needed for the MSO support of the CWAV USBee AX and clones.

8 years agofx2lafw: Factor out packet sending
Joel Holdsworth [Sun, 24 Apr 2016 21:06:28 +0000 (23:06 +0200)]
fx2lafw: Factor out packet sending

This will make it possible to use different senders based on
driver mode. This is needed for USBee AX support.

8 years agofx2lafw: Add CTL2 clocking command flag to header
Joel Holdsworth [Sun, 24 Apr 2016 18:38:12 +0000 (20:38 +0200)]
fx2lafw: Add CTL2 clocking command flag to header

The USBee AX hardware needs a sampling clock that is lower than
the 30MHz or 48MHz that the FX2 has to offer. This flag will enable
clocking via the CTL2 pin that is an even divisor of the main clock.

8 years agofx2lafw: Add support for AX analog channel probing
Joel Holdsworth [Sun, 24 Apr 2016 18:35:07 +0000 (20:35 +0200)]
fx2lafw: Add support for AX analog channel probing

8 years agohwdriver.c: Add missing SR_MQFLAG_FOUR_WIRE entry.
Uwe Hermann [Sat, 23 Apr 2016 15:45:49 +0000 (17:45 +0200)]
hwdriver.c: Add missing SR_MQFLAG_FOUR_WIRE entry.

8 years agohp-3457a: Implement support for rear terminals and plug-in cards
Alexandru Gagniuc [Mon, 4 Apr 2016 01:45:25 +0000 (18:45 -0700)]
hp-3457a: Implement support for rear terminals and plug-in cards

8 years agohp-3457a: Implement AC, ACDC, and four-wire resistance modes
Alexandru Gagniuc [Mon, 4 Apr 2016 01:38:53 +0000 (18:38 -0700)]
hp-3457a: Implement AC, ACDC, and four-wire resistance modes

The driver did not look at the mq_flags provided with the
SR_CONF_MEASURED_QUANTITY key, and it defaulted to DC measurements.
Use the second member of the tuple provided by the config key, which
represents the flags for the measurement, and set the instrument's
measurement mode accordingly.

8 years agoanalog: Add MQ Flag for four-wire measurements
Alexandru Gagniuc [Mon, 4 Apr 2016 01:04:42 +0000 (18:04 -0700)]
analog: Add MQ Flag for four-wire measurements

On the high-end bench multimeters, resistance can be measured with a
kelvin connection as well as the more common two wire method. Provide
a flag which can indicate if four-wire mode is used.

8 years agohp-3457a: Do not retrigger new measurement after the last sample
Alexandru Gagniuc [Sat, 9 Apr 2016 17:07:55 +0000 (10:07 -0700)]
hp-3457a: Do not retrigger new measurement after the last sample

Due to a PEBKAC error, after the last sample was sent, a new
measurement was triggered, but its value was never sent down the
session bus. This is easily fixed by incrementing devc->num_samples
right after a measurement is sent instead of when a measurement is
retriggered.

8 years agoftdi-la: added support for the device selection
Sergey Alirzaev [Mon, 18 Apr 2016 22:38:51 +0000 (01:38 +0300)]
ftdi-la: added support for the device selection

Tested on FT232RL and FT2232H both attached to the same PC.

8 years agohantek-6xxx: fix memory leaks
Benjamin Larsson [Tue, 12 Apr 2016 21:47:34 +0000 (23:47 +0200)]
hantek-6xxx: fix memory leaks

Free the first flush packet and the driver context when closing.

8 years agomemory leak fix: g_variant_print() usage fix
Benjamin Larsson [Tue, 12 Apr 2016 18:25:01 +0000 (20:25 +0200)]
memory leak fix: g_variant_print() usage fix

g_variant_print() allocates memory during call. Save the pointer
so that it can be free'd afterwards.

==10048== 16 bytes in 1 blocks are definitely lost in loss record 17 of 37
==10048==    at 0x4C2DEAE: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10048==    by 0x536C85D: g_realloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4400.1)
==10048==    by 0x53877C6: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4400.1)
==10048==    by 0x5388B60: g_string_append_vprintf (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4400.1)
==10048==    by 0x5388D83: g_string_append_printf (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4400.1)
==10048==    by 0x539D034: g_variant_print_string (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4400.1)
==10048==    by 0x539C92C: g_variant_print (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4400.1)
==10048==    by 0x4E5F713: log_key (hwdriver.c:597)
==10048==    by 0x4E5FCD5: sr_config_set (hwdriver.c:752)
==10048==    by 0x408C1A: run_session (session.c:661)
==10048==    by 0x404FC5: main (main.c:267)
==10048==
==10048== 16 bytes in 1 blocks are definitely lost in loss record 18 of 37
==10048==    at 0x4C2DEAE: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10048==    by 0x536C85D: g_realloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4400.1)
==10048==    by 0x53877C6: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4400.1)
==10048==    by 0x5388B60: g_string_append_vprintf (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4400.1)
==10048==    by 0x5388D83: g_string_append_printf (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4400.1)
==10048==    by 0x539D034: g_variant_print_string (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4400.1)
==10048==    by 0x539C92C: g_variant_print (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4400.1)
==10048==    by 0x4E5F713: log_key (hwdriver.c:597)
==10048==    by 0x4E5FBDD: sr_config_get (hwdriver.c:709)
==10048==    by 0x4080D7: datafeed_in (session.c:196)
==10048==    by 0x4E5D47E: sr_session_send (session.c:1192)
==10048==    by 0x4E62682: std_session_send_df_header (std.c:101)

8 years agohantek-6xxx: Use power of 2 usb packet sizes
Markus Siegert [Mon, 11 Apr 2016 19:54:10 +0000 (21:54 +0200)]
hantek-6xxx: Use power of 2 usb packet sizes

Using non power of 2 sizes causes the driver to not work on OS X.
Depending on the usb transfer mode the buffer sizes will map
perfectly to the underlying transport protocol.

8 years agohantek-6xxx: use 1D50:608E for Sainsmart DDS-120
Markus Siegert [Sun, 10 Apr 2016 20:27:11 +0000 (22:27 +0200)]
hantek-6xxx: use 1D50:608E for Sainsmart DDS-120

8 years agohantek-6xxx: add coupling support
Benjamin Larsson [Mon, 4 Apr 2016 19:44:00 +0000 (21:44 +0200)]
hantek-6xxx: add coupling support

Sainsmart DDS-120 supports AC or DC coupling. Add driver support
to control that feature.

8 years agohantek-6xxx: store the amount samples received
Benjamin Larsson [Mon, 4 Apr 2016 17:57:50 +0000 (19:57 +0200)]
hantek-6xxx: store the amount samples received

8 years agohantek-6xxx: positive return code is not an error
Benjamin Larsson [Mon, 4 Apr 2016 17:55:07 +0000 (19:55 +0200)]
hantek-6xxx: positive return code is not an error

8 years agohantek-6xxx: Add support for Sainsmart DDS120
Benjamin Larsson [Fri, 1 Apr 2016 21:26:00 +0000 (23:26 +0200)]
hantek-6xxx: Add support for Sainsmart DDS120

8 years agoFix two compiler warnings.
Uwe Hermann [Sat, 23 Apr 2016 15:37:01 +0000 (17:37 +0200)]
Fix two compiler warnings.

8 years agohameg-hmo: Also start reading on timeout (workaround for USBTMC)
Stefan Brüns [Sun, 17 Apr 2016 17:14:27 +0000 (19:14 +0200)]
hameg-hmo: Also start reading on timeout (workaround for USBTMC)

scpi_serial generate an POLLIN event after the requested data is returned
by the instrument. For USBTMC it is necessary to
1. send an REQUEST_DEV_DEP_MSG_IN request
2. submit an USB bulk read transfer asynchronously.

Using the synchronous libusb_bulk_read() does not generate an POLLIN event.

Solving this properly needs major surgery in spci_usbtmc_libusb.

8 years agospci: Terminate all commands with a linefeed for all transports
Stefan Brüns [Sat, 16 Apr 2016 21:38:05 +0000 (23:38 +0200)]
spci: Terminate all commands with a linefeed for all transports

While some transports add a terminating (carriagereturn+)linefeed
unconditionally, the USBTMC transport does not. At least the R&S HMO1002
requires the linefeed and locks up otherwise. Fixes bug #784.

This changes the TCP and VXI transport from CR+LF to LF only.

Also fixes a possible memory leak for VXI, where the temporary command
buffer was not freed in case of a write error.

8 years agoscpi/usbtmc: fix remote locking according to USBTMC spec
Stefan Brüns [Sat, 16 Apr 2016 21:37:40 +0000 (23:37 +0200)]
scpi/usbtmc: fix remote locking according to USBTMC spec

According to USBTMC usb488 subclass spec, wValue hast to be 0 for both
LOCAL_LOCKOUT and GO_TO_LOCAL. At least required for R&S HMO1002, the
bad request results in a STALL. Fixes bug #783.

8 years agoWorking trigger on rising and falling edges.
Diego F. Asanza [Tue, 19 Apr 2016 20:27:15 +0000 (22:27 +0200)]
Working trigger on rising and falling edges.

8 years agofx2lafw: Only run dslogic_stop_acquisition() on DSLogic.
Uwe Hermann [Sun, 17 Apr 2016 13:49:47 +0000 (15:49 +0200)]
fx2lafw: Only run dslogic_stop_acquisition() on DSLogic.

8 years agoEnsure DSLogic can be stopped.
Diego F. Asanza [Wed, 13 Apr 2016 18:50:37 +0000 (20:50 +0200)]
Ensure DSLogic can be stopped.

After acquisition start, DSLogic stores samples in memory, and when done it
sends a USB packet with the trigger position.

This initial fillup can take some time. If the user requests a session stop
in between, the USB transfer is cancelled and the session hangs because it
is not closed properly.

This commit manages this case and closes the session properly when
acquisition is stopped by the user.

Signed-off-by: Diego F. Asanza <redacted>
8 years agoftdi-la: order the channels properly
Sergey Alirzaev [Thu, 14 Apr 2016 11:17:49 +0000 (14:17 +0300)]
ftdi-la: order the channels properly

8 years agoudev: Add DSLogic Pro rule
Andrew Bradford [Fri, 15 Apr 2016 15:28:51 +0000 (11:28 -0400)]
udev: Add DSLogic Pro rule

Signed-off-by: Andrew Bradford <redacted>
8 years agocontrib: add udev rules for HAMEG HO720/HO730
Stefan Brüns [Tue, 12 Apr 2016 02:17:28 +0000 (04:17 +0200)]
contrib: add udev rules for HAMEG HO720/HO730