]> sigrok.org Git - libsigrok.git/log
libsigrok.git
7 years agoscpi-pps: Add profile for HP 6633A supply
Alexandru Gagniuc [Sun, 8 May 2016 19:57:06 +0000 (12:57 -0700)]
scpi-pps: Add profile for HP 6633A supply

Oldie but goodie. Some of the HP 6632B options are renamed for
clarity, as they are common among the A and B variants.

7 years agoscpi-pps: Add shadow driver for HPIB supplies (ID? instead of *IDN?)
Alexandru Gagniuc [Sun, 8 May 2016 19:30:51 +0000 (12:30 -0700)]
scpi-pps: Add shadow driver for HPIB supplies (ID? instead of *IDN?)

HP instruments predating the 488.2 and SCPI standards do not
necessarily have a SCPI-compliant command set. The HP6630A series of
supplies is one such example.

While scpi-pps is flexible enough to accomodate almost any command
syntax given the right profile, it still assumes that "*IDN?" is the
correct question to ask the instrument. Since older HP gear instead
responds to "ID?", this assumption is no longer true.

Thus sr_scpi_get_hw_id() is not appropriate for these instruments, and
the shadow driver added here only replaces that function call, while
reusing the rest of the existing logic. The extra noise is necessary
in order to propagate this through the .scan member of the driver.

7 years agosaleae-logic16: Consolidate the samplerate limits into a single bitrate cap
Marcus Comstedt [Wed, 18 May 2016 21:10:46 +0000 (23:10 +0200)]
saleae-logic16: Consolidate the samplerate limits into a single bitrate cap

7 years agosaleae-logic16: Add 20MHz and 50MHz to samplerate preset list (bug #799)
Marcus Comstedt [Wed, 18 May 2016 21:08:42 +0000 (23:08 +0200)]
saleae-logic16: Add 20MHz and 50MHz to samplerate preset list (bug #799)

7 years agopce-322a: Initial driver implementation.
George Hopkins [Sat, 30 Apr 2016 20:34:15 +0000 (22:34 +0200)]
pce-322a: Initial driver implementation.

7 years agoftdi-la: Use the standard connection_id field for the device address
Lars-Peter Clausen [Sat, 14 May 2016 15:24:27 +0000 (17:24 +0200)]
ftdi-la: Use the standard connection_id field for the device address

Use the standard connection_id field from the struct sr_dev_inst for
storing the device address rather than using the custom address field in
the driver state struct. This makes things more consistent with the
framework.

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agoftdi-la: Cleanup ftdi_context handling
Lars-Peter Clausen [Sat, 14 May 2016 15:24:27 +0000 (17:24 +0200)]
ftdi-la: Cleanup ftdi_context handling

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agolascar-el-usb: Add a missing SR_PRIV.
Uwe Hermann [Sat, 14 May 2016 11:35:28 +0000 (13:35 +0200)]
lascar-el-usb: Add a missing SR_PRIV.

7 years agoPut driver pointers into special section
Lars-Peter Clausen [Thu, 12 May 2016 13:13:47 +0000 (15:13 +0200)]
Put driver pointers into special section

The sigrok core needs a list of all available drivers. Currently this list
is manually maintained by updating a global list whenever a driver is added
or removed.

Introduce a new special section that contains the list of all drivers. The
SR_REGISTER_DEV_DRIVER() and SR_REGISTER_DEV_DRIVER_LIST() macro is used to
add drivers to this new list. This is done by placing the pointers to the
driver into a special section. Since nothing else is in this section it is
known that it is simply a list of driver pointers and the core can iterate
over it as if it was an array.

The advantage of this approach is that the code necessary to add a driver
to the list is completely contained to the driver source and it is no
longer necessary to maintain a global list. If a driver is built it will
automatically appear in the list, if it is not built in won't. This means
that the list is always correct, whereas the previous approach used ifdefs
in the global driver list file which could get out-of-sync with the actual
condition when the driver was built.

Any sr_dev_driver structs that are no longer used outside the driver module
are marked as static.

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agoDrop unnecessary struct sr_dev_driver forward declarations
Lars-Peter Clausen [Sun, 8 May 2016 12:26:56 +0000 (14:26 +0200)]
Drop unnecessary struct sr_dev_driver forward declarations

Most drivers have a forward declaration to their sr_dev_driver struct at
the beginning of the driver file. This is due to historic reasons and often
no longer required. So remove all the unnecessary forward declarations.

Some drivers still require the forward declaration, but only reference the
driver struct from within the driver scan() callback. Since the driver
struct is passed to the scan callback replace the references to the global
variable with the local parameter. In some cases this requires adding the
parameter to some of the helper functions that are called from the scan()
callback.

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agoconfig_list: Don't check for sdi->priv != NULL.
Uwe Hermann [Sat, 14 May 2016 14:11:53 +0000 (16:11 +0200)]
config_list: Don't check for sdi->priv != NULL.

If sdi is != NULL, the backend ensures that sdi->priv is also != NULL.
Almost all drivers were relying on this already.

7 years agoconfig_get(): Don't check for sdi->priv != NULL.
Uwe Hermann [Sat, 14 May 2016 13:41:45 +0000 (15:41 +0200)]
config_get(): Don't check for sdi->priv != NULL.

If sdi is != NULL, the backend ensures that sdi->priv is also != NULL.
Almost all drivers were relying on this already.

7 years agoconfig_set(): Don't check for sdi->priv != NULL.
Uwe Hermann [Sat, 14 May 2016 13:25:19 +0000 (15:25 +0200)]
config_set(): Don't check for sdi->priv != NULL.

Instead, have the backend check that sdi->priv is not NULL (which
many drivers have been assuming already anyway).

7 years agohameg-hmo: add one missing g_free
Stefan Brüns [Mon, 2 May 2016 22:22:12 +0000 (00:22 +0200)]
hameg-hmo: add one missing g_free

7 years agohameg-hmo: Add comment clarifying coupling options
Stefan Brüns [Mon, 2 May 2016 22:14:37 +0000 (00:14 +0200)]
hameg-hmo: Add comment clarifying coupling options

50 Ohm termination is only available on the higher end scopes.

7 years agohameg-hmo: use SR_DF_ANALOG, use definite length blocks for retrieval
Stefan Brüns [Mon, 2 May 2016 22:38:16 +0000 (00:38 +0200)]
hameg-hmo: use SR_DF_ANALOG, use definite length blocks for retrieval

Using binary formats is about 3 times faster than ASCii format. This
addresses bug #791.

7 years agohameg-hmo: Query probe unit (Volt, Ampere) from scope
Stefan Brüns [Mon, 2 May 2016 22:08:58 +0000 (00:08 +0200)]
hameg-hmo: Query probe unit (Volt, Ampere) from scope

7 years agoscpi: introduce some more requests
Stefan Brüns [Mon, 18 Apr 2016 18:30:39 +0000 (20:30 +0200)]
scpi: introduce some more requests

7 years agoscpi: Add support for arbitray/definite length block data retrieval
Stefan Brüns [Sun, 1 May 2016 03:20:39 +0000 (05:20 +0200)]
scpi: Add support for arbitray/definite length block data retrieval

Binary block data is specified in IEEE 488.2. First character is '#',
followed by a single ascii digit denoting the the number of digits needed
for the length specification. Length is given in bytes.

This allows drivers to replace retrieval of comma separated ASCII values
with binary formats. See bug #791.

7 years agoscpi_vxi: Fix incomplete reads (bug #790)
Stefan Brüns [Mon, 2 May 2016 00:51:19 +0000 (02:51 +0200)]
scpi_vxi: Fix incomplete reads (bug #790)

7 years agohameg-hmo: simplify code by using new sr_rational_parse/_eq API functions
Stefan Brüns [Fri, 22 Apr 2016 22:27:35 +0000 (00:27 +0200)]
hameg-hmo: simplify code by using new sr_rational_parse/_eq API functions

7 years agoanalog: Implement division for sr_rational
Stefan Brüns [Sat, 30 Apr 2016 23:36:23 +0000 (01:36 +0200)]
analog: Implement division for sr_rational

7 years agoanalog: Implement multiplication for sr_rational
Stefan Brüns [Sun, 24 Apr 2016 00:48:26 +0000 (02:48 +0200)]
analog: Implement multiplication for sr_rational

7 years agoanalog: Add equality check for sr_rational
Stefan Brüns [Fri, 22 Apr 2016 21:15:54 +0000 (23:15 +0200)]
analog: Add equality check for sr_rational

7 years agoconfigure: Add check for __int128_t and __uint128_t types
Stefan Brüns [Fri, 29 Apr 2016 22:28:09 +0000 (00:28 +0200)]
configure: Add check for __int128_t and __uint128_t types

7 years agostrutil: add method to get an sr_rational from a string
Stefan Brüns [Fri, 22 Apr 2016 22:33:45 +0000 (00:33 +0200)]
strutil: add method to get an sr_rational from a string

The method accepts strings with numbers in scientific or normal notation,
e.g. -1.25 or 3.37e-6. The numeric range is limited by the sr_rational
range, i.e +-9.2e18, resolution is ~19 digits.

7 years agohameg-hmo: Add PATTern and BUS1/BUS2 trigger sources
Stefan Brüns [Sun, 24 Apr 2016 00:57:17 +0000 (02:57 +0200)]
hameg-hmo: Add PATTern and BUS1/BUS2 trigger sources

7 years agofx2lafw/dslogic: Various cosmetics and whitespace fixes.
Uwe Hermann [Mon, 16 May 2016 13:34:21 +0000 (15:34 +0200)]
fx2lafw/dslogic: Various cosmetics and whitespace fixes.

7 years agodslogic: Fix sampling for high samplerates.
Diego Asanza [Sun, 8 May 2016 17:13:12 +0000 (19:13 +0200)]
dslogic: Fix sampling for high samplerates.

This patch fixes sampling at 100MHz, 200MHz and 400MHz.

Signed-off-by: Diego Asanza <redacted>
7 years agodslogic: Add support for long captures at high samplerates.
Diego Asanza [Sun, 8 May 2016 08:59:54 +0000 (10:59 +0200)]
dslogic: Add support for long captures at high samplerates.

To capture more than 16MSamples the hardware run length encoding option
must be enabled, or captured data present errors.

RLE encoding/decoding is done in hardware. Data streamed to the USB interface
is not encoded.

This commit enables RLE encoding for captures longer than 16MSamples.

Signed-off-by: Diego Asanza <redacted>
7 years agodslogic: Add support for external clock edge selection.
Diego Asanza [Sun, 8 May 2016 08:07:05 +0000 (10:07 +0200)]
dslogic: Add support for external clock edge selection.

This commit expands support for acquisition using an external clock,
now allowing the user to select the clock edge.

Signed-off-by: Diego Asanza <redacted>
7 years agodslogic: Implement continuous mode
Diego Asanza [Fri, 6 May 2016 22:12:09 +0000 (00:12 +0200)]
dslogic: Implement continuous mode

For low sampling speeds (up to 25MHz) DSLogic offers a streaming mode where
samples are sent directly to the USB interface, like a fx2lafw device.

For high sampling speeds (up to 400MHz) only buffer mode is supported.

This commit allows the user to set which mode should be used. The configuration
is done by using SR_CONF_CONTINUOUS.

Signed-off-by: Diego Asanza <redacted>
7 years agoChange type of SR_CONF_CONTINUOUS from SR_T_UINT64 to SR_T_BOOL
Diego Asanza [Fri, 6 May 2016 22:07:00 +0000 (00:07 +0200)]
Change type of SR_CONF_CONTINUOUS from SR_T_UINT64 to SR_T_BOOL

SR_CONF_CONTINUOUS is used to check if a device supports continuous sampling
or not. As such, the type boolean is better suited.

Signed-off-by: Diego Asanza <redacted>
7 years agodslogic: Implement acquisition with external clock.
Diego Asanza [Wed, 4 May 2016 17:50:42 +0000 (19:50 +0200)]
dslogic: Implement acquisition with external clock.

DSLogic hardware provides an external clock input.
This commit adds support for this capability.

Signed-off-by: Diego Asanza <redacted>
7 years agodslogic: Add support for voltage threshold
Diego Asanza [Wed, 4 May 2016 17:28:37 +0000 (19:28 +0200)]
dslogic: Add support for voltage threshold

The DSLogic provides two FPGA images: one for 3.3V and the other for 5V logic.
The DSLogic Pro allows to set an arbitrary voltage threshold via USB command.

This commit adds support for the DSLogic to load the FPGA image according to
an user-selectable voltage threshold.

For the DSLogic Pro, one of two fixed voltage thresholds are set, depending on
the user-selected value.

Tested with DSLogic and DSLogic Pro.

Signed-off-by: Diego Asanza <redacted>
Tested-by: Andrew Bradford <redacted>
7 years agodslogic: Implement trigger functionality
Diego Asanza [Sat, 16 Apr 2016 10:45:27 +0000 (12:45 +0200)]
dslogic: Implement trigger functionality

This commit implements DSLogic trigger functionality.

The following triggers are working:

 - trigger on rising edge
 - trigger on falling edge
 - trigger on any edge
 - trigger on logic one
 - trigger on logic zero

Pre-trigger capture ratio is also working.

Signed-off-by: Diego Asanza <redacted>
Tested-by: Andrew Bradford <redacted>
7 years agodemo: Handle the case when zero analog or logic channels were requested
Lars-Peter Clausen [Fri, 13 May 2016 15:36:06 +0000 (17:36 +0200)]
demo: Handle the case when zero analog or logic channels were requested

The demo device has support for specifying the number of analog and logic
channels it should have. Currently this does not work correctly if one of
them is set to zero. Being able to set the number of channels to zero for
one of the channel types is quite useful for corner case testing though.

Make the following modifications to handle it correctly:

1) If the channel count is zero no channel group for that channel type
should be created since a channel group needs at least one channel.

2) Drop the check if logic_unitsize is less or equal to zero in
prepare_data() since this condition will always be true if the number of
logic channels is zero and it is not possible to create a demo device with
only analog channels.

Signed-off-by: Lars-Peter Clausen <redacted>
7 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>
7 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>
7 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

7 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

7 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

7 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.

7 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.

7 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.

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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

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

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

7 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

7 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

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

7 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

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

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

7 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()

7 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.

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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.

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

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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.

7 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.

7 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().

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