Commit Graph

5139 Commits

Author SHA1 Message Date
Wolfram Sang 6745488b1a ols: remove needless initialization
channel_mask is recalculated before it gets accessed, so this
initialization is not needed.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2019-01-13 20:07:27 +01:00
Wolfram Sang 082537602a ols: remove unused define
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2019-01-13 20:07:27 +01:00
Gerhard Sittig f0e6b41f7a uni-t-ut32x: rephrase the receive buffer and packets relation
The previous implementation assumed that a receive data chunk ends
exactly with a sensor packet's end. Yet the buffer had 32 bytes while
the packets have 19 bytes.

Separate the data reception from the packet processing. Collect whatever
chunks the USB connection provides, and scan the resulting buffer for
packets. Cope with either incomplete or corrupt or misaligned packets as
well as with multiple packets in receive chunks. The latter might happen
upon initial synchronization, when a device already sends data or the
serial port buffered previously communicated data.

In the regular case, the computer will process so fast that each single
character will be handled individually. We don't mind. The frequency is
some 60 times per second, and the data volume is 19 bytes. The software
works for the regular case, and synchronizes fast at startup or after
comm errors.
2019-01-13 19:34:10 +01:00
Gerhard Sittig a0ba75bda2 uni-t-ut32x: improve robustness of packet parser, more diagnostics
Always print the data bytes of received buffers in the packet parser,
then check some more fixed fields to not process invalid packets, then
process the packet content as the previous implementation did.

Call the packet parser for incomplete packets and discarded input
buffers as well (initial synchronization, re-sync after comm errors).
This results in the availability of more diagnostics during development.

Pass the packet's location and size from outside. This prepares the
logic to cope with situations where the receive buffer contains multiple
(potentially incomplete) packets.
2019-01-13 19:34:10 +01:00
Gerhard Sittig 4b3197828d uni-t-ut32x: use ASCII literals in packet parser, symbols for magic numbers
Slightly unobfuscate the UT32x packet parser. The protocol is mostly
ASCII based, checks for hex numbers may be unexpected. Use symbolic
identifiers for the packet length and some special characters.
2019-01-13 19:34:10 +01:00
Gerhard Sittig 2631d9320d uni-t-ut32x: comment on the "T1-T2" channel name (looks like a range) 2019-01-13 19:34:10 +01:00
Gerhard Sittig 9e11197246 uni-t-ut32x: use common code for sw limits, minor data type fixup (data source) 2019-01-13 19:34:10 +01:00
Gerhard Sittig bf700f679a uni-t-ut32x: pre-set to default conn= spec
The previous implementation of the UT32x driver expected to see a conn=
spec, without it no device is found. Default to the USB identification
of the CH9325 chip, to make the driver work out of the box. Users still
can provide conn= specs and override the default for other cables.
2019-01-13 19:34:10 +01:00
Gerhard Sittig de805ae50d doc: update README.devices (USB detection, enable serial comm)
Slightly rephrase README.devices since there is no strict distinction
into "fully automatic" and "always manual". Some drivers _accept_ conn=
specs when provided, _and_ support automatic detection of enumerable
devices, _and_ might implement defaults but also support overrides.

Nit, numerically sort the list of Uni-T cables (which is about to grow
in the future) for improved readability.

Add two more devices which require users to manually enable the serial
communication (Brymen BM257s, EEVBlog 121GW).
2019-01-13 19:34:10 +01:00
Martin Ling ea7a83a437 bindings: Add Output::format() 2018-12-30 14:10:13 +01:00
Martin Ling 47b821dc7d rigol-ds: Fix memory buffer readout on DS4000 series. 2018-12-29 03:24:23 +01:00
majekw e150d55046 Add support for YiXingDianZi MDSO in hantek-6xxx driver. 2018-12-28 13:49:33 +01:00
Mike Williams c3bfb95959 scpi-pps: add support for BK Precision 9130 2018-12-28 13:10:05 +01:00
Mike Williams 08e8c0e5bf scpi-dmm: add experimental Keysight 34465A support
Tested DC current, DC voltage, and resistance. Instrument gives an error
only on first measurement but the output of the measurements is correct.
2018-12-28 13:10:05 +01:00
Uwe Hermann 0bad836f95 contrib/60-libsigrok.rules: Mention FT232H/ftdi-la item. 2018-12-28 13:01:45 +01:00
Paul c7a51272a5 ftdi-la: added FT232H device ID 2018-12-28 13:01:03 +01:00
Martin Ling a9ed2eb069 bindings: Add new Context::create_end_packet() method. 2018-12-28 12:47:59 +01:00
Martin Ling 62bd644f55 python: Add override for Context.create_logic_packet() 2018-12-28 12:47:59 +01:00
Gerhard Sittig 6f7e15090e dmm/eev121gw: fix a typo in a comment 2018-12-27 11:26:19 +01:00
Gerhard Sittig fbbf21dcf5 pickit2: avoid NULL dereference in close code path 2018-12-27 11:26:19 +01:00
Daniel Anselmi f3549a1ccf ipdbg-la: Check if limit samples is valid (leq size of ringuffer) 2018-12-27 11:26:02 +01:00
Martin Ling 942719b46c Don't reference SR_PACKAGE_VERSION_STRING directly in backend.c.
Reporting build versus runtime versions makes sense for a client,
but not inside the library itself.
2018-12-20 19:12:34 +01:00
Martin Ling 2868bca35b Don't reference SR_PACKAGE_VERSION_STRING directly in output modules. 2018-12-20 19:12:34 +01:00
Uwe Hermann 3f34a40268 drivers: Make per-driver sr_dev_driver structs static. 2018-12-20 17:29:36 +01:00
Uwe Hermann 3aadf5c479 microchip-pickit2: Drop unneeded prefix. 2018-12-20 16:36:09 +01:00
Uwe Hermann e760f2cdaf microchip-pickit2: Minor cosmetics. 2018-12-20 16:36:09 +01:00
Gerhard Sittig bde6a99b33 microchip-pickit2: first driver implementation (acquisition works, triggers don't)
Fill in the scan, open/close, get/set/list, acquisition start/stop logic
such that data acquisition with a PICkit2 works.

Trigger support needs more attention. User specified triggers either
seem to not take effect, or the trigger position is not in the expected
location. It's yet to get determined what's the issue.

This implementation is based on protocol information gathered from the
pk2-la project.
2018-12-20 16:19:42 +01:00
Gerhard Sittig a5c0259c4a microchip-pickit2: Initial driver skeleton. 2018-12-20 16:19:42 +01:00
Gerhard Sittig d9a3c0b749 brymen-bm86x: drop redundant free call, fixup channel index
Remove a free() call in an error path for a list which immediately
before the call was determined to be NULL. Use index 0 and 1 for
channels P1 and P2 respectively (the previous implementation used 0
for both channels).
2018-12-20 16:19:42 +01:00
Gerhard Sittig 2887799404 scpi-dmm: run OPC queries immediately before essential commands
The current implementation of the SCPI DMM driver is conservative about
checking the device's being operational, but the *OPC? queries are found
in unfortunate locations. Run the OPC query right before running the
next "actual" command, not afterwards. And certainly not between sending
requests and potentially gathering responses in subsequent calls.

This commit does not change current behaviour, but improves maintenance
before pending commits.
2018-11-17 20:19:13 +01:00
Gerhard Sittig 08f3b427b6 scpi-dmm: return MQ table entry to "get MQ" routine callers
The "get MQ" helper routine communicates SCPI responses and translates
them to internal "MQ and flag" values. Optionally return the MQ table
entry reference to callers, so they don't have to repeat the table
lookup when the function's default precision is required, or should
future "start acquisition" requests need to refer to the meter's current
function.
2018-11-17 20:19:13 +01:00
Gerhard Sittig 64d03de1c2 scpi-dmm: adjust MQ table for Agilent 34405A
Rename the table to reflect that it's model specific. Remove the 4-wire
resistance function which this device does not support.
2018-11-17 20:17:48 +01:00
Gerhard Sittig 1d2f9963ab scpi-dmm: add support for model specific device options
Supported SCPI DMM devices will differ in the set of options and whether
parameters can get queried or configured. Use a "generic" set of devopts
during scan and for simpler models, prepare support for other sets of
devopts for more complex models.
2018-11-17 20:08:59 +01:00
Gerhard Sittig 31e65c62ec scpi-dmm: accept serialcomm= scan options 2018-11-17 20:08:59 +01:00
Gerhard Sittig 21bc4353f0 scpi: alpha-sort the vendor alias list 2018-11-17 20:07:21 +01:00
Gerhard Sittig 49b6732ec5 scpi: add Keysight vendor alias 2018-11-17 20:07:21 +01:00
Gerhard Sittig 0617bb5a4e scpi-dmm: move declaration of local variable out of header file 2018-11-17 20:07:21 +01:00
Michał Janiszewski 3e33089b72 Remove always-false condition 2018-11-10 23:20:29 +01:00
Sven Bursch-Osewold 4905215909 Python-Binding: Added data array for logic packet payload 2018-11-10 23:20:16 +01:00
Gerhard Sittig 3cdad416e4 scpi-dmm: Implement support for Agilent 34405A, prepare others
Implement the scpi-dmm driver in such a generic way that it could work
with several protocol variants and with differing models which happen to
use any of these protocol variants. Prepare a list of supported models
with their respective SCPI command set, set of DMM functions and their
precision.

Add support for Agilent 34405A. The ten functions of this device got
tested and are operational, in continuous mode as well as with sample
count or capture time limits. The driver can query the current meter's
function, can change the function, and can run acquisitions in either
the current mode or with a user specified function selection. There is
some potential for improvement: AUTO/MIN/MAX/HOLD indicators are not
supported by this implementation.
2018-11-10 23:14:49 +01:00
Gerhard Sittig 7a396ff5c5 scpi-dmm: Initial driver skeleton. 2018-11-10 20:11:35 +01:00
Gerhard Sittig a1ce15d4a1 scpi: nit, use glib to determine string vector length
Replace a DIY length calculation with a glib call.
2018-11-10 20:11:35 +01:00
Gerhard Sittig a019bc48fd scpi: introduce string un-quote helper routine
The SCPI protocol may communicate strings in quoted form, enclosed by a
matching pair of single or double quote characters, and occurances of
this very quote character within the string get doubled (escaped). Add a
common routine to undo the quotes.
2018-11-10 18:26:30 +01:00
Gerhard Sittig c10b0276da fluke-45: fix minor memory leaks in the probe routine
Free the SCPI hardware info after successful model detection, too. Only
allocate the device instance when a supported model was found. Link the
device context earlier right after allocation, for easier verification.
2018-11-10 18:26:30 +01:00
Gerhard Sittig 71db2d4d06 fluke-45: disable ECHO test, it confuses other SCPI devices
Disable the ECHO test in the Fluke 45 probe routine which violates the
SCPI protocol and makes other devices unavailable. This fixes bug #1272.
2018-11-10 18:26:30 +01:00
Gerhard Sittig 712f7d5e40 fluke-45: avoid NULL dereference in the probe routine
The Fluke 45 probe routine tries to detect whether the serial port is
"in echo mode" (which already is questionable before the IDN query).
In the absence of a response, the library segfaults. Fix it.
2018-11-10 18:26:30 +01:00
Gerhard Sittig 88c03eae85 README.devices: add example for -d driver:conn=usbtmc/bus.addr 2018-11-10 18:26:30 +01:00
Jon Burgess 3940abcb47 Free list returned by sr_session_dev_list()
==214948== 16 bytes in 1 blocks are definitely lost in loss record 161 of 6,440
==214948==    at 0x4C2EE0B: malloc (vg_replace_malloc.c:299)
==214948==    by 0x650F435: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x6527056: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x65284B0: g_slist_copy_deep (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x592BBA6: sr_session_dev_list (session.c:402)
==214948==    by 0x56EF7B5: sigrok::Session::Session(std::shared_ptr<sigrok::Context>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (classes.cpp:932)

==214948== 16 bytes in 1 blocks are definitely lost in loss record 162 of 6,440
==214948==    at 0x4C2EE0B: malloc (vg_replace_malloc.c:299)
==214948==    by 0x650F435: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x6527056: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x65284B0: g_slist_copy_deep (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x592BBA6: sr_session_dev_list (session.c:402)
==214948==    by 0x56F1EB1: sigrok::Session::devices() (classes.cpp:967)
2018-10-22 00:02:40 +02:00
Uwe Hermann 827139ef49 siglent-sds: Consistently use gboolean/TRUE/FALSE. 2018-10-21 23:33:15 +02:00
Guido Trentalancia fa3d104f17 Additional USB PID for Rohde&Schwarz HMO series mixed-signal oscilloscopes
Add another possible USB PID for Rohde&Schwarz HMO series mixed-signal
oscilloscopes (previously branded Hameg).
2018-10-21 23:32:07 +02:00