]> sigrok.org Git - libsigrok.git/log
libsigrok.git
2 years agodcttech-usbrelay: Initial driver skeleton.
Gerhard Sittig [Wed, 21 Jul 2021 18:03:52 +0000 (20:03 +0200)]
dcttech-usbrelay: Initial driver skeleton.

2 years agohp-3478a: Fix switching from 4-wire to 2-wire measurement.
Frank Stettner [Mon, 24 May 2021 11:02:00 +0000 (13:02 +0200)]
hp-3478a: Fix switching from 4-wire to 2-wire measurement.

The measured quantity flags for the measurement mode can only contain one flag
at maximum. Therefore the quantity flags handling can be simplified, which also
fixes a bug when switching from 4-wire resistance measurement to 2-wire mode.

2 years agohp-3478a: Only match when conn= is given to avoid false probe positives.
Frank Stettner [Mon, 24 May 2021 10:56:52 +0000 (12:56 +0200)]
hp-3478a: Only match when conn= is given to avoid false probe positives.

The HP 3478A device would not reliably identify by means of SCPI queries. The
previous scan() implementation would have matched any connected SCPI device,
then upset these devices by emitting non-SCPI requests.

Tighten the scope of the hp-3478a probe, only scan for devices when a conn=
spec was provided. This avoids false positives and malfunction of other
devices, and still lets users address the problematic device. This is similar
to serial-dmm and unspecific cables and has proven to work there.

2 years agoscpi_vxi: Unbreak MacOS build (vxi.h inclusion order).
Frank Stettner [Wed, 23 Jun 2021 08:53:24 +0000 (10:53 +0200)]
scpi_vxi: Unbreak MacOS build (vxi.h inclusion order).

Undo the #include statement order change of commit 7414fb55cb1f. It's
essential on MacOS to include vxi.h early to keep related u_long et al
data types available. See commit d40b8557a962 for a discussion.

Also drop the inclusion of rpc/rpc.h from scpi_vxi.c because it is not
used in that source file, instead is a vxi.h dependency and is included
there.

[ gsi: rephrase commit message ]

2 years agohp-3478a: avoid NULL dereference in config API routines
Gerhard Sittig [Mon, 28 Jun 2021 05:34:23 +0000 (07:34 +0200)]
hp-3478a: avoid NULL dereference in config API routines

The 'sdi' parameter to config API calls can be NULL. Only dereference
after checking its validity.

Reported-By: Alexandre Ferreira <redacted>
2 years agodoc: update IRC reference to Libera.Chat
Gerhard Sittig [Wed, 16 Jun 2021 18:52:01 +0000 (20:52 +0200)]
doc: update IRC reference to Libera.Chat

2 years agorigol-ds: fix use-after-free
Ralf [Mon, 7 Jun 2021 05:08:06 +0000 (07:08 +0200)]
rigol-ds: fix use-after-free

This amends commit 4fad41a8a4f3 which fixed a leak but introduced the
use after free.

2 years agoscpi_vxi: fix memory leak for SCPI response data in VXI support code
Daniel Anselmi [Fri, 21 May 2021 12:30:17 +0000 (14:30 +0200)]
scpi_vxi: fix memory leak for SCPI response data in VXI support code

Routine scpi_vxi_read_data() invokes device_read_1(), which provides a
static buffer where dynamically allocated memory for SCPI response data
is kept. Release this memory after getting a copy of the response data,
before the next device_read_1() call loses the reference.

Valgrind stats without the fix:

  ==238825== LEAK SUMMARY:
  ==238825== definitely lost: 45,547,737 bytes in 18,331 blocks
  ==238825== indirectly lost: 0 bytes in 0 blocks
  ==238825== possibly lost: 48,154 bytes in 14 blocks
  ==238825== still reachable: 42,859 bytes in 288 blocks
  ==238825== suppressed: 0 bytes in 0 blocks

Valgrind stats with the fix:

  ==239413== LEAK SUMMARY:
  ==239413== definitely lost: 40 bytes in 2 blocks
  ==239413== indirectly lost: 0 bytes in 0 blocks
  ==239413== possibly lost: 0 bytes in 0 blocks
  ==239413== still reachable: 38,613 bytes in 287 blocks
  ==239413== suppressed: 0 bytes in 0 blocks

Remaining leaks in scpi_vxi_open() are of lesser severity because they
don't accumulate during execution.

[ gsi: rebase to recent master, reword commit message ]

2 years agoscpi_vxi: readability nits in the SCPI via VXI source code
Gerhard Sittig [Sun, 6 Jun 2021 14:06:51 +0000 (16:06 +0200)]
scpi_vxi: readability nits in the SCPI via VXI source code

Address style nits to improve readablity and future maintenance.
Move system header includes before application level includes. Move
assignments out of variable declaration blocks. Separate function calls
and assignments from error checks and flow control. Break a long line.
Add braces around conditional multi line statements.

All these adjustments are cosmetical. Behaviour does not change.

2 years agocontrib: add udev rule for Agilent 34460A USBTMC
Sylvain Pelissier [Tue, 25 May 2021 11:01:26 +0000 (13:01 +0200)]
contrib: add udev rule for Agilent 34460A USBTMC

2 years agoscpi-dmm: Add support for Agilent 34460A
Sylvain Pelissier [Mon, 17 May 2021 11:39:00 +0000 (13:39 +0200)]
scpi-dmm: Add support for Agilent 34460A

[ gsi: rebase and squash, specify delays like Keysight 34465A ]

2 years agoscpi-dmm: add short measurement delay for 34465A
Gerhard Sittig [Sat, 22 May 2021 13:19:05 +0000 (15:19 +0200)]
scpi-dmm: add short measurement delay for 34465A

With Keysight 34465A the VOLT:AC and FREQ functions keep suffering from
USB timeouts and pipe errors. Add a 10ms delay between initiating the
acquisition and checking for completion before fetching the result.

The weird thing is that when successful responses are seen after
temporary failure, enlarging the delay does not make them go away.
Instead the USB errors keep moving to a different spot. Measurements do
arrive though, so this is just annyoing but not a blocker.

  sr: [00:00.134038] scpi_usbtmc: Successfully sent SCPI command: 'CONF?'.
  sr: [00:00.136043] scpi: Got response: '"FREQ +3.00000000E+00,+3.00000000E-06"', length 38.
  sr: [00:00.136119] scpi-dmm: dev_acquisition_start: Precision: '"FREQ +3.00000000E+00,+3.00000000E-06"'
  sr: [00:00.136251] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:00.184211] scpi: Got response: '1', length 1.
  sr: [00:00.184481] scpi_usbtmc: Successfully sent SCPI command: 'INIT'.
  sr: [00:00.234800] session: bus: Received SR_DF_HEADER packet.
  cli: Received SR_DF_HEADER.
  sr: [00:00.245597] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:01.246050] scpi_usbtmc: USBTMC bulk in transfer error: LIBUSB_ERROR_TIMEOUT.
  sr: [00:01.256495] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:01.291871] scpi_usbtmc: USBTMC invalid bulk in header.
  sr: [00:01.302392] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:01.401959] scpi: Got response: '1', length 1.
  sr: [00:01.402135] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:01.403392] scpi: Got response: '1', length 1.
  sr: [00:01.403566] scpi_usbtmc: Successfully sent SCPI command: 'CONF?'.
  sr: [00:01.405769] scpi: Got response: '"FREQ +3.00000000E+00,+3.00000000E-06"', length 38.
  sr: [00:01.406020] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:01.407500] scpi: Got response: '1', length 1.
  sr: [00:01.407674] scpi_usbtmc: Successfully sent SCPI command: 'FETCH?'.
  sr: [00:01.409107] scpi: Got response: '+9.00555531E+01', length 15.

Experimentation suggests that 200ms timeouts reduce the probability of
these USB communication errors. But if functions tend to respond that
differently, are delay time specs per MQ required? The implementation of
the driver currently assumes a single delay spec.

2 years agoscpi-dmm: model and MQ dependent delay before measurement
Gerhard Sittig [Sat, 22 May 2021 08:39:10 +0000 (10:39 +0200)]
scpi-dmm: model and MQ dependent delay before measurement

Some models are slow to start a measurement acquisition in specific MQs
(meter functions). An "*OPC?" query went unanswered after "INIT" was
sent. This was observed on 34405A in temperature, frequency, resistance,
AC voltage and current mode.

Add an optional per-model measurement delay that is used when the MQ
specifies that the delay is applicable. Because functions are changed
rarely but measurements are taken many times, only the first reading
is delayed while later readings are seen at the expected interval. Not
delaying the first reading will result in device errors.

  sr: [00:00.875162] scpi_usbtmc: Successfully sent SCPI command: 'CONF?'.
  sr: [00:00.881666] scpi: Got response: '"FREQ +1.00000E+00,+1.00000E-05"', length 32.
  sr: [00:00.881700] scpi-dmm: dev_acquisition_start: Precision: '"FREQ +1.00000E+00,+1.00000E-05"'
  sr: [00:00.881840] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:00.883966] scpi: Got response: '1', length 1.
  sr: [00:00.884139] scpi_usbtmc: Successfully sent SCPI command: 'INIT'.
  sr: [00:01.884420] session: bus: Received SR_DF_HEADER packet.
  cli: Received SR_DF_HEADER.
  sr: [00:01.895260] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:02.895766] scpi_usbtmc: USBTMC bulk in transfer error: LIBUSB_ERROR_TIMEOUT.
  sr: [00:02.906302] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:02.910703] scpi_usbtmc: USBTMC invalid bulk in header.
  sr: [00:02.921244] scpi_usbtmc: USBTMC bulk out transfer error: LIBUSB_ERROR_PIPE.
  sr: [00:02.931802] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:02.932276] scpi: Got response: '1', length 1.
  sr: [00:02.932425] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:02.934790] scpi: Got response: '1', length 1.
  sr: [00:02.935155] scpi_usbtmc: Successfully sent SCPI command: 'CONF?'.
  sr: [00:02.941564] scpi: Got response: '"FREQ +1.00000E+00,+1.00000E-05"', length 32.

  sr: [00:00.173408] hwdriver: scpi-dmm: Starting acquisition.
  sr: [00:00.173569] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:00.334312] scpi: Got response: '1', length 1.
  sr: [00:00.334544] scpi_usbtmc: Successfully sent SCPI command: 'CONF?'.
  sr: [00:00.341070] scpi: Got response: '"RES +1.00000E+02,+1.00000E-03"', length 31.
  sr: [00:00.341307] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:00.343636] scpi: Got response: '1', length 1.
  sr: [00:00.343872] scpi_usbtmc: Successfully sent SCPI command: 'CONF?'.
  sr: [00:00.350093] scpi: Got response: '"RES +1.00000E+02,+1.00000E-03"', length 31.
  sr: [00:00.350157] scpi-dmm: dev_acquisition_start: Precision: '"RES +1.00000E+02,+1.00000E-03"'
  sr: [00:00.350342] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:00.352524] scpi: Got response: '1', length 1.
  sr: [00:00.352832] scpi_usbtmc: Successfully sent SCPI command: 'INIT'.
  sr: [00:00.352901] session: bus: Received SR_DF_HEADER packet.
  cli: Received SR_DF_HEADER.
  sr: [00:00.363675] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:01.364363] scpi_usbtmc: USBTMC bulk in transfer error: LIBUSB_ERROR_TIMEOUT.
  sr: [00:01.374904] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:02.375380] scpi_usbtmc: USBTMC bulk in transfer error: LIBUSB_ERROR_TIMEOUT.
  sr: [00:02.385872] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:03.232457] scpi_usbtmc: USBTMC invalid bulk in header.
  sr: [00:03.243003] scpi_usbtmc: USBTMC bulk out transfer error: LIBUSB_ERROR_PIPE.
  sr: [00:03.253464] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:03.256568] scpi: Got response: '1', length 1.
  sr: [00:03.256902] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:03.259440] scpi: Got response: '1', length 1.
  sr: [00:03.259713] scpi_usbtmc: Successfully sent SCPI command: 'CONF?'.
  sr: [00:03.266070] scpi: Got response: '"RES +1.00000E+08,+1.00000E+3"', length 30.
  sr: [00:03.266456] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'.
  sr: [00:03.268501] scpi: Got response: '1', length 1.
  sr: [00:03.268961] scpi_usbtmc: Successfully sent SCPI command: 'READ?'.
  sr: [00:03.353589] scpi: Got response: '+9.90000000E+37 ', length 16.

Declare a 2500ms measurement initiation delay for 34405A which was found
by experimentation. This is huge but was found to be necessary.

Of course all other meter functions are unaffected by this commit. As
are the meters which specify no delay.

2 years agoscpi-dmm: model and MQ dependent delay when switching functions
Gerhard Sittig [Sat, 22 May 2021 08:22:28 +0000 (10:22 +0200)]
scpi-dmm: model and MQ dependent delay when switching functions

Some models are slow to switch meter functions to specific MQs. This was
observed with 34405A and AC V/I modes, where USB connections timed out
and suffered from pipe errors.

Add an optional delay after "CONF:<mode> [<range>]" SCPI requests. The
duration of the delay is per model, the use of the delay is per MQ on
that model. The 200ms delay for 34405A was found by experimentation.

Speaking about 34405A: Only the "INIT" request in temperature mode
remains as an issue, which is not covered by this commit's approach.

2 years agoscpi-dmm: use different Agilent SCPI command for range and measurment
Gerhard Sittig [Sat, 22 May 2021 08:29:37 +0000 (10:29 +0200)]
scpi-dmm: use different Agilent SCPI command for range and measurment

Don't use the "[SENS:]<mode>:RANGE..." request on Agilent protocol
speaking devices. Use "CONF:<mode> [<range>]" instead. This was tested
with all devices which reference this model.

In theory there is the question whether previously configured ranges
should be re-used when (exclusively) the MQ is switched. It's assumed
that this is not useful, instead users or their applications should
select the function first and optionally pick the range then. Re-use of
e.g. 10k resistance range when switching to capacitance might be seen as
confusing (and results in errors in the device).

Use the combination of INIT and FETCH? to get measurements. The READ?
request is more complex and might "undo" what INIT already initiated.
This improves perception of the 34405A meter's operation.

2 years agoscpi-dmm: rephrase read timeout decls, put "unit" after "ms value"
Gerhard Sittig [Sat, 22 May 2021 08:08:23 +0000 (10:08 +0200)]
scpi-dmm: rephrase read timeout decls, put "unit" after "ms value"

Rephrase the SCPI read timeouts in scpi-dmm model declarations. Shuffle
the order of product terms such that the milliseconds "unit" goes last,
and the milliseconds value goes first. Assume that "2500 * 1000 [us]"
better reflects the intention than "1000 * 2500" does.

2 years agofluke-45: drop serial port echo test, was disabled for years
Gerhard Sittig [Sat, 22 May 2021 12:12:22 +0000 (14:12 +0200)]
fluke-45: drop serial port echo test, was disabled for years

The Fluke 45 driver's ECHO_TEST broke other people's SCPI device
identification and was disabled in 2018-11. Remove the dead code which
is impossible to resurrect. Its purpose was questionable to begin with.

Should users be affected, then the echo would break the identification
phase. The check cannot be done before identification without affecting
other connected devices, cannot be done after the identification either
when that very identification systematically fails. Should a user meet
this condition then applications' logs are available to see why *IDN?
fails, assuming that users are not aware of their serial port or device
configuration. The request's reflection in the place of a response gives
a strong hint.

2 years agohp-3457a: only probe when conn= was specified, to not break SCPI devices
Gerhard Sittig [Sat, 22 May 2021 12:09:29 +0000 (14:09 +0200)]
hp-3457a: only probe when conn= was specified, to not break SCPI devices

Only scan for hp-3457a devices when the user specified which connection
to use. This avoids breaking SCPI devices by emitting non-standard
requests before reliable device identification.

2 years agoscpi-pps: don't break SCPI devices when scanning for HP-IB devices
Gerhard Sittig [Sat, 22 May 2021 11:54:52 +0000 (13:54 +0200)]
scpi-pps: don't break SCPI devices when scanning for HP-IB devices

Only scan for hpib-pps devices when a user provided conn= specification
was given. This avoids breaking SCPI devices by emitting non-standard
requests before reliable device identification.

2 years agoscpi: style nits in sr_scpi_scan(), prefer common helper
Gerhard Sittig [Sat, 22 May 2021 10:53:34 +0000 (12:53 +0200)]
scpi: style nits in sr_scpi_scan(), prefer common helper

Improve readability and simplify maintenance of the sr_scpi_scan()
routine.

Move initial assignment and subsequent update of variables in closer
proximity, don't hide assignments in declaration blocks. Use common
helper code where available. Split complex conditions into individual
terms which are easier to review and reason about. Don't mix calls and
value checks and flow control in the same statement.

2 years agosiglent-sds: move model dependent request emission to after identification
Gerhard Sittig [Sat, 22 May 2021 10:26:18 +0000 (12:26 +0200)]
siglent-sds: move model dependent request emission to after identification

Device or model or protocol variant specific commands should only be
used after the device reliably got identified. The "CHDR OFF" command
upsets other devices and needs to move after *IDN? and model checks.

2 years agohp-59306a: only match when conn= is given to avoid false probe positives
Gerhard Sittig [Sat, 22 May 2021 10:25:27 +0000 (12:25 +0200)]
hp-59306a: only match when conn= is given to avoid false probe positives

The HP 59306A device was made in 1973 and would not reliably identify
by means of SCPI queries. The previous scan() implementation would have
matched any connected SCPI device, then upset these devices by emitting
non-SCPI requests.

Tighten the scope of the hp-59306a probe, only scan for devices when a
conn= spec was provided. This avoids false positives and malfunction of
other devices, and still lets users address the problematic device. This
is similar to serial-dmm and unspecific cables and has proven to work
there.

How to reproduce the issue:

  (while any auto enumerating SCPI device is connected)
  $ sigrok-cli --scan

2 years agomotech-lps-301: make better use of serial extract options helper
Gerhard Sittig [Sat, 22 May 2021 11:35:29 +0000 (13:35 +0200)]
motech-lps-301: make better use of serial extract options helper

Pre-assign default values before having user specified options scanned.
This avoids the necessity to post-process the result. Move the initial
assignment to where its corresponding update is to improve readability.

2 years agoserial: extend semantics of connection and comm params extraction helper
Gerhard Sittig [Sat, 22 May 2021 11:27:43 +0000 (13:27 +0200)]
serial: extend semantics of connection and comm params extraction helper

The sr_serial_extract_options() routine is a hidden gem, has existed for
almost eight years, and is exclusively used by the motech-lps-301 driver
(was also used by hameg-hmo at some point in the past). Being so useful
and doing something to terribly popular, more drivers should use it.

Extend the API to make either of the out parameters genuinely optional,
and guarantee that pre-assigned defaults will survive in the absence of
user specs. Update the Doxygen comment.

2 years agoscpi-dmm: avoid get/set range calls for some of the Agilent DMM functions
Gerhard Sittig [Fri, 21 May 2021 16:37:05 +0000 (18:37 +0200)]
scpi-dmm: avoid get/set range calls for some of the Agilent DMM functions

While queries for the range are supported for voltage, current,
resistence, capacitance, the same queries in temperature, frequency,
diode, continuity modes not only fail but even lose the USB connection
to the device. This was consistently observed with 34405A and 34465A.

Suppress get and set range requests for the known problematic modes of
the Agilent protocol speaking meters.

2 years agoscpi-dmm: add four-wire resistance to list of 34405A MQs
Gerhard Sittig [Fri, 21 May 2021 16:55:57 +0000 (18:55 +0200)]
scpi-dmm: add four-wire resistance to list of 34405A MQs

Although the 34405A does not support this function, other Agilent
protocol using meters do (currently 34465A, very probably others which
are about to get added in the future).

It's assumed that announcing the availability of that MQ for a set of
meters while only some of them support it is preferrable over exploding
numbers of copies of tables which only slightly vary among each other.

2 years agoscpi-dmm: prepare introduction of per-MQ driver flags
Gerhard Sittig [Fri, 21 May 2021 16:35:01 +0000 (18:35 +0200)]
scpi-dmm: prepare introduction of per-MQ driver flags

This mechanical edit adds a flags field and the initializer element to
make the compiler happy. Behaviour does not change. See a word diff for
improved review experience.

2 years agoscpi-dmm: add support to get/set range on Agilent protocol using meters
Gerhard Sittig [Thu, 20 May 2021 20:00:47 +0000 (22:00 +0200)]
scpi-dmm: add support to get/set range on Agilent protocol using meters

Add support to get and set the auto/manual range on Agilent protocol
speaking devices (34405A, 34465A). The range values are mere numbers
without a unit or MQ associated with them. Support to list available
ranges is prepared but not used (not needed on these meters). Common
logic could open code the lists of ranges from the model description
if desired in a future implementation.

2 years agoscpi-dmm: use INIT instead of MEAS for Agilent to start acquisition
Gerhard Sittig [Thu, 20 May 2021 22:30:51 +0000 (00:30 +0200)]
scpi-dmm: use INIT instead of MEAS for Agilent to start acquisition

Though measurement values come in, the 34405A and 34465A meters kept
beeping when acquisition is started. Stopped beeping when the MEAS
keyword was changed to INIT, which is used for other Agilent devices
using the HP protocol variant.

This change is acceptable because it was tested on all DMMs which use
the Agilent protocol (according to scpi-dmm profiles).

2 years agoscpi-dmm: Keysight 34465A is a 6.5 digit meter, bump digits count
Gerhard Sittig [Thu, 20 May 2021 21:11:56 +0000 (23:11 +0200)]
scpi-dmm: Keysight 34465A is a 6.5 digit meter, bump digits count

Increase the default digit count in the 34465A model description. Though
most measurements get the precision from the current reading, this data
is used as a fallback when the response won't provide the detail.

2 years agoscpi-dmm: move OPC availability check to after IDN device identification
Gerhard Sittig [Thu, 20 May 2021 21:08:19 +0000 (23:08 +0200)]
scpi-dmm: move OPC availability check to after IDN device identification

Assume that *IDN? requests don't involve expensive processing, and thus
don't require *OPC? before their execution. This makes scpi-dmm follow
the good tradition to only use non-standard or model dependent features
after the device was successfully identified. Which avoids confusion on
unrelated devices.

Exclusively check for *OPC? availability on Owon devices, because these
motivated the introduction of the test in the first place. This avoids
confusion on other devices where short timeouts result in errors because
the response is not retrieved although the command is supported (observed
on Agilent meters connected via USBTMC).

2 years agocontrib: add udev rule for Keysight USBTMC
Gerhard Sittig [Thu, 20 May 2021 18:53:14 +0000 (20:53 +0200)]
contrib: add udev rule for Keysight USBTMC

Add the USB identification of a Keysight 34465A digital multimeter.

2 years agosiglent-sds: prefer common glib routine to get vector's length
Gerhard Sittig [Sun, 16 May 2021 12:57:54 +0000 (14:57 +0200)]
siglent-sds: prefer common glib routine to get vector's length

Replace an open coded loop with a call to common glib code.

2 years agoscpi: readability nits in vector getters, style nit in malloc call
Gerhard Sittig [Sun, 16 May 2021 17:51:52 +0000 (19:51 +0200)]
scpi: readability nits in vector getters, style nit in malloc call

Improve readability of SCPI uint8 and float vector get routines. Move
assignment and use of variables closer together to simplify review.
Allocate the glib array based on the text split result's length. Move
data processing to the "straight" path and handle failed conversion as
an exceptional condition in an error path.

Eliminate a redundant data type reference in a malloc call.

2 years agosiglent-sds: free memory that was allocated by SCPI get routines
Gerhard Sittig [Sun, 16 May 2021 12:54:48 +0000 (14:54 +0200)]
siglent-sds: free memory that was allocated by SCPI get routines

The SCPI get routines may allocate memory for response data which
callers have to free after use.

The implemented approach is modelled after pull request 114 by
Matti Eiden, to get the leak fixes in while the PR is queued.

This addresses part of bug #1683.

Submitted-By: Matti Eiden <redacted>
2 years agohameg-hmo: free memory that was allocated by SCPI get routines
Gerhard Sittig [Sun, 16 May 2021 17:42:53 +0000 (19:42 +0200)]
hameg-hmo: free memory that was allocated by SCPI get routines

The SCPI get routines may allocate memory for response data which
callers have to free after use.

Move an existing assigment such that the initial assignment, the memory
allocation, use of response data, and resource release are in closer
proximity, and thus are easier to reason about during maintenance.
Behaviour does not change.

This is motivated by bug #1683.

2 years agorigol-ds: free memory that was allocated by SCPI get routines
Gerhard Sittig [Sun, 16 May 2021 12:48:42 +0000 (14:48 +0200)]
rigol-ds: free memory that was allocated by SCPI get routines

The SCPI get routines may allocate memory for response data which
callers have to free after use.

The approach to release allocated memory is simlar or identical to the
corresponding parts of pull request 95, in an attempt to get the reported
leak fixes in, yet reduce the potential for conflicts where this commit
deviates from the PR. Most work was done by Ralf. Thank you!

This addresses part of bug #1683.

Submitted-By: Reported-By: Ralf <redacted>
Tested-By: Reported-By: Ralf <redacted>
2 years agoscpi-dmm: free memory that was allocated by SCPI get routines
Gerhard Sittig [Sun, 16 May 2021 12:52:49 +0000 (14:52 +0200)]
scpi-dmm: free memory that was allocated by SCPI get routines

The SCPI get routines may allocate memory for response data which
callers have to free after use.

This addresses part of bug #1683.

2 years agorigol-dg: free memory that was allocated by SCPI get routines
Gerhard Sittig [Sun, 16 May 2021 12:45:47 +0000 (14:45 +0200)]
rigol-dg: free memory that was allocated by SCPI get routines

The SCPI get routines may allocate memory for response data which
callers have to free after use.

Move an existing release call to an earlier location, to avoid leaking
memory when an error path is taken.

This addresses part of bug #1683.

2 years agolecroy-xstream: free memory that was allocated by SCPI get routines
Gerhard Sittig [Sun, 16 May 2021 12:44:57 +0000 (14:44 +0200)]
lecroy-xstream: free memory that was allocated by SCPI get routines

The SCPI get routines may allocate memory for response data which
callers have to free after use.

This addresses part of bug #1683.

2 years agohp-3457a: style nits in the probe routine
Gerhard Sittig [Sun, 16 May 2021 13:30:42 +0000 (15:30 +0200)]
hp-3457a: style nits in the probe routine

Unobfuscate a string comparison. Eliminate redundant data type specs
in malloc calls.

2 years agohp-3457a: free memory that was allocated by SCPI get routines
Gerhard Sittig [Sun, 16 May 2021 12:43:58 +0000 (14:43 +0200)]
hp-3457a: free memory that was allocated by SCPI get routines

The SCPI get routines may allocate memory for response data which
callers have to free after use.

This addresses part of bug #1683.

2 years agofluke-45: free memory that was allocated by SCPI get routines
Gerhard Sittig [Sun, 16 May 2021 12:40:00 +0000 (14:40 +0200)]
fluke-45: free memory that was allocated by SCPI get routines

The SCPI get routines may allocate memory for response data which
callers have to free after use.

This implementation is incomplete. The fluke-45 driver's context holds
a "global" copy of the most recently received response. While the data
is freed in the next receive call, one item remains allocated for the
driver's remaining life time. Which is considered non-critical.

Also moves an operator in a complex multi-line expression to a different
location to follow the project's style.

This addresses part of bug #1683.

2 years agoscpi: document callers' responsibility to free getters' allocated memory
Gerhard Sittig [Sun, 16 May 2021 17:47:44 +0000 (19:47 +0200)]
scpi: document callers' responsibility to free getters' allocated memory

Some of the SCPI getter routines allocate memory for response data which
callers need to free after use. Document this responsibility in more
places, and rephrase existing locations for consistency. See a word-diff
for the essence of the commit.

It's assumed that the separate paragraph in the function description is
better perceived than something that's hidden in the parameter or return
value discussion. Also reference the corresponding free routine by name
for callers' convenience (data types will differ among routines). Some
free routines can be called unconditionally, others require NULL checks
at the caller's.

Reported-By: Ralf <redacted>
2 years agoscpi: make sure to either return valid SCPI response data or NULL
Gerhard Sittig [Sun, 16 May 2021 11:48:24 +0000 (13:48 +0200)]
scpi: make sure to either return valid SCPI response data or NULL

Assign NULL early in those SCPI get routines which return allocated
memory to their callers. So that the return value is either a valid
pointer to memory or NULL regardless of the routine's exit code. This
simplifies call sites and increases robustness.

2 years agoserial_libsp: extend diag in code path which opens serial ports
Gerhard Sittig [Sun, 9 May 2021 17:27:22 +0000 (19:27 +0200)]
serial_libsp: extend diag in code path which opens serial ports

Opening a serial port involves two libserialport calls, while only the
second call's return value gets inspected. Check the lookup before the
open, too, and provide its details in a diag message.

2 years agoserial-dmm: Add PeakTech 2025 meter support.
Rafael G. Martins [Thu, 1 Apr 2021 19:01:57 +0000 (21:01 +0200)]
serial-dmm: Add PeakTech 2025 meter support.

This meter seems to be a rebranded Victor 86D. Vendor procotol
documentation matches FS9922 RS232 protocol.

2 years agordtech-dps: Add missing devc initialisation.
Frank Stettner [Sun, 9 May 2021 16:55:08 +0000 (18:55 +0200)]
rdtech-dps: Add missing devc initialisation.

2 years agocontrib/60-libsigrok.rules: add udev rule for Microchip PICkit2
Gerhard Sittig [Thu, 28 Mar 2019 16:43:24 +0000 (17:43 +0100)]
contrib/60-libsigrok.rules: add udev rule for Microchip PICkit2

2 years agoinput/csv: trim surrounding whitespace from header line channel names
Gerhard Sittig [Mon, 6 Jan 2020 08:59:21 +0000 (09:59 +0100)]
input/csv: trim surrounding whitespace from header line channel names

When CSV import grabs channel names from the first line in the file then
the text strictly between column separators (a comma) was used. Which
resulted in channel names like " channel 1". Trim leading and trailing
space before unquote, to better fulfill most users' expectation. Users
still can quote the input data for special cases if desired.

2 years agordtech-dps: research to reduce serial comm transfer volume again
Gerhard Sittig [Sun, 25 Apr 2021 08:03:47 +0000 (10:03 +0200)]
rdtech-dps: research to reduce serial comm transfer volume again

The DPS devices default to a rather low UART communication bitrate. The
generous retrieval of more Modbus registers than strictly necessary for
the periodic acquisition of analog channel values and state tracking may
or may not be an issue.

Instrument all call sites in api.c to the device state gathering calls
such that the protocol.c side transparently can reduce the transfer
volume depending on which level of detail the caller may expect given
its current context. Under optimal circumstances this might cut the
traffic in half, which DPS devices may benefit from.

This commit adds the infrastructure to potentially reduce transfer
volume, but does not change behaviour. The "config" reasons may need
further partitioning if Modbus register access really turns out to be
a severe bottleneck. The API lends itself to that extension easily. The
approach which gets prepared in this commit needs to get runtime tested
by those who got access to the hardware.

2 years agordtech-dps: introduce support for RD6006 and other Riden RD models
Gerhard Sittig [Sun, 25 Apr 2021 07:03:22 +0000 (09:03 +0200)]
rdtech-dps: introduce support for RD6006 and other Riden RD models

The RD devices differ from DPS devices in their default communication
bitrate (115200), register content endianess (BE), and register set
layout (addresses for registers). In either case 16bit registers get
accessed by means of Modbus communication over a serial channel. The
interpretation of the registers' values mostly is the same as for DPS
devices once a register with the same meaning got identified. Device
identification includes a 32bit serial number which DPS devices appear
to not provide.

All other product features are the same, and map to identical sigrok
mechanisms. That's why re-using the rdtech-dps driver to add rdtech-rd
support is considered desirable. This implementation shares all code
"above" the raw register addressing and raw value interpretation. All
logical processing, configuration interface, state tracking and data
submission to the session feed, are shared among the different device
types.

Declare support for the RD6006, RD6012, and RD6018 models. Their specs
were taken from the 2020.12.2 instruction manual. The driver was tested
with an RD6006 device (firmware version 1.28). Unfortunately automatic
device detection is not possible or will not be reliable, which is why
users need to specify the respective model by picking one of the two
drivers. Within a driver variant the device identification and use of
the device are automatically dealt with.

2 years agordtech-dps: layer separation between API and protocol, style nits
Gerhard Sittig [Tue, 13 Apr 2021 21:52:59 +0000 (23:52 +0200)]
rdtech-dps: layer separation between API and protocol, style nits

The existing power supply driver for Riden DPS/DPH devices unfortunately
duplicated intimate details of modbus communication and register layout
including interpretation of raw register values across several source
files. Do separate the physical transport and the register layout and
register fields interpretation layers. This brings the driver in line
with the usual api.c and protocol.c arrangement of responsibilities, and
prepares the future addition of other similar devices.

Address a few style nits while we are here. Include <config.h> in all
source files, and alpha-sort include directives. Address minor data type
nits. Reduce indentation in code paths. Propagate more error codes.
Update comments which lagged behind the code, adjust grammer (eliminate
"actual" false friends). Eliminate a few magic numbers and redundancies,
switch to the more recent endianess aware byte stream reader API where
beneficial, to eliminate redundant offset math.

Other nits seem to have gone unnoticed before: The indices of all sigrok
channels were identical (all zero). Signed print formats were used for
unsigned data.

This implementation compiles, but wasn't runtime tested due to lack of
hardware. A rough estimate of transfer volume and transport throughput
suggests that the 10ms cycle time no longer can be kept, may end up
around 25ms (40 cycles per second). This can get avoided by adding more
code to tell the configuration requests, the acquisition start, and the
measurements grabbing during acquisition apart. It's assumed though that
the 10ms glib poll interval did not translate to such fast measurement
gathering. The firmware may typically provide data at lower rates anyway.

The generic source code may look overly complicated or redundant at
first glance, but compilers' generated code will greatly get optimized.
Simplified maintenance because of reduced cognitive load is considered
more important.

2 years agohp-59306a: Initial HP 59306A driver.
Frank Stettner [Sat, 24 Apr 2021 14:44:50 +0000 (16:44 +0200)]
hp-59306a: Initial HP 59306A driver.

[ gsi: drop libgpib dependency, minor style adjustment ]

2 years agohp-59306a: Initial driver skeleton.
Frank Stettner [Sat, 24 Apr 2021 11:46:25 +0000 (13:46 +0200)]
hp-59306a: Initial driver skeleton.

2 years agoAdd device type SR_CONF_MULTIPLEXER.
Frank Stettner [Sat, 24 Apr 2021 14:43:23 +0000 (16:43 +0200)]
Add device type SR_CONF_MULTIPLEXER.

3 years agoAmend #119 to use vector instead of tuple
Soeren Apel [Sun, 28 Mar 2021 21:17:17 +0000 (23:17 +0200)]
Amend #119 to use vector instead of tuple

This way, we don't need to bump glibmm to 2.54, which we otherwise would

3 years agokingst-la2016: address trivial style nits (whitespace, braces, line length)
Gerhard Sittig [Thu, 25 Feb 2021 20:31:21 +0000 (21:31 +0100)]
kingst-la2016: address trivial style nits (whitespace, braces, line length)

Improve readability by addressing the trivial style nits in the driver.

Break the channel list into two times eight instead of nine plus seven
items. Put braces around all branches if one of them has braces. Add
braces to multi line branches despite most of the branch just being a
comment -- it's still many lines. Break extra long text lines, adjust
the position of operators when single expressions span multiple lines.

Drop unnecessary parentheses around single variables and auto
incrementing pointer dereferences. Adjust whitespace especially for
pointer data types, and arith operators.

3 years agokingst-la2016: Eliminate non-portable packed structs for USB transfer layout
Helge Kruse [Sat, 30 Jan 2021 14:46:46 +0000 (15:46 +0100)]
kingst-la2016: Eliminate non-portable packed structs for USB transfer layout

Eliminate packed structs in the construction and in the reception of
USB transfers, since these are rather non-portable. Use common support
for endianess aware access to byte streams instead. This unbreaks the
driver for MinGW builds, and increases portability and maintainability
on all other sigrok supported platforms.

[ gsi: adjust more locations, improve robustness, fixup style, reword message ]

3 years agokingst-la2016: Use common code to send trigger and frame boundary packets
Helge Kruse [Sat, 30 Jan 2021 14:16:49 +0000 (15:16 +0100)]
kingst-la2016: Use common code to send trigger and frame boundary packets

[ gsi: adjust more locations, reword commit message ]

3 years agotests: extend endianess conversion tests to also cover the 48bit writer
Gerhard Sittig [Sat, 27 Feb 2021 13:35:54 +0000 (14:35 +0100)]
tests: extend endianess conversion tests to also cover the 48bit writer

Cover the recently added writer for 48bit little endian data. Prepare a
large bytes pattern buffer that can also serve for future 64bit tests.

3 years agolibsigrok-internal.h: add 48bit endianess aware byte stream helpers
Gerhard Sittig [Sat, 27 Feb 2021 13:19:18 +0000 (14:19 +0100)]
libsigrok-internal.h: add 48bit endianess aware byte stream helpers

3 years agokingst-la2016: Upload firmware to correct USB configuration 1
Helge Kruse [Sat, 30 Jan 2021 13:49:02 +0000 (14:49 +0100)]
kingst-la2016: Upload firmware to correct USB configuration 1

The ezusb_upload_firmware() routine opens the USB device and selects the
current configuration. The specified value must match the previously read
configuration descriptor. This commit unbreaks the firmware download for
MinGW builds which link against libusb-1.0.20-rc3-event-abstraction-v4.

[ gsi: reworded commit message ]

3 years agokorad-kaxxxxp: Add support for Korad KD3005P V2.1
Frank Stettner [Sat, 27 Feb 2021 13:00:39 +0000 (14:00 +0100)]
korad-kaxxxxp: Add support for Korad KD3005P V2.1

3 years agoscpi-dmm: Add support for Owon XDM2041
Petteri Aimonen [Sun, 28 Feb 2021 13:34:40 +0000 (15:34 +0200)]
scpi-dmm: Add support for Owon XDM2041

3 years agoscpi-dmm: Gracefully handle meters that lack OPC command.
Petteri Aimonen [Sun, 28 Feb 2021 13:32:08 +0000 (15:32 +0200)]
scpi-dmm: Gracefully handle meters that lack OPC command.

The SCPI standard requires OPeration Complete command,
but some Owon meters do not implement it. This commit
makes the probe try OPC once, and if it gets no reply
it assumes it is not supported.

3 years agoscpi-dmm: Add infinity limit to model-specific config.
Petteri Aimonen [Sun, 28 Feb 2021 13:28:55 +0000 (15:28 +0200)]
scpi-dmm: Add infinity limit to model-specific config.

Owon multimeters seem otherwise compatible with gwinstek reader,
except infinity is only 1e9.

3 years agoscpi-pps: Add support for Owon P4000 series.
Petteri Aimonen [Sun, 28 Feb 2021 13:25:21 +0000 (15:25 +0200)]
scpi-pps: Add support for Owon P4000 series.

Tested on P4603 firmware version 1.6.0.

3 years agohantek-6xxx: Add ISDS205B support
litospain [Sat, 11 Apr 2020 20:27:15 +0000 (22:27 +0200)]
hantek-6xxx: Add ISDS205B support

3 years agohantek-6xxx: Fix for channel coupling not updating on changing
waka [Fri, 17 Jul 2020 20:28:06 +0000 (22:28 +0200)]
hantek-6xxx: Fix for channel coupling not updating on changing

Presumed regression related to fix for bug #836

3 years agozketech-ebd-usb: Don't ignore errors
Florian Ragwitz [Sun, 29 Nov 2020 02:19:24 +0000 (18:19 -0800)]
zketech-ebd-usb: Don't ignore errors

3 years agobeaglelogic: Fix resource leak
Florian Ragwitz [Sun, 29 Nov 2020 02:18:35 +0000 (18:18 -0800)]
beaglelogic: Fix resource leak

3 years agohantek-dso: fix 100MS/s
Alberto Scotta [Sat, 5 Dec 2020 15:05:51 +0000 (16:05 +0100)]
hantek-dso: fix 100MS/s

Do not downsample at 100MS/s.
The device actually sampled at (100.0/0x1000)MS/s when 100MS/s was set.

3 years agorigol-ds: Add DS1102Z-E model variant
HReimann [Sat, 23 Jan 2021 15:44:04 +0000 (16:44 +0100)]
rigol-ds: Add DS1102Z-E model variant

3 years agopython bindings: Support passing in rational voltages for config_set
Richard Allen [Tue, 26 Jan 2021 06:27:09 +0000 (00:27 -0600)]
python bindings: Support passing in rational voltages for config_set

3 years agogwinstek-gpd: Fix voltage/current measurement
Richard Allen [Sat, 16 Jan 2021 22:24:50 +0000 (16:24 -0600)]
gwinstek-gpd: Fix voltage/current measurement

3 years agogwinstek-gpd: Support auto-baud detection
Richard Allen [Sat, 16 Jan 2021 19:47:38 +0000 (13:47 -0600)]
gwinstek-gpd: Support auto-baud detection

If the user does not specify a serialcomm configuration,
try all three options from the manual.

3 years agogwinstek-gpd: Retry device identification on failure
Richard Allen [Sat, 16 Jan 2021 19:31:31 +0000 (13:31 -0600)]
gwinstek-gpd: Retry device identification on failure

Try the identification command up to three times
if the device responds with 'Invalid Character.',
which can happen if the device has buffered part
of a command but not executed it.

3 years agogwinstek-gpd: Print serialcomm config
Richard Allen [Sat, 16 Jan 2021 18:35:35 +0000 (12:35 -0600)]
gwinstek-gpd: Print serialcomm config

3 years agoscpi-pps: add R&S HMP2000 model specs
Gerhard Sittig [Tue, 2 Feb 2021 20:09:54 +0000 (21:09 +0100)]
scpi-pps: add R&S HMP2000 model specs

Re-use HMP4000 options and channel groups, only keep separate channel
specs for HMP2000 devices. HMP2030 has three identical 32V/5A channels.
HMP2020 has one 10A channel and one 5A channel.

3 years agoscpi-pps: adjust R&S HMP4000 current resolution for 10A channels
Gerhard Sittig [Tue, 2 Feb 2021 20:07:29 +0000 (21:07 +0100)]
scpi-pps: adjust R&S HMP4000 current resolution for 10A channels

Specs published by R&S suggest that 10A channels support 0.2mA resolution,
while only 5A channels resolve to 0.1mA (up to 1A full scale, 1mA above 1A).

3 years agools: Clean up: Replace hand-rolled byte order conversion with existing macros
v1ne [Tue, 31 Mar 2020 22:29:05 +0000 (00:29 +0200)]
ols: Clean up: Replace hand-rolled byte order conversion with existing macros

3 years agools: Refactor: Extract trigger setup into private place
v1ne [Wed, 1 Apr 2020 03:35:02 +0000 (05:35 +0200)]
ols: Refactor: Extract trigger setup into private place

This copies the code verbatim from one place to another in preparation to adding
support for complex triggers.

3 years agools: Make external clock setting queriable
v1ne [Tue, 31 Mar 2020 22:05:37 +0000 (00:05 +0200)]
ols: Make external clock setting queriable

... and thus selectable in PulseView.

3 years agools: Add option to use the falling edge of the external clock
v1ne [Tue, 31 Mar 2020 18:29:48 +0000 (20:29 +0200)]
ols: Add option to use the falling edge of the external clock

3 years agools: Clear "disabled groups" flags before setting them
v1ne [Tue, 31 Mar 2020 18:21:47 +0000 (20:21 +0200)]
ols: Clear "disabled groups" flags before setting them

This fixes a bug where the channel group setting would not be overwritten in a
new run, but instead the channel group settings of both runs would be merged
together.

3 years agools: Display actual expanded sample instead of the raw sample
v1ne [Wed, 1 Apr 2020 14:15:36 +0000 (16:15 +0200)]
ols: Display actual expanded sample instead of the raw sample

While the raw sample is the actual received data, the expanded sample is the
crucial data I as a developer am interested in seeing. At least if I assume that
the sample expansion works.

3 years agools: Clean up: Prefix private function for consistency
v1ne [Wed, 18 Nov 2020 22:54:46 +0000 (23:54 +0100)]
ols: Clean up: Prefix private function for consistency

3 years agodoc: update README.devices for Meterman 38XR (RS232 button)
Gerhard Sittig [Tue, 5 Jan 2021 17:17:45 +0000 (18:17 +0100)]
doc: update README.devices for Meterman 38XR (RS232 button)

3 years agodmm/mm38xr: introduce DMM packet parser for Meterman 38XR
Peter Skarpetis [Mon, 4 Jan 2021 04:59:23 +0000 (15:59 +1100)]
dmm/mm38xr: introduce DMM packet parser for Meterman 38XR

Introduce a DMM packet parser in src/dmm/ and register it with the
serial-dmm device driver. This adds support for the Meterman 38XR
multimeter.

[ gsi: style adjustment, raise awareness during maintenance ]

3 years agoserial-dmm: move Mastek items after Metex in the model database
Gerhard Sittig [Tue, 5 Jan 2021 07:10:21 +0000 (08:10 +0100)]
serial-dmm: move Mastek items after Metex in the model database

Keep the alpha-sort order in the list of supported chips and models.

3 years agoarachnid-labs-re-load-pro: Fix for get voltage and current while in acquisition.
Frank Stettner [Mon, 4 Jan 2021 13:36:18 +0000 (14:36 +0100)]
arachnid-labs-re-load-pro: Fix for get voltage and current while in acquisition.

[ gsi: moved intruction order to unify with other cond signalling code paths ]

3 years agodmm/bm52x: unbreak build when serial comm is not available
Gerhard Sittig [Tue, 29 Dec 2020 17:31:38 +0000 (18:31 +0100)]
dmm/bm52x: unbreak build when serial comm is not available

Make another code path in the Brymen BM52x packet parser optional which
snuck in earlier and broke compilation when serial_comm dependencies are
not met.

Ideally the src/dmm/ parser code would not get built at all in that
case, but building a parser with reduced functionality and not using it
later because its callers are conditional is as good, and is what other
DMM packet parsers did in the past.

How to reproduce:

  $ configure --without-libserialport --without-libhidapi --without-libbluez
  $ make

3 years agofx2lafw: Unbreak SR_CONF_LIMIT_SAMPLES for large values (above 2**32)
Ralf [Tue, 15 Dec 2020 19:02:37 +0000 (20:02 +0100)]
fx2lafw: Unbreak SR_CONF_LIMIT_SAMPLES for large values (above 2**32)

Capture does not stop for sample count values which exceed the range of
a 32bit type variable. Adjust the data type to 64bit.

How to reproduce: 8MSa/s * 600s -> 4,800,000,000 samples

  $ sigrok-cli -d fx2lafw -o capture.sr --config samplerate=8M --time 600000

[ gsi: rephrased the commit message ]

3 years agoftdi-la: work around missing USB strings during device probe
Gerhard Sittig [Fri, 25 Dec 2020 11:47:01 +0000 (12:47 +0100)]
ftdi-la: work around missing USB strings during device probe

Some FTDI chip based products ship with EEPROM content which makes
libftdi fail to lookup the USB strings, which breaks the scan for the
device's presence. The previous implementation was strict and only
accepted the absence of a serial number. This implementation also copes
when vendor and model cannot be gathered from the device, and provides
fallback values based on VID:PID numbers.

Also factor out a magic number for string lengths. Stick with dynamic
allocation since 3x 32bytes would be rather huge a local stack use, and
future maintenance might bump that string length again.

[ gsi: magic number in one spot, bounded string assignment, style nits ]

Submitted-By: Christo Crause <redacted>
3 years agoasix-sigma: parse serial numbers as unsigned values
Niklas Thorne [Tue, 17 Nov 2020 11:55:26 +0000 (12:55 +0100)]
asix-sigma: parse serial numbers as unsigned values

This unbreaks device detection on 32bit platforms.

3 years agostrutil: introduce sr_atoul_base() conversion helper (non-decimal)
Niklas Thorne [Tue, 17 Nov 2020 11:55:26 +0000 (12:55 +0100)]
strutil: introduce sr_atoul_base() conversion helper (non-decimal)

Introduce a text to number conversion routine which supports non-decimal
bases and optional suffixes, but returns unsigned results and thus covers
a larger range of values. This kind of amends commit 97aa41e9b59c which
introduced the sr_atol_base() routine.

3 years agodriver_list: unbreak list of builtin drivers for LTO configurations
Gerhard Sittig [Tue, 3 Nov 2020 17:25:18 +0000 (18:25 +0100)]
driver_list: unbreak list of builtin drivers for LTO configurations

Check for the availability of the "no_reorder" linker attribute, which
keeps the list of builtin drivers in shape on LTO enabled build setups.
Keep backwards compatibility for platforms which lack support for the
"no_reorder" attribute. Phrase the implementation such that other
keywords as well as user provided external specs are possible.

This resolves bug #1433.

Submitted-By: Ivan Mironov <redacted>
3 years agolibsigrok-internal.h: add u64be endianess writer
Gerhard Sittig [Mon, 26 Oct 2020 18:48:22 +0000 (19:48 +0100)]
libsigrok-internal.h: add u64be endianess writer

Add endianess aware writer for uint64_t data in BE format. This is
motivated by the Codethink Interrogizer.

3 years agoserial-dmm: add support for the Brymen BM820s family
Gerhard Sittig [Wed, 30 Sep 2020 07:59:32 +0000 (09:59 +0200)]
serial-dmm: add support for the Brymen BM820s family

The BM820s series uses the same 10000 counts protocol as BM520s does,
but lacks the capability of recording measurements. Re-use the bm52x
DMM packet parser, but don't register the config get/set/list and
acquisition start callbacks.

It turns out that the packet request and packet validity check routines
need to be individual, since 0x82 is used instead of 0x52 as a magic
number in some places. Fortunately the complex payload parser is shared
among BM520s and BM820s series. This was tested with a BM829s meter.