]> sigrok.org Git - libsigrok.git/log
libsigrok.git
7 years agoanalog: add support for negative number of digits
Aurelien Jacobs [Mon, 20 Jun 2016 20:58:12 +0000 (22:58 +0200)]
analog: add support for negative number of digits

When a meter display 105.2 kΩ, libsigrok will return 105200 Ω
but it is really valuable to know that the last 2 digits are not
significant, so encoding.digits should be set to -2.
This would allow a sigrok client to display 105200 as 105.2 k
instead of 105.200 k.

7 years agoLogging: Filter out unwanted newlines
Soeren Apel [Thu, 9 Jun 2016 02:36:35 +0000 (04:36 +0200)]
Logging: Filter out unwanted newlines

055804e89ea0f6b4145040a0eeb2f4e6951692fe changed the outgoing
SCPI message termination by always adding a newline. This results
in the following log output:

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

This patch restores the previous unterminated SCPI message logging:

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

As it's located in the general logging mechanism, we deal with any
additional (and unwanted) newlines this way.

7 years agorigol-ds: properly report which channel is enabled.
Aurelien Jacobs [Sat, 25 Jun 2016 19:37:53 +0000 (21:37 +0200)]
rigol-ds: properly report which channel is enabled.

7 years agorigol-ds: add support for getting/setting trigger level.
Aurelien Jacobs [Sat, 25 Jun 2016 16:19:47 +0000 (18:19 +0200)]
rigol-ds: add support for getting/setting trigger level.

7 years agorigol-ds: add PROBE_FACTOR support.
Aurelien Jacobs [Sun, 22 Feb 2015 23:32:01 +0000 (00:32 +0100)]
rigol-ds: add PROBE_FACTOR support.

7 years agorigol-ds: split out vertical config reading in its own function for re-use.
Aurelien Jacobs [Sat, 25 Jun 2016 15:21:20 +0000 (17:21 +0200)]
rigol-ds: split out vertical config reading in its own function for re-use.

7 years agogroup all drivers into a single object
Aurelien Jacobs [Sun, 5 Jun 2016 21:10:44 +0000 (23:10 +0200)]
group all drivers into a single object

This single object also contains the sr_drivers_init function, that will
always be referenced. That ensures that the drivers object files won't
be optimized out during static linking due to the fact that they are
not referenced directly.

This addresses (parts of) bug #802.

7 years agooutput/analog: Drop unused fancyprint() and si_printf().
Uwe Hermann [Sat, 28 May 2016 16:37:04 +0000 (18:37 +0200)]
output/analog: Drop unused fancyprint() and si_printf().

These functions were only used in the SR_DF_ANALOG_OLD case,
whereas the SR_DF_ANALOG case already used functions and lists
from src/analog.c.

This closes bug #636.

7 years agosession: Drop SR_DF_ANALOG_OLD support completely.
Uwe Hermann [Sat, 28 May 2016 16:01:13 +0000 (18:01 +0200)]
session: Drop SR_DF_ANALOG_OLD support completely.

This closes bug #728.

7 years agotransform/scale: Drop support for SR_DF_ANALOG_OLD.
Uwe Hermann [Sat, 14 May 2016 14:27:28 +0000 (16:27 +0200)]
transform/scale: Drop support for SR_DF_ANALOG_OLD.

7 years agotransform/invert: Drop support for SR_DF_ANALOG_OLD.
Uwe Hermann [Sat, 14 May 2016 14:26:56 +0000 (16:26 +0200)]
transform/invert: Drop support for SR_DF_ANALOG_OLD.

7 years agooutput/analog: Drop support for SR_DF_ANALOG_OLD.
Uwe Hermann [Sat, 14 May 2016 14:26:04 +0000 (16:26 +0200)]
output/analog: Drop support for SR_DF_ANALOG_OLD.

7 years agooutput/csv: Drop support for SR_DF_ANALOG_OLD.
Uwe Hermann [Sat, 14 May 2016 14:25:33 +0000 (16:25 +0200)]
output/csv: Drop support for SR_DF_ANALOG_OLD.

7 years agooutput/wav: Drop support for SR_DF_ANALOG_OLD.
Uwe Hermann [Sat, 14 May 2016 14:24:23 +0000 (16:24 +0200)]
output/wav: Drop support for SR_DF_ANALOG_OLD.

7 years agosession_driver.c: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 16:01:10 +0000 (18:01 +0200)]
session_driver.c: Convert to SR_DF_ANALOG.

7 years agolibsigrok-internal.h: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 16:00:14 +0000 (18:00 +0200)]
libsigrok-internal.h: Convert to SR_DF_ANALOG.

7 years agoyokogawa-dlm: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:47:45 +0000 (17:47 +0200)]
yokogawa-dlm: Convert to SR_DF_ANALOG.

7 years agouni-t-ut32x: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:47:33 +0000 (17:47 +0200)]
uni-t-ut32x: Convert to SR_DF_ANALOG.

7 years agouni-t-dmm: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:47:22 +0000 (17:47 +0200)]
uni-t-dmm: Convert to SR_DF_ANALOG.

7 years agotesto: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:47:11 +0000 (17:47 +0200)]
testo: Convert to SR_DF_ANALOG.

7 years agoteleinfo: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:47:00 +0000 (17:47 +0200)]
teleinfo: Convert to SR_DF_ANALOG.

7 years agoserial-dmm: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:46:47 +0000 (17:46 +0200)]
serial-dmm: Convert to SR_DF_ANALOG.

7 years agoscpi-pps: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:46:31 +0000 (17:46 +0200)]
scpi-pps: Convert to SR_DF_ANALOG.

7 years agomaynuo-m97: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:46:17 +0000 (17:46 +0200)]
maynuo-m97: Convert to SR_DF_ANALOG.

7 years agomotech-lps-30x: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:46:06 +0000 (17:46 +0200)]
motech-lps-30x: Convert to SR_DF_ANALOG.

7 years agolascar-el-usb: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:45:55 +0000 (17:45 +0200)]
lascar-el-usb: Convert to SR_DF_ANALOG.

7 years agokecheng-kc-330b: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:45:44 +0000 (17:45 +0200)]
kecheng-kc-330b: Convert to SR_DF_ANALOG.

7 years agohung-chang-dso-2100: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:45:33 +0000 (17:45 +0200)]
hung-chang-dso-2100: Convert to SR_DF_ANALOG.

7 years agohantek-dso: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:45:09 +0000 (17:45 +0200)]
hantek-dso: Convert to SR_DF_ANALOG.

7 years agogwinstek-gds-800: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:44:06 +0000 (17:44 +0200)]
gwinstek-gds-800: Convert to SR_DF_ANALOG.

7 years agogmc-mh-1x-2x: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:43:50 +0000 (17:43 +0200)]
gmc-mh-1x-2x: Convert to SR_DF_ANALOG.

7 years agofx2lafw: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:41:35 +0000 (17:41 +0200)]
fx2lafw: Convert to SR_DF_ANALOG.

7 years agocolead-slm: Convert to SR_DF_ANALOG.
Uwe Hermann [Fri, 27 May 2016 20:16:15 +0000 (22:16 +0200)]
colead-slm: Convert to SR_DF_ANALOG.

7 years agodemo: Convert to SR_DF_ANALOG.
Uwe Hermann [Fri, 27 May 2016 20:16:03 +0000 (22:16 +0200)]
demo: Convert to SR_DF_ANALOG.

7 years agocem-dt-885x: Convert to SR_DF_ANALOG.
Uwe Hermann [Fri, 27 May 2016 15:33:46 +0000 (17:33 +0200)]
cem-dt-885x: Convert to SR_DF_ANALOG.

7 years agofluke-dmm: Convert to SR_DF_ANALOG.
Uwe Hermann [Fri, 27 May 2016 15:31:14 +0000 (17:31 +0200)]
fluke-dmm: Convert to SR_DF_ANALOG.

7 years agobrymen-dmm: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 15:30:10 +0000 (17:30 +0200)]
brymen-dmm: Convert to SR_DF_ANALOG.

7 years agobrymen-bm86x: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 15:26:13 +0000 (17:26 +0200)]
brymen-bm86x: Convert to SR_DF_ANALOG.

7 years agobaylibre-acme: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 15:23:27 +0000 (17:23 +0200)]
baylibre-acme: Convert to SR_DF_ANALOG.

7 years agonorma-dmm: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 15:21:49 +0000 (17:21 +0200)]
norma-dmm: Convert to SR_DF_ANALOG.

7 years agoatten-pps3xxx: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 15:18:44 +0000 (17:18 +0200)]
atten-pps3xxx: Convert to SR_DF_ANALOG.

7 years agoappa-55ii: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 15:17:15 +0000 (17:17 +0200)]
appa-55ii: Convert to SR_DF_ANALOG.

7 years agoagilent-dmm: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 15:14:53 +0000 (17:14 +0200)]
agilent-dmm: Convert to SR_DF_ANALOG.

7 years agocenter-3xx: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 15:13:26 +0000 (17:13 +0200)]
center-3xx: Convert to SR_DF_ANALOG.

7 years agokern-scale: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 15:10:34 +0000 (17:10 +0200)]
kern-scale: Convert to SR_DF_ANALOG.

7 years agorigol-ds: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 15:09:14 +0000 (17:09 +0200)]
rigol-ds: Convert to SR_DF_ANALOG.

7 years agokorad-kaxxxxp: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 15:06:54 +0000 (17:06 +0200)]
korad-kaxxxxp: Convert to SR_DF_ANALOG.

7 years agohantek-6xxx: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 15:04:53 +0000 (17:04 +0200)]
hantek-6xxx: Convert to SR_DF_ANALOG.

7 years agomanson-hcs-3xxx: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 15:03:08 +0000 (17:03 +0200)]
manson-hcs-3xxx: Convert to SR_DF_ANALOG.

7 years agotondaj-sl-814: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 14:33:35 +0000 (16:33 +0200)]
tondaj-sl-814: Convert to SR_DF_ANALOG.

7 years agodmm: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:33:30 +0000 (17:33 +0200)]
dmm: Convert to SR_DF_ANALOG.

7 years agolcr: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 28 May 2016 15:48:04 +0000 (17:48 +0200)]
lcr: Convert to SR_DF_ANALOG.

7 years agoscale: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 15:11:46 +0000 (17:11 +0200)]
scale: Convert to SR_DF_ANALOG.

7 years agoinput/wav: Convert to SR_DF_ANALOG.
Uwe Hermann [Sat, 14 May 2016 14:20:55 +0000 (16:20 +0200)]
input/wav: Convert to SR_DF_ANALOG.

7 years agozeroplus: Fix config_list() wrt drvopts/devopts.
Yasushi SHOJI [Fri, 3 Jun 2016 20:39:29 +0000 (05:39 +0900)]
zeroplus: Fix config_list() wrt drvopts/devopts.

When config_list() gets NULL as sdi, it must return driver opts.
Some drivers, including zeroplus, don't check sdi and return both
driver opts and device opts.

7 years agosw_limits: Log when the sample/time limit is reached.
Uwe Hermann [Wed, 1 Jun 2016 07:24:29 +0000 (09:24 +0200)]
sw_limits: Log when the sample/time limit is reached.

7 years agoRemove unnecessary std_serial_dev_acquisition_stop() wrappers
Lars-Peter Clausen [Sat, 28 May 2016 12:13:08 +0000 (14:13 +0200)]
Remove unnecessary std_serial_dev_acquisition_stop() wrappers

Now that std_serial_dev_acquisition_stop() has the same signature as
the sr_dev_driver dev_acquisition_stop() callback it is possible to remove
the wrapper functions and use std_serial_dev_acquisition_stop() directly
has the callback function.

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agostd_serial_dev_acquisition_stop(): Remove dev_close_fn parameter
Lars-Peter Clausen [Sat, 28 May 2016 11:54:08 +0000 (13:54 +0200)]
std_serial_dev_acquisition_stop(): Remove dev_close_fn parameter

All callers of std_serial_dev_acquisition_stop() currently pass the same
callback for the dev_close_fn parameter as the dev_close callback of their
sr_dev_driver struct. Remove the dev_close_fn parameter and invoke the
drivers dev_close() callback directly. This simplifies the API and ensures
consistent behaviour between different drivers.

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agostd_serial_dev_acquisition_stop(): Remove serial parameter
Lars-Peter Clausen [Sat, 28 May 2016 11:41:03 +0000 (13:41 +0200)]
std_serial_dev_acquisition_stop(): Remove serial parameter

All callers of std_serial_dev_acquisition_stop() currently pass sdi->conn
for the serial parameter. And the other std_serial helper functions already
require that the conn field of the sr_driver_inst passed to the functions
points to the sr_serial_dev_inst associated with the device.

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

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agoUse driver name as the log prefix in standard functions
Lars-Peter Clausen [Sun, 8 May 2016 13:47:35 +0000 (15:47 +0200)]
Use driver name as the log prefix in standard functions

Some of the standard helper functions take a log prefix parameter that is
used when printing messages. This log prefix is almost always identical to
the name field in the driver's sr_dev_driver struct. The only exception are
drivers which register multiple sr_dev_driver structs.

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

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agopce-322a: Pass driver dev_close callback std_serial_dev_acquisition_stop()
Lars-Peter Clausen [Sat, 28 May 2016 11:45:54 +0000 (13:45 +0200)]
pce-322a: Pass driver dev_close callback std_serial_dev_acquisition_stop()

All drivers with the exception of pce-322a pass their dev_close callback to
std_serial_dev_acquisition_stop(). The pce-322a passes std_serial_dev_close()
which is also called from its dev_close() callback and replicates the other
functionality of its dev_close() callback directly in
std_serial_dev_acquisition_stop().

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

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agosw_limits: Add documentation
Lars-Peter Clausen [Fri, 13 May 2016 11:46:44 +0000 (13:46 +0200)]
sw_limits: Add documentation

Add documentation for the software limits module.

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agogmc-mh-1x-2x: Use software limits helpers
Lars-Peter Clausen [Wed, 4 May 2016 12:19:26 +0000 (14:19 +0200)]
gmc-mh-1x-2x: Use software limits helpers

Use the new software limit helper functions rather than open-coding their
functionality.

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

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agofluke-dmm: Use software limits helpers
Lars-Peter Clausen [Wed, 4 May 2016 12:19:04 +0000 (14:19 +0200)]
fluke-dmm: Use software limits helpers

Use the new software limit helper functions rather than open-coding their
functionality.

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

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agoarachnid-labs-re-load-pro: Use software limit helpers
Lars-Peter Clausen [Wed, 4 May 2016 12:27:05 +0000 (14:27 +0200)]
arachnid-labs-re-load-pro: Use software limit helpers

Use the new software limit helper functions rather than open-coding their
functionality.

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agoagilent-dmm: Use software limits helpers
Lars-Peter Clausen [Wed, 4 May 2016 12:18:51 +0000 (14:18 +0200)]
agilent-dmm: Use software limits helpers

Use the new software limit helper functions rather than open-coding their
functionality.

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

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agoBuild: avoid $< in ruby bindings rules
Aurelien Jacobs [Wed, 25 May 2016 20:38:41 +0000 (22:38 +0200)]
Build: avoid $< in ruby bindings rules

This fixes building with BSD make.
This closes bug #801.

7 years agonorma-dmm: Remove unused version field from state struct
Lars-Peter Clausen [Wed, 4 May 2016 09:44:04 +0000 (11:44 +0200)]
norma-dmm: Remove unused version field from state struct

The version field in the norma-dmm driver state struct is initialized, but
never read and the same information is also already available in the
sr_dev_inst struct version field. So remove it to simplify the code.

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

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agoFix a few "variable set but not used" compiler warnings.
Uwe Hermann [Fri, 27 May 2016 13:11:28 +0000 (15:11 +0200)]
Fix a few "variable set but not used" compiler warnings.

../src/hardware/appa-55ii/api.c: In function ‘scan’:
../src/hardware/appa-55ii/api.c:47:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/arachnid-labs-re-load-pro/api.c: In function ‘scan’:
../src/hardware/arachnid-labs-re-load-pro/api.c:62:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/atten-pps3xxx/api.c: In function ‘scan’:
../src/hardware/atten-pps3xxx/api.c:81:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/brymen-dmm/api.c: In function ‘scan’:
../src/hardware/brymen-dmm/api.c:89:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/cem-dt-885x/api.c: In function ‘scan’:
../src/hardware/cem-dt-885x/api.c:74:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/conrad-digi-35-cpu/api.c: In function ‘scan’:
../src/hardware/conrad-digi-35-cpu/api.c:45:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/demo/demo.c: In function ‘scan’:
../src/hardware/demo/demo.c:255:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/fluke-dmm/api.c: In function ‘fluke_scan’:
../src/hardware/fluke-dmm/api.c:64:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/gmc-mh-1x-2x/api.c: In function ‘scan_1x_2x_rs232’:
../src/hardware/gmc-mh-1x-2x/api.c:147:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/gmc-mh-1x-2x/api.c: In function ‘scan_2x_bd232’:
../src/hardware/gmc-mh-1x-2x/api.c:234:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/ikalogic-scanaplus/api.c: In function ‘scan’:
../src/hardware/ikalogic-scanaplus/api.c:69:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^
../src/hardware/tondaj-sl-814/api.c: In function ‘scan’:
../src/hardware/tondaj-sl-814/api.c:44:22: warning: variable ‘drvc’ set but not used [-Wunused-but-set-variable]
  struct drv_context *drvc;
                      ^

7 years agostd_scan_complete(): Catch some errors to avoid segfaults.
Uwe Hermann [Fri, 27 May 2016 12:29:52 +0000 (14:29 +0200)]
std_scan_complete(): Catch some errors to avoid segfaults.

Check some variables for NULL before dereference to avoid segfaults due
to buggy drivers (and show error messages so these issues are noticed early).

7 years agoSimplify single device list handling
Lars-Peter Clausen [Mon, 16 May 2016 09:37:23 +0000 (11:37 +0200)]
Simplify single device list handling

Some driver scan() functions only ever return a single device. For those it
is possible to slightly simplify the handling of the device list by
creating it on demand when the function returns.

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

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

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agoAdd helper function for scan completion
Lars-Peter Clausen [Sun, 15 May 2016 16:33:31 +0000 (18:33 +0200)]
Add helper function for scan completion

A common task during device scan is to add the newly discovered devices to
the instance list of the driver. Currently this is done by each driver on
its own. This patch introduces a new helper function std_scan_complete()
which takes care of this. The function should be called at the end of a
driver's scan() callback before returning the device list.

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

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

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

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agoDon't reset instance list in scan() callback
Lars-Peter Clausen [Sun, 15 May 2016 15:20:51 +0000 (17:20 +0200)]
Don't reset instance list in scan() callback

Some drivers set the device instance list to NULL in their scan() callback.
This means the driver loses all references to any devices contained in that
list and their resources will be leaked. Drivers can't free the devices at
this point either since an application might still use a device on the
list. So the existing devices on the instance list need to remain
unmodified during the scan() callback, even if that means that there will
be duplicates on the instance list. Only an explicit invocation of
sr_dev_clear() by the application is allowed to free the devices on the
instance list and reset the list.

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agodetect the appropriate link flag for retaining all objects of static lib
Aurelien Jacobs [Sat, 21 May 2016 17:46:14 +0000 (19:46 +0200)]
detect the appropriate link flag for retaining all objects of static lib

This closes bug #802.

7 years agotesto: Minor indentation fixes.
Uwe Hermann [Thu, 26 May 2016 15:47:28 +0000 (17:47 +0200)]
testo: Minor indentation fixes.

7 years agolink-mso19: mso_receive_data: Simplify device instance lookup
Lars-Peter Clausen [Mon, 23 May 2016 16:21:40 +0000 (18:21 +0200)]
link-mso19: mso_receive_data: Simplify device instance lookup

The link-mso19 driver currently iterates the device instance list of the
driver to get the device instance for which the callback is called.

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

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

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agolink-mso19: Use default dev_clear() handler
Lars-Peter Clausen [Tue, 10 May 2016 12:05:41 +0000 (14:05 +0200)]
link-mso19: Use default dev_clear() handler

The link-mso19 open-codes the std_dev_clear() function and uses it as its
custom dev_clear() callback. The std_dev_clear() function is automatically
called if no custom dev_clear() callback is specified, so just drop custom
implementation and use the default.

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

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agolink-mso19: Drop unnecessary NULL check
Lars-Peter Clausen [Tue, 10 May 2016 12:03:02 +0000 (14:03 +0200)]
link-mso19: Drop unnecessary NULL check

sdi is allocated using g_malloc0() which can never fail, in addition to
that sdi is already dereferenced before the check, which makes the check
useless. So remove it.

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agoFix Ruby bindings build on Mac OS X and FreeBSD.
Uwe Hermann [Thu, 19 May 2016 20:46:24 +0000 (22:46 +0200)]
Fix Ruby bindings build on Mac OS X and FreeBSD.

Using "\s*" on BSD sed doesn't work the same way as on GNU sed, thus
yielding e.g. " 3.0.8" instead of "3.0.8" in a ./configure check, which
later prevents the Ruby bindings from being built.

Fix this by simply using exactly one space in the sed invocation, since
swig seems to always use just one space there anyway.

Tested on Mac OS X, FreeBSD, and Linux.

This closes bug #800.

7 years agoprevent the sr_driver_list section to be dropped with static linking
Aurelien Jacobs [Thu, 19 May 2016 14:25:14 +0000 (16:25 +0200)]
prevent the sr_driver_list section to be dropped with static linking

7 years agoscpi-pps: Add profile for HP 6633A supply
Alexandru Gagniuc [Sun, 8 May 2016 19:57:06 +0000 (12:57 -0700)]
scpi-pps: Add profile for HP 6633A supply

Oldie but goodie. Some of the HP 6632B options are renamed for
clarity, as they are common among the A and B variants.

7 years agoscpi-pps: Add shadow driver for HPIB supplies (ID? instead of *IDN?)
Alexandru Gagniuc [Sun, 8 May 2016 19:30:51 +0000 (12:30 -0700)]
scpi-pps: Add shadow driver for HPIB supplies (ID? instead of *IDN?)

HP instruments predating the 488.2 and SCPI standards do not
necessarily have a SCPI-compliant command set. The HP6630A series of
supplies is one such example.

While scpi-pps is flexible enough to accomodate almost any command
syntax given the right profile, it still assumes that "*IDN?" is the
correct question to ask the instrument. Since older HP gear instead
responds to "ID?", this assumption is no longer true.

Thus sr_scpi_get_hw_id() is not appropriate for these instruments, and
the shadow driver added here only replaces that function call, while
reusing the rest of the existing logic. The extra noise is necessary
in order to propagate this through the .scan member of the driver.

7 years agosaleae-logic16: Consolidate the samplerate limits into a single bitrate cap
Marcus Comstedt [Wed, 18 May 2016 21:10:46 +0000 (23:10 +0200)]
saleae-logic16: Consolidate the samplerate limits into a single bitrate cap

7 years agosaleae-logic16: Add 20MHz and 50MHz to samplerate preset list (bug #799)
Marcus Comstedt [Wed, 18 May 2016 21:08:42 +0000 (23:08 +0200)]
saleae-logic16: Add 20MHz and 50MHz to samplerate preset list (bug #799)

7 years agopce-322a: Initial driver implementation.
George Hopkins [Sat, 30 Apr 2016 20:34:15 +0000 (22:34 +0200)]
pce-322a: Initial driver implementation.

7 years agoftdi-la: Use the standard connection_id field for the device address
Lars-Peter Clausen [Sat, 14 May 2016 15:24:27 +0000 (17:24 +0200)]
ftdi-la: Use the standard connection_id field for the device address

Use the standard connection_id field from the struct sr_dev_inst for
storing the device address rather than using the custom address field in
the driver state struct. This makes things more consistent with the
framework.

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agoftdi-la: Cleanup ftdi_context handling
Lars-Peter Clausen [Sat, 14 May 2016 15:24:27 +0000 (17:24 +0200)]
ftdi-la: Cleanup ftdi_context handling

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agolascar-el-usb: Add a missing SR_PRIV.
Uwe Hermann [Sat, 14 May 2016 11:35:28 +0000 (13:35 +0200)]
lascar-el-usb: Add a missing SR_PRIV.

7 years agoPut driver pointers into special section
Lars-Peter Clausen [Thu, 12 May 2016 13:13:47 +0000 (15:13 +0200)]
Put driver pointers into special section

The sigrok core needs a list of all available drivers. Currently this list
is manually maintained by updating a global list whenever a driver is added
or removed.

Introduce a new special section that contains the list of all drivers. The
SR_REGISTER_DEV_DRIVER() and SR_REGISTER_DEV_DRIVER_LIST() macro is used to
add drivers to this new list. This is done by placing the pointers to the
driver into a special section. Since nothing else is in this section it is
known that it is simply a list of driver pointers and the core can iterate
over it as if it was an array.

The advantage of this approach is that the code necessary to add a driver
to the list is completely contained to the driver source and it is no
longer necessary to maintain a global list. If a driver is built it will
automatically appear in the list, if it is not built in won't. This means
that the list is always correct, whereas the previous approach used ifdefs
in the global driver list file which could get out-of-sync with the actual
condition when the driver was built.

Any sr_dev_driver structs that are no longer used outside the driver module
are marked as static.

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agoDrop unnecessary struct sr_dev_driver forward declarations
Lars-Peter Clausen [Sun, 8 May 2016 12:26:56 +0000 (14:26 +0200)]
Drop unnecessary struct sr_dev_driver forward declarations

Most drivers have a forward declaration to their sr_dev_driver struct at
the beginning of the driver file. This is due to historic reasons and often
no longer required. So remove all the unnecessary forward declarations.

Some drivers still require the forward declaration, but only reference the
driver struct from within the driver scan() callback. Since the driver
struct is passed to the scan callback replace the references to the global
variable with the local parameter. In some cases this requires adding the
parameter to some of the helper functions that are called from the scan()
callback.

Signed-off-by: Lars-Peter Clausen <redacted>
7 years agoconfig_list: Don't check for sdi->priv != NULL.
Uwe Hermann [Sat, 14 May 2016 14:11:53 +0000 (16:11 +0200)]
config_list: Don't check for sdi->priv != NULL.

If sdi is != NULL, the backend ensures that sdi->priv is also != NULL.
Almost all drivers were relying on this already.

7 years agoconfig_get(): Don't check for sdi->priv != NULL.
Uwe Hermann [Sat, 14 May 2016 13:41:45 +0000 (15:41 +0200)]
config_get(): Don't check for sdi->priv != NULL.

If sdi is != NULL, the backend ensures that sdi->priv is also != NULL.
Almost all drivers were relying on this already.

7 years agoconfig_set(): Don't check for sdi->priv != NULL.
Uwe Hermann [Sat, 14 May 2016 13:25:19 +0000 (15:25 +0200)]
config_set(): Don't check for sdi->priv != NULL.

Instead, have the backend check that sdi->priv is not NULL (which
many drivers have been assuming already anyway).

7 years agohameg-hmo: add one missing g_free
Stefan Brüns [Mon, 2 May 2016 22:22:12 +0000 (00:22 +0200)]
hameg-hmo: add one missing g_free

7 years agohameg-hmo: Add comment clarifying coupling options
Stefan Brüns [Mon, 2 May 2016 22:14:37 +0000 (00:14 +0200)]
hameg-hmo: Add comment clarifying coupling options

50 Ohm termination is only available on the higher end scopes.

7 years agohameg-hmo: use SR_DF_ANALOG, use definite length blocks for retrieval
Stefan Brüns [Mon, 2 May 2016 22:38:16 +0000 (00:38 +0200)]
hameg-hmo: use SR_DF_ANALOG, use definite length blocks for retrieval

Using binary formats is about 3 times faster than ASCii format. This
addresses bug #791.

7 years agohameg-hmo: Query probe unit (Volt, Ampere) from scope
Stefan Brüns [Mon, 2 May 2016 22:08:58 +0000 (00:08 +0200)]
hameg-hmo: Query probe unit (Volt, Ampere) from scope

7 years agoscpi: introduce some more requests
Stefan Brüns [Mon, 18 Apr 2016 18:30:39 +0000 (20:30 +0200)]
scpi: introduce some more requests

7 years agoscpi: Add support for arbitray/definite length block data retrieval
Stefan Brüns [Sun, 1 May 2016 03:20:39 +0000 (05:20 +0200)]
scpi: Add support for arbitray/definite length block data retrieval

Binary block data is specified in IEEE 488.2. First character is '#',
followed by a single ascii digit denoting the the number of digits needed
for the length specification. Length is given in bytes.

This allows drivers to replace retrieval of comma separated ASCII values
with binary formats. See bug #791.

7 years agoscpi_vxi: Fix incomplete reads (bug #790)
Stefan Brüns [Mon, 2 May 2016 00:51:19 +0000 (02:51 +0200)]
scpi_vxi: Fix incomplete reads (bug #790)