Commit Graph

4050 Commits

Author SHA1 Message Date
Uwe Hermann a6ad49b39f fx2lafw: Convert to SR_DF_ANALOG. 2016-06-16 15:05:04 +02:00
Uwe Hermann a8372c3ed9 colead-slm: Convert to SR_DF_ANALOG. 2016-06-16 15:05:04 +02:00
Uwe Hermann 4b770103e9 demo: Convert to SR_DF_ANALOG. 2016-06-16 15:05:04 +02:00
Uwe Hermann 7f9932e8db cem-dt-885x: Convert to SR_DF_ANALOG. 2016-06-16 15:05:04 +02:00
Uwe Hermann 3f5cf2a06a fluke-dmm: Convert to SR_DF_ANALOG. 2016-06-16 15:05:03 +02:00
Uwe Hermann 1653c4309a brymen-dmm: Convert to SR_DF_ANALOG. 2016-06-16 15:05:03 +02:00
Uwe Hermann a46f869b64 brymen-bm86x: Convert to SR_DF_ANALOG. 2016-06-16 15:05:03 +02:00
Uwe Hermann 633531416b baylibre-acme: Convert to SR_DF_ANALOG. 2016-06-16 15:05:03 +02:00
Uwe Hermann 55bee166eb norma-dmm: Convert to SR_DF_ANALOG. 2016-06-16 15:05:02 +02:00
Uwe Hermann 67eb7c6bdf atten-pps3xxx: Convert to SR_DF_ANALOG. 2016-06-16 15:05:02 +02:00
Uwe Hermann 0417ada03e appa-55ii: Convert to SR_DF_ANALOG. 2016-06-16 15:05:02 +02:00
Uwe Hermann 16aef67634 agilent-dmm: Convert to SR_DF_ANALOG. 2016-06-16 15:05:02 +02:00
Uwe Hermann d4f59ce86d center-3xx: Convert to SR_DF_ANALOG. 2016-06-16 15:05:02 +02:00
Uwe Hermann 563ba4a5c2 kern-scale: Convert to SR_DF_ANALOG. 2016-06-16 15:05:01 +02:00
Uwe Hermann 246399f788 rigol-ds: Convert to SR_DF_ANALOG. 2016-06-16 15:05:01 +02:00
Uwe Hermann 2e71534118 korad-kaxxxxp: Convert to SR_DF_ANALOG. 2016-06-16 15:05:01 +02:00
Uwe Hermann 2938c9d1d3 hantek-6xxx: Convert to SR_DF_ANALOG. 2016-06-16 15:05:01 +02:00
Uwe Hermann 2463ec77fe manson-hcs-3xxx: Convert to SR_DF_ANALOG. 2016-06-16 15:05:01 +02:00
Uwe Hermann c68ade3cc7 tondaj-sl-814: Convert to SR_DF_ANALOG. 2016-06-16 15:05:01 +02:00
Uwe Hermann b02bb45f4c dmm: Convert to SR_DF_ANALOG. 2016-06-16 15:05:00 +02:00
Uwe Hermann 7ffcf58736 lcr: Convert to SR_DF_ANALOG. 2016-06-16 15:05:00 +02:00
Uwe Hermann c6d527478a scale: Convert to SR_DF_ANALOG. 2016-06-15 19:33:48 +02:00
Uwe Hermann 0f33aaef54 input/wav: Convert to SR_DF_ANALOG. 2016-06-15 19:33:48 +02:00
Yasushi SHOJI 716d6dfcac 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.
2016-06-11 17:09:34 +02:00
Uwe Hermann 3ba944cf41 sw_limits: Log when the sample/time limit is reached. 2016-06-01 15:25:15 +02:00
Lars-Peter Clausen 4b1a9d5d86 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 <lars@metafoo.de>
2016-05-31 15:54:53 +02:00
Lars-Peter Clausen 1b38775baa 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 <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen 15f96409dc 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 <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen bee2b0168c 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 <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen 7d786a962d 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 <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen 580b94e4d7 sw_limits: Add documentation
Add documentation for the software limits module.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen 3c41387928 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 <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen 6aacf011de 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 <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen 014c7f93d4 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 <lars@metafoo.de>
2016-05-31 15:54:52 +02:00
Lars-Peter Clausen 5b6829eafe 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 <lars@metafoo.de>
2016-05-31 15:54:46 +02:00
Aurelien Jacobs d8f9609790 Build: avoid $< in ruby bindings rules
This fixes building with BSD make.
This closes bug #801.
2016-05-30 11:45:40 +02:00
Lars-Peter Clausen eabfed20f7 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 <lars@metafoo.de>
2016-05-28 12:52:05 +02:00
Uwe Hermann cd0de200b1 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;
                      ^
2016-05-27 15:11:28 +02:00
Uwe Hermann 39fcfdc9da 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).
2016-05-27 14:45:26 +02:00
Lars-Peter Clausen 43376f3324 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 <lars@metafoo.de>
2016-05-27 14:44:24 +02:00
Lars-Peter Clausen 15a5bfe481 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 <lars@metafoo.de>
2016-05-27 14:44:24 +02:00
Lars-Peter Clausen 566007e15e 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 <lars@metafoo.de>
2016-05-27 14:43:34 +02:00
Aurelien Jacobs d268866d29 detect the appropriate link flag for retaining all objects of static lib
This closes bug #802.
2016-05-26 17:48:09 +02:00
Uwe Hermann 176d18cab1 testo: Minor indentation fixes. 2016-05-26 17:47:28 +02:00
Lars-Peter Clausen f53ff64369 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 <lars@metafoo.de>
2016-05-23 18:25:24 +02:00
Lars-Peter Clausen e5ff8e9e0a 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 <lars@metafoo.de>
2016-05-23 18:24:58 +02:00
Lars-Peter Clausen f1e93a951e 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 <lars@metafoo.de>
2016-05-23 18:24:23 +02:00
Uwe Hermann 27272a704d 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.
2016-05-19 22:46:24 +02:00
Aurelien Jacobs d12123100a prevent the sr_driver_list section to be dropped with static linking 2016-05-19 18:28:00 +02:00
Alexandru Gagniuc e76a357536 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.
2016-05-19 08:16:51 -07:00