Commit Graph

1476 Commits

Author SHA1 Message Date
Uwe Hermann 0d9841ddd6 rohde-schwarz-sme-0x: Add support for SR_CONF_SIGNAL_GENERATOR. 2017-03-02 15:18:02 +01:00
Uwe Hermann 6928c4a928 Add SR_CONF_SIGNAL_GENERATOR. 2017-03-02 15:17:53 +01:00
Uwe Hermann d7056eead2 rohde-schwarz-sme-0x: Drop prototypes for non-existing functions. 2017-03-02 14:56:46 +01:00
Uwe Hermann ed1fae0bb3 rohde-schwarz-sme-0x: Minor whitespace and consistency fixes. 2017-03-02 14:56:46 +01:00
Soeren Apel 9e50659470 rohde-schwarz-sme-0x: Coding style fixes 2017-02-26 21:02:03 +01:00
Vlad Ivanov a28b3df111 rohde-schwarz-sme-0x: Initial device support
Signed-off-by: Vlad Ivanov <vlad.ivanov@lab-systems.ru>
2017-02-26 21:02:03 +01:00
Uwe Hermann 97c2710b2c hwdriver: Drop unneeded debug message.
The logs already show scan attempts per-driver, no need to also log the
init per-driver, since that's always happening and cannot (normally) fail.
2017-02-26 15:43:35 +01:00
Sven Schnelle 6ca578feb8 Fix analog output display
I've seen the following output from sigrok-cli:

CH1: 478.720 mV
CH1: -514 mV
CH1: -0 V

I added some debug, and it seems like the digits value isn't reset
to the actual value after calling sr_analog_si_prefix_friendly():

using 6 digits
value2 0.478720 digits 6
value2 -0.513536 digits 3
value2 -0.487424 digits 0

This commit fixes this by resetting the value to the actual value before.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
2017-02-15 08:57:04 +01:00
Sven Schnelle 471ac344a5 Fix initial sample value for demo driver
devc->step is not reset on acquistion start, so acquisition
starts with a different value every time. Thats annoying when
using the demo driver to debug sigrok, so lets make sure that
it's reset to 0.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
2017-02-14 23:32:45 +01:00
Sebastian Tabares Amaya 759f2ef762 Add support for Hantek 6022BL 2017-01-27 01:12:14 +01:00
Aurelien Jacobs 0ceb70381b agilent-dmm: Add support for U124xC. 2017-01-22 19:03:29 +01:00
Aurelien Jacobs 1af3f40eec agilent_dmm: Split generic part of recv_log_u128x() to recv_log(). 2017-01-22 19:03:29 +01:00
Aurelien Jacobs 29bdeeb549 agilent-dmm: Add support for Vsense (Non-Contact Voltage). 2017-01-22 19:03:29 +01:00
Aurelien Jacobs c2e3c322e6 agilent-dmm: Fix handling of the 2nd channel of 2 channels models.
The 2nd channel of those models is not limited to temperature,
so it is necessary to query CONF? @2.
2017-01-22 19:03:29 +01:00
Aurelien Jacobs 4fdedbbb3a agilent-dmm: Set correct length in strncmp(). 2017-01-22 19:03:29 +01:00
Aurelien Jacobs 841aadc95b libsigrok.h: Add SR_MQ_HARMONIC_RATIO. 2017-01-22 19:03:29 +01:00
Uwe Hermann 35bb2fcef9 scpi_serial: Convert 'got_newline' variable to gboolean. 2017-01-21 15:17:35 +01:00
Stefan Brüns d64be25be4 scpi: Do not block when reading header of definite length blocks
When using SCPI over serial (over USB), we want the header without waiting
for the terminating newline, as otherwise the transfer may time out.
sr_scpi_get_data() will block until the message is complete.
2017-01-21 15:08:21 +01:00
Stefan Brüns 9ea4018f2f scpi_serial: Get rid of intermediate buffer, do not strip newline
Lowlevel access functions should not alter the data. sr_scpi_get_string(),
which is called by most highlevel access functions, strips newlines
in a central place, and is only fed with data which contains newlines
as a final terminator.
IEEE 488.2 definite length blocks may contain arbitrary data, thus the
payload up to the provided length should be passed unaltered.

Track if the last received character is a newline, which can be used
by sr_scpi_get_string() and its callers to determine if the response
is complete.
2017-01-21 15:08:21 +01:00
Stefan Brüns 37ef582d08 scpi: Query current time just once, use microseconds for timeout
g_get_monotonic_time() returns current time in microseconds, use the same
granularity for storing the read timeout.
There is also no need to check the timeout if data has just been read.
2017-01-21 15:08:21 +01:00
Stefan Brüns 59b9c3290a yokogawa-dlm: Mostly fix dumping of current timebase
sr_period_string takes the frequency as its argument, i.e. the reciprocal
of the timebase. Obviously this will not work for frequencies less than
1Hz / timebases greater than 1 second, but at least is correct for all
other available timebases.
2017-01-21 15:08:21 +01:00
Stefan Brüns d8b65ef661 hameg_hmo: Mostly fix dumping of current timebase
sr_period_string takes the frequency as its argument, i.e. the reciprocal
of the timebase. Obviously this will not work for frequencies less than
1Hz / timebases greater than 1 second, but at least is correct for all
other available timebases.
2017-01-21 15:08:21 +01:00
Stefan Brüns a547531bf1 strutil: Fix sr_period_string output
The output was wrong for all frequencies but 1 Hz, 1 kHz, 1 MHz and 1 GHz.
With this changes, the output may still be off due to rounding, but will
be correct as to the shown accuracy.
2017-01-20 19:48:39 +01:00
Gerhard Sittig 900846816f scpi: Don't process received data of zero length
When nothing was received in a read attempt, we need not adjust the
buffered data's read position nor the glib string object's size. Skip
any processing for empty input, just keep checking for timeouts.
2017-01-20 18:53:43 +01:00
Gerhard Sittig ad21865fa7 scpi: Rephrase buffer resize for free space during SCPI read, add comments
Routine sr_scpi_get_data() checks for free space in the receive buffer,
and resizes the buffer when free space drops below a threshold. The
previous logic assumed that the resize and the read logic would interact
in some specific way to achieve the desired operation.

Adjust the buffer resize such that more free space is pre-allocated, yet
the payload size of the buffer is not affected. This eliminates the
dependency of the optional resize logic from subsequent activity for
reception of data that is non-optional.

Add comments while we are here, outline the steps taken in the
sr_scpi_get_data() routine.
2017-01-20 18:53:43 +01:00
Gerhard Sittig 4889acefb2 hameg-hmo: Rephrase the channel constraints check (analog vs digital)
Phrase the logic which checks the use of analog channels and digital
pods in more generic terms. Place a comment about the contraints' being
potentially dependent on the specific HMO model. This implementation
should lend itself better to future adjustment (HMO1002?).
2017-01-20 18:53:43 +01:00
Gerhard Sittig e06875b2ce hameg-hmo: Map logic data from second digital pod to channels D8-D15
An internal libsigrok implementation detail prevents partial submission
of logic data for different channel groups in multiple calls. Instead
one logic packet needs to be sent in a single call, which combines data
for all channels.

Introduce a logic data storage which folds samples from several channel
groups that were received at different points in time into a combined
memory layout of larger unitsize. Stick with the former shortcut of
passing on the input bytes directly when only the first digital pod is
used during acquisition.

This change correctly maps data from the second pod to channels D8-D15.
2017-01-20 18:53:43 +01:00
Gerhard Sittig 1b0f62df22 hameg-hmo: Do read from second digital pod during acquisition
The previous implementation only added one of the digital channels to
the list of enabled channels that are involved in the acquisition (the
first one that was found). This means that when the set of used digital
channels spans more than one pod/group, the second pod will never be
read from.

Make sure to enable one digital channel per pod/group, such that
acquisition will retrieve data from all involved input sources.

Add comments while we are here. Mention how the different setup, check,
start, and receive routines which are spread across several files do
interact to achieve acquisition.
2017-01-07 21:36:53 +01:00
Gerhard Sittig b23eb1d4d1 hameg-hmo: Send exactly one sigrok frame per scope frame
The previous implementation used to put FRAME_BEGIN and FRAME_END
markers around each received chunk of samples, while those chunks
correspond to a single channel (analog) or a group of eight channels
(digital) each. In other words, the hameg-hmo driver had provided a
multiple of the requested frames, and those frames were incomplete.

Make sure to only send FRAME_BEGIN before the first channel's data,
and FRAME_END after the last channel's data of a frame. Thus make
sigrok frames exactly match the scope's frames.

Add some comments on the frame marker and the acquisition stop logic
while we are here.
2017-01-07 21:36:53 +01:00
Gerhard Sittig 65a6794ea1 hameg-hmo: Use the host's endianess to read analog channel data via SCPI
Configure the scope to the host's native endianess before downloading
acquisition data from analog channels. This unbreaks operation on those
models which default to a representation which differs from the host.
2017-01-07 21:36:53 +01:00
Gerhard Sittig d1ad8b10bc Revert "hameg-hmo: Support BE format for SCPI sample downloads"
Undo the change which queries the scope's endianess and has the floats
converted after reception. An alternative implementation will perform
better.
2017-01-07 21:36:52 +01:00
Gerhard Sittig d5a61aaf2d Revert "scpi: Don't process received data of zero length"
Undo the change which skips management activities when no data was
received. This change breaks the current implementation, and needs to
get deferred until a delicate interaction between the resize and the
read logic has been eliminated.
2017-01-07 21:36:52 +01:00
Gerhard Sittig 2ea1fdf121 license: remove FSF postal address from boiler plate license text
Remove the FSF postal address as it might change (it did in the past).
Reference the gnu.org website instead which is more stable.
2017-01-07 16:05:39 +01:00
Gerhard Sittig 661aa24aa6 asyc-ii: Rephrase "exponent" logic when parsing packets
Replace a C library strcspn(3) call with the more portable glib
g_strstr_len(3) routine. This is possible since a single separator
is searched for, no actual "set of characters" is involved.

As a byproduct, this eliminates a "late" reference to 'cnt' at the
bottom of the routine, after the value was assigned in a rather distant
location at the top of the routine. The cost of strlen() should be
acceptable for a buffer with a single digit total length.
2017-01-07 15:51:47 +01:00
Gerhard Sittig 43528280d9 asyc-ii: Prefer more portable and common string routines
Replace C language string operations with their glib incarnations for
improved portability. Prefer a common sigrok float conversion routine
over a DIY implementation.
2017-01-07 15:51:47 +01:00
Gerhard Sittig c2debda60d asyc-ii: Unobfuscate a comment on packet parse constraints
The specific packet layout puts constraints on the parse logic (case
sensitive comparison, order of comparison). Fix a comment that made no
sense before, and better reflect that there are two constraints.
2017-01-07 15:51:47 +01:00
Gerhard Sittig 26e8c6a2b2 scpi: Rephrase length logic in data block reception, comment/group code
Slightly rephrase the SCPI code which parses the responses that carry
(binary) data blocks. Be explicit about NUL termination when parsing the
leading length spec in the response, obsoleting the array initializer.
Add lots of comments and group source code lines to better reflect
what's happening from the protocol's perspective.

Fix the returned error code in the path which reads responses of
excessive length in chunks. The previous implementation detected errors
but always returned code 0 (success).
2017-01-07 15:51:47 +01:00
Gerhard Sittig 904401e8fe scpi: Don't process received data of zero length
When nothing was received in a read attempt, we need not adjust the
buffered data's read position nor the glib string object's size. Skip
any processing for empty input, just keep checking for timeouts.
2017-01-07 15:51:47 +01:00
Gerhard Sittig d3de86f3ca scpi: Minor style nits
Drop an initial assignment to a variable which never takes effect.
Add braces around the body of a more complex if block. Separate routines
from each other by exactly one empty line.
2017-01-07 15:51:47 +01:00
Gerhard Sittig d431e4ec28 hameg-hmo: Support BE format for SCPI sample downloads
When the channel state is retrieved, query the pre-set byteorder for
SCPI data blocks as well. When samples get retrieved during capture,
support float representations in either big or little endian format.

This commit unbreaks devices which operate in BE format by default
(tested with HMO2524). It keeps working with LE format as before. For
devices which don't support the byteorder query or return unknown
responses, LE format is assumed for backwards compatibility. The
device's byteorder is only queried and never set. This makes the
commit least intrusive.
2017-01-07 15:51:46 +01:00
Gerhard Sittig 74413fafb4 hameg-hmo: Declare support for 2 pods / 16 channels on HMO2524 and above
A comment mentioned that the models HMO2524 and above support 16 digital
channels (and thus have two pods for the probes). Move those models to a
section that declares the respective features, including trigger support
on the upper digital channels.

Model detection and reflection of supported channels was tested on HMO2524.
2017-01-07 15:51:46 +01:00
Gerhard Sittig 40a75c8e97 hameg-hmo: Release enabled channels when acquisition start fails
Commit db81fbb582 made sure to release a potentially previously
allocated list of enabled channels before (re-)building the list in the
current invocation of acquisition start.

This commit frees the memory in the error path near the failed creation
already, which reduces the period of time where unused resources are
held, and eliminates a memory leak when acquisition is not stopped after
failed start.

Both approaches can coexist. Freeing an empty list is perfectly fine.
2017-01-07 15:51:32 +01:00
Gerhard Sittig 2d224dbae7 hameg-hmo: Fix index access for models with 2 pods / 16 digital channels
Fix the code which registers the name of the second pod for digital
probes. The previous implementation registered the first pod twice, and
lost the reference to the second pod. No harm was done, none of the
supported models declared support for two pods so far.

Factor out a channel to group mapping in the registration of digital
channels, while we are here.
2017-01-07 15:46:52 +01:00
Gerhard Sittig 503220ec8d deree-de5000: rename to serial-lcr, update configure logic
The former DER EE DE-5000 driver was a very thin wrapper around the
ES51919 LCR meter chipset. None of its source was specific to the
deree-de5000 device. In fact it contained code for all currently
supported LCR meters, and it's expected that all LCR meters which
will get added in the future will fit in as well.

Follow the serial-dmm model. Rename the src/hardware/deree-de5000/
directory to serial-lcr/. Update the configure logic. Although the
source directory and the configure option are named serial-lcr, the
LCR meter still is used by specifying the "deree-de5000" device driver
(which just happens to reside in the serial-lcr driver sources, among
others).
2016-12-26 13:12:35 +01:00
Gerhard Sittig dc5895cbdd serial-dmm: add DMM entry for Metrix MX56C (ASYC-II based) 2016-12-20 17:51:36 +01:00
Gerhard Sittig 4ba4d52a8f dmm: introduce support for ASYC-II 16-byte protocol in PRINT mode
Introduce an asycii.c source file (modelled after metex14.c) which
implements support for the 16-byte protocol of the ASYC-II multimeter
chipset (RX only, when the PRINT button was pressed).
2016-12-20 17:51:36 +01:00
Uwe Hermann 6c62c605f9 Consistently use the "PeakTech" vendor name spelling.
(as per vendor website, and also to be consistent with our wiki)
2016-12-06 21:50:05 +01:00
Vlad Ivanov fef90b4101 fx2lafw: fix device product string check
Signed-off-by: Vlad Ivanov <vlad@ivanov.email>
2016-12-05 02:16:56 +01:00
Karl Palsson 7087a8b0fa fx2lafw: warn on fail to open plausible devices
Instead of silently ignoring all devices that fail to open.

This fixes bug #867.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2016-12-05 02:16:33 +01:00
Gerhard Sittig ced210d53a deree-de5000: add driver item for the Peaktech 2170 model
Register another driver for the Peaktech 2170 LCR meter, which is
based on the ES51919/ES51920 chipset, too.
2016-12-05 01:07:08 +01:00
Gerhard Sittig beedfa06b6 deree-de5000: prepare to add more ES51919 based LCR meters
The "deree-de5000" driver is a very thin wrapper around the ES51919
chipset. We expect more models from other vendors to use that same
support code.

Model the registration of vendor/model combinations after the serial-dmm
approach. Register the DER EE DE-5000 device as the currently only
member in a list of drivers which all use the ES51919 chipset (no model
specific routines are registered in the absence of support for other LCR
meter chips).

This commit does not change the driver's behaviour nor the set of
supported hardware. It prepares the addition of more drivers in the
future.
2016-12-05 01:06:58 +01:00
Uwe Hermann 82458e50b1 serial-dmm: Expand a code comment. 2016-11-06 14:45:08 +01:00
Gerhard Sittig d5b1b76d65 serial-dmm: comment nit on the UART bitrate for ES519xx chips
Factor out identical comments on the UART bitrate of ES519xx based
multimeters. These probably got copied from the first item as of 2012
when new items were added in 2014 (the added devices were from the
same vendor and rebadged).

Expand on the fact that the bitrate still is within spec, and does not
harm at all. Strictly speaking the comment could get dropped.
2016-11-06 14:43:50 +01:00
Gerhard Sittig 89a3d8af3a serial-dmm: sort the list of device drivers (part 12, vc870)
This commit puts 'vc870' meters into one group. Which completes the
series of commits which sort the list of supported serial DMMs.
2016-11-06 14:43:48 +01:00
Gerhard Sittig 53e875ab16 serial-dmm: sort the list of device drivers (part 11, sort ut71x)
This commit sorts items in the 'ut71x' group. This is separated from
collecting the group to reduce the diff size and simplify verification.
2016-11-06 14:43:46 +01:00
Gerhard Sittig 6c6e5e47f0 serial-dmm: sort the list of device drivers (part 10, group ut71x)
This commit puts 'ut71x' meters into one group. Item order is kept to
reduce the diff size and simplify verification.
2016-11-06 14:43:44 +01:00
Gerhard Sittig 9249648863 serial-dmm: sort the list of device drivers (part 9, rs9lcd)
This commit puts 'rs9lcd' meters into one group.
2016-11-06 14:43:43 +01:00
Gerhard Sittig b35d0023a8 serial-dmm: sort the list of device drivers (part 8, sort metex14)
This commit sorts items in the 'metex14' group. This is separated from
collecting the group to reduce the diff size and simplify verification.
2016-11-06 14:43:40 +01:00
Gerhard Sittig ab34156b90 serial-dmm: sort the list of device drivers (part 7, group metex14)
This commit puts 'metex14' meters into one group. Item order is kept to
reduce the diff size and simplify verification.
2016-11-06 14:43:38 +01:00
Gerhard Sittig 0e27643ff8 serial-dmm: sort the list of device drivers (part 6, fs9922)
This commit puts 'fs9922' meters into one group.
2016-11-06 14:43:37 +01:00
Gerhard Sittig 1cd40b57d6 serial-dmm: sort the list of device drivers (part 5, sort fs9721)
This commit sorts items in the 'fs9721' group. This is separated from
collecting the group to reduce the diff size and simplify verification.
2016-11-06 14:43:35 +01:00
Gerhard Sittig 289e1f4e7b serial-dmm: sort the list of device drivers (part 4, group fs9721)
This commit puts 'fs9721' meters into one group. Item order is kept to
reduce the diff size and simplify verification.
2016-11-06 14:43:32 +01:00
Gerhard Sittig 7532f61d1b serial-dmm: sort the list of device drivers (part 3, es519xx)
This commit puts 'es519xx' meters into one group.
2016-11-06 14:43:31 +01:00
Gerhard Sittig 440a374fe3 serial-dmm: sort the list of device drivers (part 2, dtm0660)
This commit puts 'dtm0660' meters into one group.
2016-11-06 14:43:30 +01:00
Gerhard Sittig c06785841c serial-dmm: sort the list of device drivers (part 1, bm25x)
The previous implementation seems to have added drivers in their "order
of appearance". Start sorting the rather long list, to simplify several
tasks: Add new entries as more drivers get written, find existing items
during research, identify and compare similar models during maintenance.
As a byproduct, there will be no doubt about where to put things during
future work :) and duplicates will be spotted immediately.

This commit puts 'bm25x' meters into one group. And comments on the sort
order and motivation for sorting the table.
2016-11-06 14:43:25 +01:00
Gerhard Sittig 6b7e644e5c es51919 lcr: unbreak channel setup after successful detection
Commit 6bcb3ee876 introduced initial support for the Cyrustek ES51919
chipset. Its setup_channels() routine used to init a variable to assume
failure, then a loop added channels and changed the value to success.

Commit 5e23fcab88 changed channel setup to never fail, but kept the
initialization with an error code. Which prevented the operation of
successfully detected LCR meters.

Remove the no longer needed variable, instead always return success from
an operation which cannot fail.

Fixes: 5e23fcab88 "Simplify channel creation."
Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
2016-11-02 23:27:56 +01:00
Gerhard Sittig e68c0eb409 serial-dmm: add support for Peaktech-3330 (based on FS9721)
Add another DMM entry for Peaktech-3330, which is based on the FS9721
chipset. Support was tested with the CP210x based USB cable.

Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
2016-11-02 23:23:56 +01:00
Gerhard Sittig 0150fdca54 output/ascii: add support for user configurable character set
Since tastes and requirements might differ, introduce support for a
user specified character set in the construction of ASCII art graphs
of signal levels. The syntax is "charset=<low><high>[<fall><rise>]",
the default remains backwards compatible with existing consumers.

In comparison to assuming a fixed character set, this change addresses
several distinct aspects:

Users can adjust the output for "higher visual contrast", or "straight
lines" instead of dotted patterns, or "increased difference in height"
for low and high signal levels, or "filled" (block like, "wall of text")
appearance of periods with high levels. User adjustable characters are
needed, as no single fixed set can satisfy the differing expectations.
Perception of the output heavily depends on specific terminals and fonts
in use.

Then there is the issue of levels versus edges, and how their timing
relates. By default edges are drawn at a point in time where the signal
was sampled and was deteremined to already _have_ changed and have
settled to the new level, which means that the position of edges in the
resulting graph might be off by up to one sample period. Strictly
speaking, the available set of samples only contains levels, and does
not hint where exactly an edge might have occured. Though this might be
considered rather nitpicky, representing the graph without edges does
better reflect the input data, and might simplify postprocessing.

Compare the previously only supported format (still the default, -O ascii):

  1:...................................................../""""""""""""""""""""
  1:""""""""""""""""""""""""""""""""\.........................................
  1:..........................................................................

to those example alternatives:

  $ sigrok-cli -i file.sr -O ascii:charset=_\"\\/
  1:_____________________________________________________/""""""""""""""""""""
  1:""""""""""""""""""""""""""""""""\_________________________________________
  1:__________________________________________________________________________

  $ sigrok-cli -i file.sr -O ascii:charset=_\"
  1:_____________________________________________________"""""""""""""""""""""
  1:""""""""""""""""""""""""""""""""__________________________________________
  1:__________________________________________________________________________

  $ sigrok-cli -i file.sr -O ascii:charset=_^
  1:_____________________________________________________^^^^^^^^^^^^^^^^^^^^^
  1:^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^__________________________________________
  1:__________________________________________________________________________

  $ sigrok-cli -i file.sr -O ascii:charset=_M
  1:_____________________________________________________MMMMMMMMMMMMMMMMMMMMM
  1:MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM__________________________________________
  1:__________________________________________________________________________

  $ sigrok-cli -i file.sr -O ascii:charset=_X
  1:_____________________________________________________XXXXXXXXXXXXXXXXXXXXX
  1:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX__________________________________________
  1:__________________________________________________________________________

Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
2016-11-02 19:09:55 +01:00
Uwe Hermann 7dc72c37e2 hantek-6xxx: Add "fx2lafw-" prefix to the firmware files. 2016-10-31 14:42:29 +01:00
Uwe Hermann 459324acb8 hantek-6xxx: Update driver to use the USB product version field.
We now require the use of the latest fx2lafw firmware which uses the
same USB VID/PID (1D50:608E) for the Hantek 6022BE and the variants
and rebadges of that device (e.g. the SainSmart DDS120).

The variants can be distinguished via the USB product version field.
2016-10-30 14:36:40 +01:00
Aurelien Jacobs f6e7b6124a agilent-dmm: style improvement 2016-10-17 23:21:18 +02:00
Aurelien Jacobs 63bb11baba agilent-dmm: add support for Log-* data_source for U128x 2016-10-17 02:29:13 +02:00
Aurelien Jacobs b907d62fb8 agilent-dmm: rework job management
This allows much faster and configurable sampling rate, and faster
reaction to function switch.
This also gives a more repeatable job ordering and more reliable
query/reply association.
2016-10-17 02:29:13 +02:00
Aurelien Jacobs 6ace179e6d agilent-dmm: prepare config handling to easily receive more options 2016-10-17 02:24:53 +02:00
Aurelien Jacobs 5728718b66 analog: use SI prefix only with units that accept SI prefixes 2016-10-17 02:24:53 +02:00
Aurelien Jacobs d2f6abf6de agilent-dmm: fix handling of continuity mode for U128x 2016-10-17 02:24:53 +02:00
Aurelien Jacobs 7ab126cacb agilent-dmm: add support for pulse width and duty cycle on U128x 2016-10-17 02:24:53 +02:00
Aurelien Jacobs cdc311957b analog: use correct unit for dBm/dBV 2016-10-17 02:09:18 +02:00
Aurelien Jacobs 8f68f36bc5 agilent-dmm: add support for dBm/dBV modes 2016-10-17 02:09:18 +02:00
Aurelien Jacobs d822726dbf agilent-dmm: add support for reading secondary display and temperature 2016-10-17 02:09:18 +02:00
Gerhard Sittig 7c86d85372 asix-sigma: fix buffer length check in register write helper
Fix the array size check in the sigma_write_register() routine. The
'len' parameter specifies the number of bytes to write, while the 'buf'
array holds one nibble per array item.

The previous implementation (commit e8686e3ae3) switched to a
constant size and made the buffer large enough so that no existing
request would exceed the buffer, fixing an overflow that was present
before that commit. But the most recent size check was incomplete and
might erroneously succeed for larger amounts of write data.

It's assumed that the issue which gets addressed here never occured in
practice. The constant-size buffer could hold up to 39 bytes of input
data in their transport representation, while the largest data that was
passed to the write routine is six bytes (trigger LUT params).

Fixes: e8686e3ae3 "asix-sigma: Avoid use of variable length arrays"

Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
2016-10-17 02:05:22 +02:00
Gerhard Sittig 2f7e529ce6 asix-sigma: store "limit samples" value, re-determine "limit msecs" period
The driver internally implements the "limit samples" feature by means of
the "limit sample period" approach. Determination of the corresponding
period of time for captures depends on the sample rate as well as the
maximum sample count, and thus needs to be re-done when either setting
changes.

Introduce a "limit_samples" variable so that the value is available when
needed later. As a byproduct the parameter can be retrieved now (get).

Add comments to the sigma_set_samplerate() routine's sections, since
quite a bit is happening there, and interacts with other locations.

Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
2016-10-17 02:05:21 +02:00
Gerhard Sittig 4154a516de asix-sigma: fix out-of-range access to the samplerates[] array
Commit 2c9c0df86e removed the sentinel from the samplerates[] array,
but did not adjust the test which checked whether a rate is listed in
the set of supported rates. This could result in an out-of-range access
beyond the array's last item.

Fix the "listed?" check after iterating the table of supported rates.
Cope with either presence or absence of a sentinel in the array.

Address some more style nits while we are here. Rename an identifier
for a local variable which unintentionally might suggest that it would
be a preprocessor macro (all-caps). Reduce redundancy in data type
references as well as in the determination of the array size.

Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
2016-10-17 02:05:21 +02:00
Gerhard Sittig 387825dcb1 asix-sigma: update comments in firmware download code paths
The current implementation of the ASIX Sigma firmware download contains
comments which express uncertainty. Rephrase them, no magic is involved.

Discuss the polarity of the CCLK hardware signal. Which shall eliminate
potential concerns in future reviews or maintenance.

This commit only updates comments, and does not change behaviour.

Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
2016-10-17 02:05:21 +02:00
Uwe Hermann ba508e22d4 demo: File naming consistency changes. 2016-09-24 14:27:03 +02:00
Uwe Hermann caeb8d7a9d hantek-dso: File naming consistency changes. 2016-09-24 13:17:08 +02:00
Uwe Hermann 2cb232a9e4 fluke-dmm: File naming consistency changes. 2016-09-24 13:16:58 +02:00
Uwe Hermann 6cf1a87bfb agilent-dmm: File naming consistency changes. 2016-09-24 13:16:01 +02:00
Uwe Hermann 7ade12b470 resource: Improve logging output.
Don't show duplicate lines (per default) such as

  sr: resource: Failed to locate 'saleae-logic16-fx2.fw'.
  sr: resource: Failed to open resource 'saleae-logic16-fx2.fw'.

The first one is now an sr_dbg() instead of sr_err().

Also, mention that a higher loglevel will give more information as to
where the backend is looking for resources / firmware files.

This fixes bug #806.
2016-09-24 11:41:47 +02:00
Mike Meyer cad447d21a output/csv: Add an option to output units for column labels.
This change tweaks the CSV output module to change the label
setting from on/off to units/channels/off, where channels is the old
on behavior, and units uses the meaning field to generate the column
label - except for the generated Time column, which uses the label from
the X axis when it's generating gnuplot output.
2016-09-24 11:21:00 +02:00
Karsten König d53295e69e rigol-ds: Add DS1074Z Plus and DS1104Z Plus.
This was successfully tested on a DS1074Z Plus.
2016-09-24 11:04:32 +02:00
Mike Meyer f9c6b5cfd3 output/gnuplot: Remove, obsoleted by improved CSV module.
We no longer need a gnuplot output module, the CSV module can output
gnuplot-compatible data now (and it can also generate .gpi files).
2016-09-04 18:15:00 +02:00
Uwe Hermann e34dbc9d08 csv: Fix a segfault due to a g_malloc() allocating too few bytes. 2016-09-04 18:03:50 +02:00
Uwe Hermann cf1d5f1749 csv: Fix a segfault when using non-hardware input. 2016-09-04 18:03:50 +02:00
Mike Meyer 9e24c8bc65 New all-singing, almost all dancing, csv output module.
- It now handles more than one analog value correctly - at least from the
   demo driver.
 - Add column headers from channel names.
 - Add a row dedup capability.
 - Add a sample time column.
 - Add a frame end formatting (for gnuplot).
 - Made almost all formatting controllable or at least optional.
 - Fix it so we can mix analog and digital values.
 - Add outputting a gnuplot script for the data.
 - Count actual channels, not just mine, to find end of sample.
 - Add trigger option (untested).
2016-09-04 18:03:50 +02:00
Uwe Hermann 55ec0b673a fluke-dmm: Fix two compiler warnings.
src/hardware/fluke-dmm/fluke.c:312:24: warning: implicit conversion from \
  enumeration type 'enum sr_unit' to different enumeration type 'enum sr_mq' \
   [-Wenum-conversion]
          devc->mq = devc->unit = devc->mqflags = 0;
                   ~ ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~

  src/hardware/fluke-dmm/fluke.c:312:40: warning: implicit conversion from \
  enumeration type 'enum sr_mqflag' to different enumeration type 'enum \
  sr_unit' [-Wenum-conversion]
          devc->mq = devc->unit = devc->mqflags = 0;
                                ~ ~~~~~~~~~~~~~~^~~
2016-08-29 21:51:28 +02:00
Uwe Hermann 693c52482a es51919: Fix a compiler warning.
src/lcr/es51919.c:538:73: warning: comparison of unsigned enum expression \
		< 0 is always false [-Wtautological-compare]
    if ((analog->meaning->mq = parse_mq(pkt, is_secondary, pkt[2] & 0x80)) < 0)
2016-08-29 21:51:28 +02:00
Uwe Hermann 5c436a3bad strutil.c: Fix a Doxygen warning. 2016-08-29 21:51:28 +02:00
Uwe Hermann cd04f641a5 Fix various sample/time limit regressions.
These were accidentally introduced when the sw_limits helpers were added.
2016-08-29 21:51:28 +02:00
Uwe Hermann cb4b368f17 gmc-mh-1x-2x: Shorten some code by using the ternary operator. 2016-08-29 21:51:28 +02:00
Uwe Hermann d9251a2c9f Remove some unneeded double-spaces.
(also perform some other minor whitespace fixes while at it)
2016-08-29 21:51:27 +02:00
Uwe Hermann 2ecc745ccb device.c: Whitespace/cosmetics and typo fixes. 2016-08-29 21:51:27 +02:00
Uwe Hermann 8dc423b033 analog.c: Whitespace/cosmetics and typo fixes. 2016-08-29 21:51:27 +02:00
Uwe Hermann 7dcaddd3f0 Have remaining drivers default to digits=2 for analog values.
The default so far was 0, which meant there would be no significant
digits at all, yielding results that looked strange/wrong to the user.

Long-term all remaining drivers should be fixed to use the actual,
correct digits and spec_digits values according to the device's
capabilities and/or datasheet/manual. Until that is done, a default
of digits=2 is used as a temporary workaround.

This fixes the remaining parts of bug #815.
2016-08-29 00:25:19 +02:00
Uwe Hermann 869c837511 Document if or why sometimes digits/spec_digits is 0. 2016-08-29 00:25:19 +02:00
Aurelien Jacobs a005472fa2 appa-55ii: properly set encoding digits also for log memory reception 2016-08-29 00:25:19 +02:00
Aurelien Jacobs 962172e495 analog: improve output readability by using SI prefix 2016-08-29 00:25:19 +02:00
Aurelien Jacobs 6c1c13cdcd gwinstek-gds-800: properly set encoding digits 2016-08-29 00:25:18 +02:00
Aurelien Jacobs 417412c8f8 hantek-dso: properly set encoding digits 2016-08-29 00:25:18 +02:00
Aurelien Jacobs 1e1fdbc994 hantek-6xxx: properly set encoding digits 2016-08-29 00:25:18 +02:00
Aurelien Jacobs 545101338a hung-chang-dso-2100: properly set encoding digits 2016-08-29 00:25:18 +02:00
Aurelien Jacobs ad4c0275c2 baylibre-acme: properly set encoding digits 2016-08-24 02:39:40 +02:00
Aurelien Jacobs d043b29d5c tondaj-sl-814: properly set encoding digits 2016-08-24 01:01:23 +02:00
Aurelien Jacobs 53b4ea3921 kecheng-kc-330b: properly set encoding digits 2016-08-24 01:01:23 +02:00
Aurelien Jacobs dcb6fcbb7b colead-slm: properly set encoding digits 2016-08-24 01:01:23 +02:00
Aurelien Jacobs 8c50007222 cem-dt-885x: properly set encoding digits 2016-08-24 01:01:23 +02:00
Aurelien Jacobs f4bd8a1718 gmc-mh-1x-2x: properly set encoding digits 2016-08-24 01:01:23 +02:00
Aurelien Jacobs b66a0b5bdd mic-985xx: fix encoding digits 2016-08-23 12:58:06 +02:00
Aurelien Jacobs 1db537c3eb uni-t-ut32x: properly set encoding digits 2016-08-23 12:58:06 +02:00
Aurelien Jacobs fa2b19226d lascar-el-usb: properly set encoding digits 2016-08-23 12:58:05 +02:00
Aurelien Jacobs 0a2ffa3ebf center-3xx: properly set encoding digits 2016-08-23 12:58:05 +02:00
Aurelien Jacobs 0b8205504b kern-scale: properly set encoding digits 2016-08-23 12:58:05 +02:00
Aurelien Jacobs 3be044aa90 demo: properly set encoding digits 2016-08-23 12:58:05 +02:00
Aurelien Jacobs bcaadb366f motech-lps-30x: properly set encoding digits 2016-08-23 12:58:05 +02:00
Aurelien Jacobs 1af428d018 manson-hcs-3xxx: properly set encoding digits 2016-08-23 12:58:05 +02:00
Aurelien Jacobs 841c15a5fa korad-kaxxxxp: properly set encoding digits 2016-08-23 12:58:05 +02:00
Aurelien Jacobs fad810b502 atten-pps3xxx: properly set encoding digits 2016-08-23 12:58:05 +02:00
Aurelien Jacobs 24b6882ffa deree-de5000: properly set encoding digits 2016-08-23 12:58:05 +02:00
Aurelien Jacobs b8f07f4221 rigol-ds: properly set encoding digits 2016-08-23 12:58:05 +02:00
Aurelien Jacobs 6ed709fecd scpi-pps: properly set encoding digits 2016-08-23 12:58:05 +02:00
Aurelien Jacobs 4301f1726a maynuo-m97: properly set encoding digits 2016-08-23 12:58:04 +02:00
Aurelien Jacobs a66d44bee1 vc870: properly set encoding digits 2016-08-23 12:58:04 +02:00
Aurelien Jacobs 4f414d4cbe ut71x: properly set encoding digits 2016-08-23 12:58:04 +02:00
Aurelien Jacobs 47166326ef ut372: properly set encoding digits 2016-08-23 12:58:04 +02:00
Aurelien Jacobs 96a06b4203 rs9lcd: properly set encoding digits 2016-08-23 12:58:04 +02:00
Aurelien Jacobs e677490e58 metex14: properly set encoding digits
This closes bug #815.
2016-08-23 12:58:04 +02:00
Aurelien Jacobs 8882e7e6cf m2110: properly set encoding digits 2016-08-23 12:58:04 +02:00
Aurelien Jacobs aad6d8d206 fs9922: properly set encoding digits 2016-08-23 12:58:04 +02:00
Aurelien Jacobs 70e28e7802 fs9721: properly set encoding digits 2016-08-23 12:36:19 +02:00
Aurelien Jacobs 8cbf5627ba es519xx: properly set encoding digits 2016-08-23 12:36:19 +02:00
Aurelien Jacobs 427015d7c1 dtm0660: properly set encoding digits 2016-08-23 12:36:19 +02:00
Aurelien Jacobs 25198a7e89 brymen-bm25x: properly set encoding digits 2016-08-23 12:36:19 +02:00
Aurelien Jacobs 1baf30f5f7 brymen-bm86x: properly set encoding digits 2016-08-23 12:36:19 +02:00
Aurelien Jacobs 5fe1b5cc14 brymen-bm86x: remove redundant initilialization 2016-08-23 12:36:19 +02:00
Aurelien Jacobs 7b78449e40 appa-55ii: properly set encoding digits 2016-08-23 12:36:19 +02:00
Erik Montnemery 817b7441a1 hantek-6xxx: Ignore requests to set Hantek 6022BE coupling.
Here's a patch to "Ignore requests to set coupling for the Hantek 6022BE",
this clears the LIBUSB errors for me.

Also in the patch:

 - There is a crash because config_list() can be called with sdi == NULL.

   This can be reproduced by doing:
     "sigrok-cli.exe --driver hantek-6xxx --show"

 - There seems to be a very unsafe loop in config_set() when setting COUPLING;
   the coupling vector is assumed to be zero terminated, but is not declared
   as such.

   Note: The same issue is present also for other hardware, at least for
   hantek-dso/api.c. The patch is only for hantek-6xxx though.
2016-08-21 18:54:15 +02:00
Sebastian Zagrodzki 7f46b27ef2 hantek-6xxx: sdi might be NULL - don't assign devc until !sdi is checked. 2016-08-21 18:54:09 +02:00
Mike Meyer 0d8a3063e3 hantek-6xxx: Fix the device scan to not scan the NULL entry. 2016-08-21 18:53:55 +02:00
Aurelien Jacobs bf85ea2110 drivers: don't try to access the sr_driver_list section with no driver compiled.
This closes bug #820.
2016-08-15 01:45:50 +02:00
Benjamin Larsson 5eb4ba29d0 hantek-6xxx: only show DC coupling for the Hantek device 2016-08-15 01:16:54 +02:00
Uwe Hermann af7f88242e hantek-6xxx: Fix some issues by using power-of-two data sizes.
There were issues when using non-power-of-two data sizes with e.g.
the Hantek 6022BE device. For example, on Windows the acquisition would
simply hang and never complete:

  hantek-6xxx: receive_transfer(): status LIBUSB_TRANSFER_ERROR received 0 bytes

The issue was reported by Erik Montnemery on the mailing list, the
original patch was posted by "mmark" here (thanks!):

  http://www.eevblog.com/forum/testgear/sainsmart-dds120-usb-oscilloscope-(buudai-bm102)/msg911729/#msg911729

The issue has been verified by me on Windows and Linux, and also that
this change does indeed fix it (tested Hantek 6022BE and Sainsmart DDS120).

Neither PulseView nor sigrok-cli hang anymore on Windows, and on Linux
the log messages suggest improvements as well:

  -hantek-6xxx: data_amount 712
  +hantek-6xxx: data_amount: 200 (rounded to power of 2: 512)

  -hantek-6xxx: receive_transfer(): calculated samplerate == 2327ks/s
  -hantek-6xxx: receive_transfer(): status LIBUSB_TRANSFER_OVERFLOW received 512 bytes.
  +hantek-6xxx: receive_transfer(): calculated samplerate == 1969ks/s
  +hantek-6xxx: receive_transfer(): status LIBUSB_SUCCESS / LIBUSB_TRANSFER_COMPLETED received 512 bytes.

This fixes bug #821.
2016-08-15 00:58:10 +02:00
Uwe Hermann 236303160c Fix a segfault with input/output modules.
Some functions in std.c were using

  const char *prefix = sdi->driver->name;

but were called from input/output modules as well (which don't have
a "driver" field).

As a temporary workaround, use "unknown" as prefix in such cases until
a more permanent solution is implemented.

This fixes bug #813.
2016-07-17 19:39:04 +02:00
Aurelien Jacobs ced4827405 ensure the only entry point of libdrivers doesn't have visibility=hidden
This fixes the following build issue on OSX:
Undefined symbols for architecture x86_64:
  "_sr_drivers_init", referenced from:
      _sr_init in backend.o

This closes bug #802.
2016-07-12 23:57:00 +02:00
Thomas 2f4b0f6a82 Add VID/PID for the CWAV USBee ZX.
The hardware is identical to the SX.

This fixes bug #764.
2016-07-12 23:50:52 +02:00
Uwe Hermann 0cce2383bd fx2lafw: Set sr_analog_encoding.digits to 2 for now. 2016-07-03 23:38:29 +02:00
Uwe Hermann 2ab0679a34 fx2lafw: Fix analog scaling.
Thanks to Patrick Remy <patrick.remy2000@gmail.com> for the fix.
2016-07-03 23:03:52 +02:00
Uwe Hermann e8b5205bf3 session.c: Drop unneeded check.
The dev_acquisition_stop() callback is not optional and always present.
2016-07-03 16:41:16 +02:00
Uwe Hermann 0e5a287759 uni-t-dmm: Drop unused UNI_T_UT_D04_NEW #define. 2016-07-03 16:40:44 +02:00
Aurelien Jacobs 43185ed3dc agilent-dmm: add support for U128x 2016-06-26 20:32:56 +02:00
Aurelien Jacobs 9ae544b6ce agilent-dmm: add support for Keysight branded meters 2016-06-26 20:32:56 +02:00
Aurelien Jacobs 0fe18626bd agilent-dmm: add support for AC/DC flags in current mode 2016-06-26 20:32:56 +02:00
Aurelien Jacobs 96ed86253b agilent-dmm: fix handling of AC/DC flags in volts mode 2016-06-26 20:32:56 +02:00
Aurelien Jacobs 4435966e43 agilent-dmm: output correct number of digits in analog packets 2016-06-26 20:32:56 +02:00
Aurelien Jacobs 873c0d117f agilent-dmm: split DIOD recv_conf into model specific functions
This reduce overall number of lines and facilitate computation
of significant digits.
2016-06-26 20:32:56 +02:00
Aurelien Jacobs 40df76aacb agilent-dmm: replace divider by exponent to ease computing of significant digits 2016-06-26 20:32:56 +02:00
Aurelien Jacobs 28c95cc6c4 analog: add support for negative number of digits
When a meter display 105.2 kΩ, libsigrok will return 105200 Ω
but it is really valuable to know that the last 2 digits are not
significant, so encoding.digits should be set to -2.
This would allow a sigrok client to display 105200 as 105.2 k
instead of 105.200 k.
2016-06-26 20:32:56 +02:00
Soeren Apel 4d6d660b83 Logging: Filter out unwanted newlines
055804e89e changed the outgoing
SCPI message termination by always adding a newline. This results
in the following log output:

sr: [00:00.003102] scpi: Opening VXI device vxi/192.168.178.43.
sr: [00:00.005648] scpi_vxi: Successfully sent SCPI command: '*IDN?
'.
sr: [00:00.005931] scpi: Got response: 'YOKOGAWA,710130,91HC30402,F3.73', length 31.

This patch restores the previous unterminated SCPI message logging:

sr: [00:00.005462] scpi: Opening VXI device vxi/192.168.178.43.
sr: [00:00.007515] scpi_vxi: Successfully sent SCPI command: '*IDN?'.
sr: [00:00.007860] scpi: Got response: 'YOKOGAWA,710130,91HC30402,F3.73', length 31.

As it's located in the general logging mechanism, we deal with any
additional (and unwanted) newlines this way.
2016-06-26 18:57:24 +02:00
Aurelien Jacobs e264ebded8 rigol-ds: properly report which channel is enabled. 2016-06-26 18:57:24 +02:00
Aurelien Jacobs 9ea62f2e0a rigol-ds: add support for getting/setting trigger level. 2016-06-25 18:19:47 +02:00
Aurelien Jacobs 934cf6cf50 rigol-ds: add PROBE_FACTOR support. 2016-06-25 17:24:45 +02:00
Aurelien Jacobs 8719638f5a rigol-ds: split out vertical config reading in its own function for re-use. 2016-06-25 17:23:17 +02:00
Aurelien Jacobs 5d8b3913d4 group all drivers into a single object
This single object also contains the sr_drivers_init function, that will
always be referenced. That ensures that the drivers object files won't
be optimized out during static linking due to the fact that they are
not referenced directly.

This addresses (parts of) bug #802.
2016-06-18 15:40:32 +02:00
Uwe Hermann d1d3d2e0c4 output/analog: Drop unused fancyprint() and si_printf().
These functions were only used in the SR_DF_ANALOG_OLD case,
whereas the SR_DF_ANALOG case already used functions and lists
from src/analog.c.

This closes bug #636.
2016-06-17 15:13:12 +02:00
Uwe Hermann 24f4a9d50b session: Drop SR_DF_ANALOG_OLD support completely.
This closes bug #728.
2016-06-17 15:13:12 +02:00
Uwe Hermann 0f574e133c transform/scale: Drop support for SR_DF_ANALOG_OLD. 2016-06-17 15:13:12 +02:00
Uwe Hermann 09e269ce21 transform/invert: Drop support for SR_DF_ANALOG_OLD. 2016-06-17 15:13:12 +02:00
Uwe Hermann 23bdb1c997 output/analog: Drop support for SR_DF_ANALOG_OLD. 2016-06-17 15:13:12 +02:00
Uwe Hermann 5379fea5ef output/csv: Drop support for SR_DF_ANALOG_OLD. 2016-06-17 15:13:12 +02:00
Uwe Hermann c163438617 output/wav: Drop support for SR_DF_ANALOG_OLD. 2016-06-17 15:13:12 +02:00
Uwe Hermann 6cdb1da6c9 session_driver.c: Convert to SR_DF_ANALOG. 2016-06-17 15:13:12 +02:00
Uwe Hermann 8c67724084 libsigrok-internal.h: Convert to SR_DF_ANALOG. 2016-06-17 15:13:11 +02:00
Uwe Hermann 44040ea65e yokogawa-dlm: Convert to SR_DF_ANALOG. 2016-06-17 15:13:11 +02:00
Uwe Hermann 16544b3856 uni-t-ut32x: Convert to SR_DF_ANALOG. 2016-06-17 15:13:11 +02:00
Uwe Hermann dff60e3ccc uni-t-dmm: Convert to SR_DF_ANALOG. 2016-06-17 15:13:11 +02:00
Uwe Hermann f8467403e6 testo: Convert to SR_DF_ANALOG. 2016-06-17 15:13:11 +02:00
Uwe Hermann c8d9a71e43 teleinfo: Convert to SR_DF_ANALOG. 2016-06-17 15:13:11 +02:00
Uwe Hermann ffa2b6f96c serial-dmm: Convert to SR_DF_ANALOG. 2016-06-17 15:13:11 +02:00
Uwe Hermann 0de290a53e scpi-pps: Convert to SR_DF_ANALOG. 2016-06-17 15:13:11 +02:00
Uwe Hermann 94885d200d maynuo-m97: Convert to SR_DF_ANALOG. 2016-06-17 15:13:11 +02:00
Uwe Hermann ddfe99d92f motech-lps-30x: Convert to SR_DF_ANALOG. 2016-06-17 15:13:11 +02:00
Uwe Hermann 5ba417591c lascar-el-usb: Convert to SR_DF_ANALOG. 2016-06-17 15:13:11 +02:00
Uwe Hermann 2c9111820a kecheng-kc-330b: Convert to SR_DF_ANALOG. 2016-06-17 15:13:10 +02:00
Uwe Hermann 99f8fa2519 hung-chang-dso-2100: Convert to SR_DF_ANALOG. 2016-06-17 15:13:10 +02:00
Uwe Hermann ae7d8a58de hantek-dso: Convert to SR_DF_ANALOG. 2016-06-17 15:13:10 +02:00
Uwe Hermann 6cfb9729b0 gwinstek-gds-800: Convert to SR_DF_ANALOG. 2016-06-17 15:13:10 +02:00
Uwe Hermann f074822500 gmc-mh-1x-2x: Convert to SR_DF_ANALOG. 2016-06-17 15:13:10 +02:00
Uwe Hermann a6ad49b39f fx2lafw: Convert to SR_DF_ANALOG. 2016-06-16 15:05:04 +02:00
Uwe Hermann a8372c3ed9 colead-slm: Convert to SR_DF_ANALOG. 2016-06-16 15:05:04 +02:00
Uwe Hermann 4b770103e9 demo: Convert to SR_DF_ANALOG. 2016-06-16 15:05:04 +02:00
Uwe Hermann 7f9932e8db cem-dt-885x: Convert to SR_DF_ANALOG. 2016-06-16 15:05:04 +02:00
Uwe Hermann 3f5cf2a06a fluke-dmm: Convert to SR_DF_ANALOG. 2016-06-16 15:05:03 +02:00
Uwe Hermann 1653c4309a brymen-dmm: Convert to SR_DF_ANALOG. 2016-06-16 15:05:03 +02:00
Uwe Hermann a46f869b64 brymen-bm86x: Convert to SR_DF_ANALOG. 2016-06-16 15:05:03 +02:00
Uwe Hermann 633531416b baylibre-acme: Convert to SR_DF_ANALOG. 2016-06-16 15:05:03 +02:00
Uwe Hermann 55bee166eb norma-dmm: Convert to SR_DF_ANALOG. 2016-06-16 15:05:02 +02:00
Uwe Hermann 67eb7c6bdf atten-pps3xxx: Convert to SR_DF_ANALOG. 2016-06-16 15:05:02 +02:00
Uwe Hermann 0417ada03e appa-55ii: Convert to SR_DF_ANALOG. 2016-06-16 15:05:02 +02:00
Uwe Hermann 16aef67634 agilent-dmm: Convert to SR_DF_ANALOG. 2016-06-16 15:05:02 +02:00
Uwe Hermann d4f59ce86d center-3xx: Convert to SR_DF_ANALOG. 2016-06-16 15:05:02 +02:00
Uwe Hermann 563ba4a5c2 kern-scale: Convert to SR_DF_ANALOG. 2016-06-16 15:05:01 +02:00
Uwe Hermann 246399f788 rigol-ds: Convert to SR_DF_ANALOG. 2016-06-16 15:05:01 +02:00
Uwe Hermann 2e71534118 korad-kaxxxxp: Convert to SR_DF_ANALOG. 2016-06-16 15:05:01 +02:00
Uwe Hermann 2938c9d1d3 hantek-6xxx: Convert to SR_DF_ANALOG. 2016-06-16 15:05:01 +02:00
Uwe Hermann 2463ec77fe manson-hcs-3xxx: Convert to SR_DF_ANALOG. 2016-06-16 15:05:01 +02:00
Uwe Hermann c68ade3cc7 tondaj-sl-814: Convert to SR_DF_ANALOG. 2016-06-16 15:05:01 +02:00
Uwe Hermann b02bb45f4c dmm: Convert to SR_DF_ANALOG. 2016-06-16 15:05:00 +02:00
Uwe Hermann 7ffcf58736 lcr: Convert to SR_DF_ANALOG. 2016-06-16 15:05:00 +02:00
Uwe Hermann c6d527478a scale: Convert to SR_DF_ANALOG. 2016-06-15 19:33:48 +02:00
Uwe Hermann 0f33aaef54 input/wav: Convert to SR_DF_ANALOG. 2016-06-15 19:33:48 +02:00
Yasushi SHOJI 716d6dfcac zeroplus: Fix config_list() wrt drvopts/devopts.
When config_list() gets NULL as sdi, it must return driver opts.
Some drivers, including zeroplus, don't check sdi and return both
driver opts and device opts.
2016-06-11 17:09:34 +02:00
Uwe Hermann 3ba944cf41 sw_limits: Log when the sample/time limit is reached. 2016-06-01 15:25:15 +02:00
Lars-Peter Clausen 4b1a9d5d86 Remove unnecessary std_serial_dev_acquisition_stop() wrappers
Now that std_serial_dev_acquisition_stop() has the same signature as
the sr_dev_driver dev_acquisition_stop() callback it is possible to remove
the wrapper functions and use std_serial_dev_acquisition_stop() directly
has the callback function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-31 15:54:53 +02:00
Lars-Peter Clausen 1b38775baa std_serial_dev_acquisition_stop(): Remove dev_close_fn parameter
All callers of std_serial_dev_acquisition_stop() currently pass the same
callback for the dev_close_fn parameter as the dev_close callback of their
sr_dev_driver struct. Remove the dev_close_fn parameter and invoke the
drivers dev_close() callback directly. This simplifies the API and ensures
consistent behaviour between different drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen 15f96409dc std_serial_dev_acquisition_stop(): Remove serial parameter
All callers of std_serial_dev_acquisition_stop() currently pass sdi->conn
for the serial parameter. And the other std_serial helper functions already
require that the conn field of the sr_driver_inst passed to the functions
points to the sr_serial_dev_inst associated with the device.

Modify std_serial_dev_acquisition_stop() to follow the same pattern and
remove the serial parameter. This simplifies the API and ensures consistent
behaviour between different drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen bee2b0168c Use driver name as the log prefix in standard functions
Some of the standard helper functions take a log prefix parameter that is
used when printing messages. This log prefix is almost always identical to
the name field in the driver's sr_dev_driver struct. The only exception are
drivers which register multiple sr_dev_driver structs.

Instead of passing the log prefix as a parameter simply use the driver's
name. This simplifies the API, gives consistent behaviour between different
drivers and also makes it easier to identify where the message originates
when a driver registers sr_dev_driver structs.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen 7d786a962d pce-322a: Pass driver dev_close callback std_serial_dev_acquisition_stop()
All drivers with the exception of pce-322a pass their dev_close callback to
std_serial_dev_acquisition_stop(). The pce-322a passes std_serial_dev_close()
which is also called from its dev_close() callback and replicates the other
functionality of its dev_close() callback directly in
std_serial_dev_acquisition_stop().

Refactor this to pass the dev_close callback function directly to
std_serial_dev_acquisition_stop(). This makes sure that the driver is
consistent with other drivers and also removes duplicated code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen 580b94e4d7 sw_limits: Add documentation
Add documentation for the software limits module.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen 3c41387928 gmc-mh-1x-2x: Use software limits helpers
Use the new software limit helper functions rather than open-coding their
functionality.

This also fixes the issue that driver the does not reset all the limit
statistics in acquisition_start().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen 6aacf011de fluke-dmm: Use software limits helpers
Use the new software limit helper functions rather than open-coding their
functionality.

This also fixes the issue that the driver does not reset the limit
statistics in acquisition_start(). It also makes the time limit work, which
previously was only a stub implementation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen 014c7f93d4 arachnid-labs-re-load-pro: Use software limit helpers
Use the new software limit helper functions rather than open-coding their
functionality.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen 5b6829eafe agilent-dmm: Use software limits helpers
Use the new software limit helper functions rather than open-coding their
functionality.

This also fixes the issue that the driver does not reset the limit
statistics in acquisition_start(). It also makes the time limit work, which
previously was only a stub implementation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-31 15:54:46 +02:00
Lars-Peter Clausen eabfed20f7 norma-dmm: Remove unused version field from state struct
The version field in the norma-dmm driver state struct is initialized, but
never read and the same information is also already available in the
sr_dev_inst struct version field. So remove it to simplify the code.

This allows to get rid of the custom dev_close() callback and just use the
standard std_serial_dev_close() instead.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-28 12:52:05 +02:00
Uwe Hermann cd0de200b1 Fix a few "variable set but not used" compiler warnings.
../src/hardware/appa-55ii/api.c: In function ‘scan’:
../src/hardware/appa-55ii/api.c:47:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/arachnid-labs-re-load-pro/api.c: In function ‘scan’:
../src/hardware/arachnid-labs-re-load-pro/api.c:62:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/atten-pps3xxx/api.c: In function ‘scan’:
../src/hardware/atten-pps3xxx/api.c:81:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/brymen-dmm/api.c: In function ‘scan’:
../src/hardware/brymen-dmm/api.c:89:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/cem-dt-885x/api.c: In function ‘scan’:
../src/hardware/cem-dt-885x/api.c:74:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/conrad-digi-35-cpu/api.c: In function ‘scan’:
../src/hardware/conrad-digi-35-cpu/api.c:45:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/demo/demo.c: In function ‘scan’:
../src/hardware/demo/demo.c:255:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/fluke-dmm/api.c: In function ‘fluke_scan’:
../src/hardware/fluke-dmm/api.c:64:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/gmc-mh-1x-2x/api.c: In function ‘scan_1x_2x_rs232’:
../src/hardware/gmc-mh-1x-2x/api.c:147:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/gmc-mh-1x-2x/api.c: In function ‘scan_2x_bd232’:
../src/hardware/gmc-mh-1x-2x/api.c:234:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/ikalogic-scanaplus/api.c: In function ‘scan’:
../src/hardware/ikalogic-scanaplus/api.c:69:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/tondaj-sl-814/api.c: In function ‘scan’:
../src/hardware/tondaj-sl-814/api.c:44:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
2016-05-27 15:11:28 +02:00
Uwe Hermann 39fcfdc9da std_scan_complete(): Catch some errors to avoid segfaults.
Check some variables for NULL before dereference to avoid segfaults due
to buggy drivers (and show error messages so these issues are noticed early).
2016-05-27 14:45:26 +02:00
Lars-Peter Clausen 43376f3324 Simplify single device list handling
Some driver scan() functions only ever return a single device. For those it
is possible to slightly simplify the handling of the device list by
creating it on demand when the function returns.

Some drivers also have the following expression:
	devices = g_slist_append(devices, sdi);
	...
	if (!devices)
		...

This check will never evaluate to false so it is dropped as well.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-27 14:44:24 +02:00
Lars-Peter Clausen 15a5bfe481 Add helper function for scan completion
A common task during device scan is to add the newly discovered devices to
the instance list of the driver. Currently this is done by each driver on
its own. This patch introduces a new helper function std_scan_complete()
which takes care of this. The function should be called at the end of a
driver's scan() callback before returning the device list.

Doing this with a helper function provides guaranteed consistent behaviour
among drivers and hopefully paves the way to moving more standard
functionality directly into the sigrok core.

Another common task that every driver has to do for each device instance is
to initialize the device's driver field. So this is done in the new helper
function as well.

All drivers that can make use of the new helper are updated.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-27 14:44:24 +02:00
Lars-Peter Clausen 566007e15e Don't reset instance list in scan() callback
Some drivers set the device instance list to NULL in their scan() callback.
This means the driver loses all references to any devices contained in that
list and their resources will be leaked. Drivers can't free the devices at
this point either since an application might still use a device on the
list. So the existing devices on the instance list need to remain
unmodified during the scan() callback, even if that means that there will
be duplicates on the instance list. Only an explicit invocation of
sr_dev_clear() by the application is allowed to free the devices on the
instance list and reset the list.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-27 14:43:34 +02:00
Uwe Hermann 176d18cab1 testo: Minor indentation fixes. 2016-05-26 17:47:28 +02:00
Lars-Peter Clausen f53ff64369 link-mso19: mso_receive_data: Simplify device instance lookup
The link-mso19 driver currently iterates the device instance list of the
driver to get the device instance for which the callback is called.

But the device instance is actually passed to the callback as the cb_data
parameter, so just use that instead and remove the lookup loop.

Besides that the current lookup loop does not even compile either.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-23 18:25:24 +02:00
Lars-Peter Clausen e5ff8e9e0a link-mso19: Use default dev_clear() handler
The link-mso19 open-codes the std_dev_clear() function and uses it as its
custom dev_clear() callback. The std_dev_clear() function is automatically
called if no custom dev_clear() callback is specified, so just drop custom
implementation and use the default.

This also fixes a memory leak where the link-mso19 driver did not properly
free its driver state struct in the dev_clear() callback.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-23 18:24:58 +02:00
Lars-Peter Clausen f1e93a951e link-mso19: Drop unnecessary NULL check
sdi is allocated using g_malloc0() which can never fail, in addition to
that sdi is already dereferenced before the check, which makes the check
useless. So remove it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-23 18:24:23 +02:00
Alexandru Gagniuc e76a357536 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.
2016-05-19 08:16:51 -07:00
Alexandru Gagniuc c2af709b01 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.
2016-05-19 08:16:46 -07:00
Marcus Comstedt cb193a2093 saleae-logic16: Consolidate the samplerate limits into a single bitrate cap 2016-05-18 23:12:49 +02:00
Marcus Comstedt 41dab43ef9 saleae-logic16: Add 20MHz and 50MHz to samplerate preset list (bug #799) 2016-05-18 23:12:38 +02:00
George Hopkins 5a2c71ccd7 pce-322a: Initial driver implementation. 2016-05-18 18:28:08 +02:00
Lars-Peter Clausen 634d72997a 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 <lars@metafoo.de>
2016-05-18 18:15:33 +02:00
Lars-Peter Clausen 07a917521a ftdi-la: Cleanup ftdi_context handling
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-18 17:42:52 +02:00
Uwe Hermann 0350e2e030 lascar-el-usb: Add a missing SR_PRIV. 2016-05-18 01:41:55 +02:00
Lars-Peter Clausen dd5c48a6d5 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 <lars@metafoo.de>
2016-05-18 01:41:55 +02:00