Commit Graph

4388 Commits

Author SHA1 Message Date
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 f05903ebe3 serial-lcr: update README.devices (firmware upload, comm port specs)
Catch up with the rename of deree-de5000 to serial-lcr. Put an item in
the "needs a comm port spec" section, too.
2016-12-26 13:14:26 +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
Uwe Hermann 8626feaeb5 HACKING: Improve description of Doxygen conventions. 2016-12-20 17:51:36 +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
Marcus Comstedt 9d8f363d35 Bindings: Link C++ code with gnustl_shared if it exists (Android) 2016-12-06 21:05:15 +01:00
Marcus Comstedt e83a8f4958 Java: Use correct JNI function when calling Vector.add 2016-12-06 21:04: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
Vadim A. Misbakh-Soloviov 104f02fda1 Makefile: fix for #865.
Buildsystem wants CXX to be defined as $(CXX).
Otherwise it fallbacks to default value, which does not contain
"-std=c++11" statement.

Other changes (like CC=$(CC) and CFLAGS=$(CFLAGS) instead of CXX ones)
is not directly fix the issue, but fix cases, where CFLAGS (and CC)
differs from CXX* ones, so it could lead to similar errors in the future.
2016-12-05 01:37:54 +01:00
Marcus Comstedt f504779c12 Bindings: Make Ruby bindings build with Ruby 2.0
The alias "rb_ary_new_from_args" for "rb_ary_new3" was not introduced
until in Ruby 2.1.
2016-12-05 01:10:37 +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