Commit Graph

5040 Commits

Author SHA1 Message Date
Gerhard Sittig 2fba14d05a udev: drop links to device/cable wiki pages from udev rule set 2019-06-04 18:59:04 +02:00
Gerhard Sittig 4ae1ab4555 udev: mark SiLabs CP2102 as generic, add SiLabs CP2110
The CP210x USB to UART bridge is not specific to CEM DT-8852, it's a
generic bridge chip that is also used in other cables and devices. Add
the CP2110 USB HID to UART bridge that is found in UNI-T cables and
devices, and reported to also be used in Voltcraft devices.
2019-06-04 18:59:04 +02:00
Gerhard Sittig 575663ab6a udev: add 'hidraw' subsystem to 60-libsigrok.rules
WCH CH9325 and SiL CP2110 chips (and other HID cables) won't match the
currently used 'usb' subsystem when the platform registers these as
'hidraw' devices. Adjust the 60-libsigrok.rules SUBSYSTEM condition.
2019-06-04 18:59:04 +02:00
Gerhard Sittig f9c3df65c1 doc: discuss how to enable PC communication on LCR meters 2019-06-04 18:59:04 +02:00
Gerhard Sittig e2a391aabc doc: outline conn= specs for HID and Bluetooth in README.devices
Add more examples of conn= specs for HID and Bluetooth devices to the
section which discusses COM ports. Outline the formal syntax and its
optional fields. Discuss how colons in device addresses interfere with
"-d <drv>:conn=<spec>" environments.
2019-06-04 18:59:04 +02:00
Gerhard Sittig 0ec42cbdb2 doc: update README, optional conn= specs for UNI-T meters
Recent adjustment in the libsigrok serial layer changed whether conn=
specs are mandatory or optional for some of the UNI-T meters.
2019-06-04 18:53:04 +02:00
Gerhard Sittig 07e42cb2cb doc: update README for serial over Bluetooth
Mention the optional external BlueZ dependency. Provide conn= examples
for Bluetooth communication. Mention the UT-D07 adapter.
2019-06-04 18:53:04 +02:00
Gerhard Sittig b79c342278 serial_bt: implement the serial over Bluetooth transport (conn=bt/...)
Introduce the serial_bt.c source file which implements the methods of a
serial transport and calls into the platform agnostic src/bt/ support
code.

Implement support for several chips and modules: RFCOMM (BT classic,
tested with HC-05), BLE122 (tested with 121GW), Nordic nRF51, and TI
CC254x (the latter untested). Read support is assumed to be complete,
write support for BLE may be incomplete due to lack of access to
hardware for tests.
2019-06-04 18:53:04 +02:00
Gerhard Sittig 7c8ae47dcb bluetooth: introduce Bluetooth communication API, implement BlueZ support
Create a src/bt/ subdirectory for source files. Declare a platform
agnostic internal API for Bluetooth communication, and provide an
implementation of that portable API when the BlueZ library is available.

This implementation assumes that HAVE_BLUETOOTH and HAVE_LIBBLUEZ can be
used interchangeably, which is true for this initial version. When
support for other platforms gets added, the common and the specific
parts need to get sorted. Trying that now would involve guessing. :)
2019-06-04 18:52:40 +02:00
Gerhard Sittig f085705f48 build: prepare serial over Bluetooth, search for optional BlueZ lib
Adding Bluetooth communication is desirable for all sigrok supported
platforms. The BlueZ library is available on Linux which will receive
support first. Check for the BlueZ library's presence, determine a
HAVE_BLUETOOTH summary state, and extend the HAVE_SERIAL_COMM check.
Print version details for the external library.

This commit extends build support and version information, but does not
yet include the implementation of the serial transport primitives.
2019-06-02 20:39:02 +02:00
Gerhard Sittig f736691d13 doc: mention serial-over-HID in README.devices (UT-D09 cable) 2019-06-02 20:39:02 +02:00
Gerhard Sittig 6e407e9850 serial-lcr: add driver item for the UNI-T UT612 model
Register another driver for the UNI-T UT612 LCR meter, which is based on the
ES51919/ES51920 chipset, too. This device had been usable before when the
internal UART connection was made accessible (read: with a hack). It became
officially supported in unmodified form with the addition of transparent
serial over HID support for SiLabs CP2110 chips.
2019-06-02 20:39:02 +02:00
Gerhard Sittig 164c5ae537 uni-t-ut32x: migrate from USB transfers to serial-over-HID communication
Switch the UT32x driver from running specific USB transfers to generic
serial communication. Preset the bitrate and frame format, but allow for
user specified overrides as well. Default to the WCH CH9325 HID chip,
but allow for overrides or more specific selection so that users can
resolve ambiguities with multiple cables.

The switch from libusb to hidapi removes a limitation that specifically
was reported for the Mac platform. The serial-over-HID variant should
now work as well. See bug #555.

Drop the background transfers. Stick with a local acquisition stop
routine, because a STOP request needs to get sent to the device. Reduce
the receive buffer size such that either blocking or non-blocking calls
will work. The additional flexibility of the buffer handling and packet
processing does not harm.
2019-06-02 20:39:02 +02:00
Gerhard Sittig 616bc3a170 serial_hid: add support for the SiLabs CP2110 chip (UT-D09, UT612)
Also reported to be seen in Voltcraft devices (VC-650, VC-890).
2019-06-02 20:39:02 +02:00
Gerhard Sittig 828eeea227 serial_hid: add support for the WCH CH9325 chip (UT-D04 cables, UT32x) 2019-06-02 20:39:02 +02:00
Gerhard Sittig edec0436db serial_hid: implement serial over HID transport
Do implement the transport methods for serial communication underneath
the common layer, by communicating HID requests and payload data by
means of HIDAPI library calls.

This commit adds the common logic of serial-over-HID communication and
implements the full internal serial transport API, including reception
in the background. But it does not yet support a single HID chip (which
each run their own proprietary protocol).

The implementation works with either hidapi-libusb or hidapi-hidraw
variant of the HIDAPI library, but was only tested on Linux.
2019-06-02 20:39:02 +02:00
Gerhard Sittig 4417074c68 serial: prepare serial over HID in common layer and build support
Search for the optional HIDAPI library. Call the library's init and exit
routine, and print version information. Extend the common serial layer's
code paths for open, list, and find USB to also support serial over HID.

This commit prepares serial over HID, but the HIDAPI specific transport
for serial communication still is empty in this implementation.
2019-06-02 20:39:02 +02:00
Gerhard Sittig ad5aa993ae serial: introduce local receive data buffer
Add a local RX buffer to the common code of libsigrok's serial layer.
Callers of the serial layer's API won't notice, this is an internal
detail of how alternative transports receive their data from the
physical line, and pass it to read() calls emitted by device drivers.

The libserialport specific code still calls into the library, and does
not use the RX buffer. Future HID and BLE support will use the buffer.
2019-06-02 20:39:02 +02:00
Gerhard Sittig 48b7c34629 serial: make LCR, modbus, SCPI over serial depend on generic serial comm
Add guards around the implementation of ES51919 chip support for LCR, as
well as modbus and SCPI over serial. To accept when the source files get
compiled in the absence of their dependencies, end up with an empty
implementation in that case.

This approach can simplify build rules when several optional external
dependencies result in differing sets of supported communication means.
2019-06-02 20:39:02 +02:00
Gerhard Sittig 1ac8c2181b serial: prepare for the absence of libserialport
Only reference the libserialport header when the library is available.
Allow to always compile the serial.c source file, but optionally end
up with an empty implementation. Make the sr_serial_dev_inst symbol
available outside of HAVE_SERIAL_COMM such that empty stub code can
compile. This prepares the introduction of alternative transports for
serial communication, while all of them remain optional.

The libsigrok serial layer internally uses parity and flow control
symbols which are provided by libserialport. Optionally locally declare
these symbols when libserialport is not available.
2019-06-02 20:39:02 +02:00
Gerhard Sittig bb15350e59 configure: make device drivers depend on "serial comm" not libserialport
A previous commit introduced the more generic "have serial communication"
condition, and adjusted the list of available libsigrok dependencies.

This commit adjusts device driver dependency declarations. This allows
to build e.g. DMM drivers in the presence of RFCOMM support but in the
absence of libserialport, because any of several optional external libs
can make serial communication available.
2019-06-02 20:39:02 +02:00
Gerhard Sittig 1df81f4b06 serial: introduce more general "have serial comm" feature flag
Introduce the HAVE_SERIAL_COMM identifier, which gets derived from, but
need not be identical to the HAVE_LIBSERIALPORT condition.

Derive the NEED_SERIAL automake condition from the general availability
of serial communication not the specific libserialport library.

Adjust source code references. Stick with HAVE_LIBSERIALPORT where the
specific library is meant, but switch to HAVE_SERIAL_COMM where the
availability of serial communication in general is meant.
2019-06-02 20:39:02 +02:00
Gerhard Sittig a7b8692ed0 serial: prepare alternative transports for serial communication
Add an indirection between the common serial communication code and the
libserialport specific support code. Prepare the use of alternative
transports like USB HID in the future. Decide in the open() routine
which transport to use for subsequent operations (based on port names).

In theory only the transport specific layer depends on the libserialport
library's availability. In this implementation all support for serial
communication still depends on the HAVE_LIBSERIALPORT preprocessor
symbol. This needs to get addressed in later commits.
2019-06-02 20:39:02 +02:00
Gerhard Sittig f992151332 ols: use serial layer's "has receive data" query
Eliminate a direct libserialport dependency in the OLS device driver.
Use libsigrok's internal serial layer's API instead to check for the
availability of receive data.
2019-06-02 20:39:02 +02:00
Gerhard Sittig 8c3df6e5cd serial: introduce "has receive data" query
Add a serial_has_receive_data() routine to the serial layer's API which
returns the number of (known to be) available RX data bytes. Implement
support in the libserialport specific code.
2019-06-02 20:39:02 +02:00
Gerhard Sittig ae4c1fb637 serial_libsp: move libserialport specific code to separate source file
Introduce a new serial_libsp.c source file, and move code from serial.c
there which is specific to libserialport. Keep the existing serial.c API
in place, this is a pure internal refactoring.

Adjust a little whitespace while we are here. Rearrange long lines to
keep related parameter groups adjacent (like pointer and size, or UART
frame length and flow control). Consistently reduce indentation of
continuation lines.
2019-06-02 20:39:02 +02:00
Gerhard Sittig 639c6f61c3 serial: determine timeout from most recent set_params() values
Store the most recent successfully applied set of parameters for serial
communication. Re-use these values as a fallback to calculate timeouts,
when the underlying transport fails to provide the current settings.
2019-06-02 20:39:02 +02:00
Gerhard Sittig dca683ef99 rohde-schwarz-sme-0x: remove obsolete libserialport reference
The rohde-schwarz-sme-0x device driver used to unconditionally reference
a libserialport header file. Remove that reference, it's not needed in
this specific driver.
2019-06-02 20:39:01 +02:00
Gerhard Sittig e24e74ed84 agilent-dmm: fixup whitespace nit (trailing space) 2019-06-02 20:39:01 +02:00
Gerhard Sittig 18037e79f1 doc: update manual driver addition in the HACKING document
Build support has changed to use linker sections for driver registration.
Update the subsection in the HACKING document which discusses the manual
addition of device drivers, to match what the new-driver script does for
driver authors.
2019-06-02 20:39:01 +02:00
Andreas Piesk 108d2ec2c2 saleae-logic16: Warn (instead of erroring out) if FPGA is unsupported
Don't exit with an error if the FPGA is detected as unsupported.

Just issue a warning with the detected version and continue. I have such
a clone and it works with the original Saleae software and with sigrok
despite the fact that its FPGA version is 0xff.
2019-06-01 17:15:55 +02:00
Vitaliy Vorobyov ca9f8961e3 serial-lcr: Add MASTECH MS5308 2019-05-14 19:56:57 +02:00
Uwe Hermann 3535a6eeee Fix an issue when building in directories that are symlinks.
Explicitly use SRCDIR and BUILDDIR in Doxyfile files to reference input
files. This seems to be a sufficient fix for an issue where the build
would fail when libsigrok/ was located in a directory that was a symlink.

This fixes bug #547.
2019-05-01 17:58:06 +02:00
Vitaliy Vorobyov dcd212f7a2 Add MASTECH MS2115B support. 2019-05-01 15:55:07 +02:00
Gerd v. Egidy 16a8e58068 agilent-dmm: add basic support for Agilent/Keysight U127x
Their commands are very similar to the U123x series, they just
add some more modes and the second channel. So use the re-functions
and just extend them where necessary.

Log reading not supported yet.

Basic testing done with a U1272A.
2019-05-01 15:43:00 +02:00
Gerd v. Egidy 878e0e9d21 agilent-dmm: fix support for Agilent/Keysight U1252A
- fix the resolution of the CONF?-response:
  the resolution is given with 6 decimal places
  (instead of 8) like this:

  VOLT +5.000000E+00,+1.000000E-04

- add more measurement modes that are possible with the meter:
  CONT,COND,TEMP,PULS
2019-05-01 15:43:00 +02:00
Gerhard Sittig 271392d969 serial: rename variable to reflect it's related to libserialport
Rename the rather generic 'data' struct member to 'sp_data', to better
reflect that it contains details which are specific to libserialport.
2019-04-28 17:41:12 +02:00
Gerhard Sittig 6213c38ef8 serial: update doxygen comments (flush vs drain, in vs out params)
It's important to remain aware that the serial layer's flush and drain
semantics differs from e.g. filesystem calls. The libserialport API is
said to follow the termios example.

Extend comments in the libsigrok API, to not depend on the libserialport
layer and the availability of its documentation. This raises awareness
during maintenance of sigrok device drivers, as well as the pending
addition of alternative transports for serial communication.

Adjust the doxygen comment for the read line routine while we are here.
Add "in" and "out" attributes for routine parameters.
2019-04-28 17:41:12 +02:00
Gerhard Sittig fcfa36fd6f libsigrok-internal.h: fix source file references in comments
The src/hardware/ subdirectory exclusively contains device drivers these
days, while common support code has moved to the src/dmm/, src/lcr/,
src/scale/, etc directories or src/ itself. Adjust comments in the
libsigrok-internal.h declaration blocks which reference source files.
2019-04-28 17:41:12 +02:00
Gerhard Sittig fdcdfe53d8 libsigrok-internal.h: nit, alpha-sort include directives 2019-04-28 17:41:12 +02:00
Gerhard Sittig e47a9562e9 device: rephrase sizeof() calls for reduced redundancy, use malloc0
Just allocate the memory needed to hold the very variable's size. No
need to duplicate the variable's type. Reduces redundancy and increases
robustness during maintenance.

Use g_malloc0() in sr_serial_new() to make sure all of the structure is
initialized.
2019-04-28 17:41:12 +02:00
Uwe Hermann 7d0f52f7e5 Consistently use the "Sysclk" spelling everywhere.
We use this spelling (not "SysClk") in most of the rest of the code-base,
as well as in the wiki.
2019-04-24 18:23:41 +02:00
Uwe Hermann 4ddd34b107 udev: Add Sysclk SLA50232 entry. 2019-04-24 18:23:41 +02:00
Uwe Hermann f3178f123d sysclk-sla5032: Minor asterisk placement consistency fixes. 2019-04-24 18:23:41 +02:00
Uwe Hermann 98ed645e40 sysclk-sla5032: Make a few functions static. 2019-04-24 18:18:57 +02:00
Uwe Hermann 9e0693f92d sysclk-sla5032: Merge sla5032.[ch] into protocol.[ch]. 2019-04-24 18:18:57 +02:00
Uwe Hermann 052cc011bf sysclk-sla5032: Shorten sla5032_start_sample() a bit. 2019-04-24 17:33:24 +02:00
Uwe Hermann d57a114347 sysclk-sla5032: Shorten a few code snippets a bit. 2019-04-22 13:39:48 +02:00
Uwe Hermann 262cb9968d sysclk-sla5032: Fix compiler warnings (max vs. MAX).
src/hardware/sysclk-sla5032/protocol.c: In function ‘la_start_acquisition’:
  src/hardware/sysclk-sla5032/protocol.c:244:8: warning: implicit declaration of function ‘max’ [-Wimplicit-function-declaration]
    pre = max(pre, 2);
          ^~~
2019-04-22 13:39:48 +02:00
Vitaliy Vorobyov 8da8c8265f Add initial Sysclk SLA5032 driver. 2019-04-22 13:39:48 +02:00