Commit Graph

4335 Commits

Author SHA1 Message Date
Lars-Peter Clausen 91b77e6b1d testo: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:44:41 +02:00
Lars-Peter Clausen ffa5f177f1 teleinfo: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:44:41 +02:00
Lars-Peter Clausen 9f51c463d1 serial-dmm: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:44:41 +02:00
Lars-Peter Clausen 37dbffd15d norma-dmm: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:44:41 +02:00
Lars-Peter Clausen 8aafc5e64d motech-lps-30x: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:15 +02:00
Lars-Peter Clausen 301090aa58 mic-985xx: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:15 +02:00
Lars-Peter Clausen 45b75c368f maynuo-m97: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:15 +02:00
Lars-Peter Clausen a655b3fd08 manson-hcs-3xxx: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:15 +02:00
Lars-Peter Clausen 597deef91e korad-kaxxxxp: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:15 +02:00
Lars-Peter Clausen 7fc9dc31ac kern-scale: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:14 +02:00
Lars-Peter Clausen 9edb98982a colead-slm: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:14 +02:00
Lars-Peter Clausen 838f6906a4 center-3xx: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:14 +02:00
Lars-Peter Clausen dcba0c41f5 brymen-dmm: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:14 +02:00
Lars-Peter Clausen ab939ebba6 brymen-bm86x: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:14 +02:00
Lars-Peter Clausen d54a7c42ac baylibre-acme: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:14 +02:00
Lars-Peter Clausen e2492a3374 appa-55ii: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:14 +02:00
Lars-Peter Clausen aea4e45848 Add helper functions for software limits
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:14 +02:00
Benjamin Larsson afb001a359 udev rules file: Add entry for Sainsmart DDS120. 2016-05-05 14:06:51 +02:00
Bert Vermeulen ec1a1a8c46 testo: Minor code cleanup. 2016-05-04 01:33:31 +02:00
Lars-Peter Clausen efa9840222 Remove unnecessary driver context checks
Some drivers check in some of their driver callbacks if the driver has been
initialized and return an error if it has not.

For the scan() callback the sigrok core checks if the driver has been
initialized and if not returns an error. So it is not possible that the
scan() callback gets called if the driver is not initialized. Without the
scan() callback succeeding it is not possible to get a reference to a
device which is associated with the driver, so it is not possible that any
of the device specific callbacks is called without the driver first being
initialized either.

In conclusion these checks are not necessary since they never evaluate to
true and can be dropped. If they should ever become necessary they should
be done in the sigrok core so all drivers and all callbacks are equally
handled.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-04 01:33:02 +02:00
Lars-Peter Clausen e91bb0a6c4 Drop SR_CONF_SET flag from SR_CONF_CONTINUOUS options
SR_CONF_CONTINUOUS is a capability option indicating whether a device
supports continuous capture or not. If the option exists the device
supports continuous capture and otherwise it doesn't. There is no value
associated with it and hence setting the SR_CONF_SET flag is nonsensical.

None of the drivers which set SR_CONF_SET for SR_CONF_CONTINUOUS handle it
in their config_set() callback and return an error if an application tried
to perform a config_set() operation for SR_CONF_CONTINUOUS.

Simply remove the SR_CONF_SET flag from all SR_CONF_CONTINUOUS options.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-03 21:49:02 +02:00
Lars-Peter Clausen c01bf34ca2 Introduce standard implementation of the dev_list() callback
Every single hardware driver has the very same implementation of the
dev_list() callback. Put this into a helper function in the standard helper
library and use it throughout the drivers. This reduces boiler-plate code
by quite a bit.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-03 21:25:16 +02:00
Lars-Peter Clausen 88a0265ebc Remove unnecessary dev_clear() callbacks
If a driver does not implement a dev_clear() callback the core will
automatically call std_dev_clear(di, NULL). Remove all driver dev_clear()
implementations that are identical to default. This reduces the amount of
boiler-plate code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-03 21:24:55 +02:00
Lars-Peter Clausen 700d6b64d5 Introduce standard cleanup helper
std_init() allocates a drv_context struct which needs to be freed by the
driver in its cleanup struct. But the vast majority of drivers does never
does this causing memory leaks.

Instead of addressing the issue by manually adding code to free the struct
to each driver introduce a new helper function std_cleanup() that takes
care of this. In addition to freeing the drv_context struct std_cleanup()
also invokes sr_dev_clear() which takes care of freeing all devices
attached to the driver.

Combining both operations in the same helper function allows to use
std_cleanup() as the cleanup callback for all existing drivers, which
reduces the amount of boiler-plate code quite a bit.

All drivers are updated to use the new helper function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-03 21:24:39 +02:00
Lars-Peter Clausen 1e726f568d scpi-pps: Fix dev_clear() implementation
Devices for the scpi-pps driver do have additional data attached to it that
needs to be freed when the device is freed. While the driver gets it right
for the cleanup() callback it does not for the dev_clear() callback. This
will cause memory leaks when sr_dev_clear() is called for this driver.

To fix this let the dev_clear() free the additional data.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-03 21:24:26 +02:00
Lars-Peter Clausen 696b79d2aa deree-de5000: Provide dev_clear()
Devices for the deree-de5000 driver do have additional data attached to it
that needs to be freed when the device is freed. While the driver gets it
right for the cleanup() callback it does not implement a dev_clear()
callback, so the default dev_clear() implementation is used which will not
free the additional data. This will cause memory leaks when sr_dev_clear()
is called for this driver.

To fix this provide a dev_clear() implementation that frees the additional
data.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-03 21:24:12 +02:00
Lars-Peter Clausen 6ab687315b demo: Provide dev_clear()
Devices for the demo driver do have additional data attached to it that
needs to be freed when the device is freed. While the driver gets it right
for the cleanup() callback it does not implement a dev_clear() callback, so
the default dev_clear() implementation is used which will not free the
additional data. This will cause memory leaks when sr_dev_clear() is called
for this driver.

To fix this provide a dev_clear() implementation that frees the additional
data.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-03 21:23:57 +02:00
Lars-Peter Clausen 74c6d807ef beaglelogic: Use std_dev_clear() instead of open-coding it
The beaglelogic has an open-coded version of std_dev_clear(), replace it
with std_dev_clear().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-03 21:23:41 +02:00
Lars-Peter Clausen a64fec2b8e baylibre-acme: Properly free GErrors returned by g_file_get_contents()
When g_file_get_contents() encounters an error a new GError will be
allocated and passed back to the application. The application is
responsible for freeing this GError.

The baylibre-acme driver currently does not do this and as a result leaks
memory during the scan process when no device is found.

Add the missing g_error_free() invocations to fix the issue.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-03 21:23:22 +02:00
Lars-Peter Clausen 7b6072d354 ftdi-la: Properly cleanup in scan_all()
Make sure to free the FTDI device list and the FTDI context in scan_all()
otherwise memory leaks can be observed. Also make sure to free the FTDI
context in scan_device() on the error path.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-03 21:22:38 +02:00
Uwe Hermann 61c9085898 dev_open(): Don't check for sdi != NULL.
The wrapper guarantees that sdi is not NULL.
2016-04-29 19:26:17 +02:00
Uwe Hermann c50805d59c Drop some unused or duplicated code. 2016-04-29 19:26:17 +02:00
Uwe Hermann 8f878dc6aa cem-dt-885x/colead-slm: Use std_serial_dev_open(). 2016-04-29 19:26:17 +02:00
Uwe Hermann a52e2a0b37 Random cosmetics and whitespace fixes. 2016-04-29 19:26:17 +02:00
Uwe Hermann 67ea60e03d uni-t-ut32x: Fix copy-paste error. 2016-04-29 19:26:17 +02:00
Uwe Hermann df3ea149cc dev_acquisition_start(): Ensure that sdi is always != NULL. 2016-04-29 19:26:17 +02:00
Uwe Hermann 8cb222e143 Drop some obsolete and unneeded comments. 2016-04-29 19:20:53 +02:00
Uwe Hermann 6525d819ee std_serial_dev_acquisition_stop(): Drop unneeded parameter. 2016-04-29 19:20:53 +02:00
Uwe Hermann 695dc859c1 dev_acquisition_{start,stop}(): Drop duplicate 'cb_data' parameter.
These are always 'sdi', which is passed in already.
2016-04-29 19:20:53 +02:00
Uwe Hermann 208c1d3543 Consistently don't check sdi->priv in dev_acquisition_start().
Most drivers already assume this to be != NULL anyway, and the check
should probably be in the API wrappers anyway.
2016-04-29 18:08:15 +02:00
Uwe Hermann 1c47e0da8f Drop unneeded std_session_send_df_header() comments. 2016-04-29 18:08:15 +02:00
Uwe Hermann 3be42bc22f Factor out std_session_send_df_end() helper.
This makes the code shorter, simpler and more consistent, and also
ensures that the (same) debug messages are always emitted and the
packet.payload field is consistently set to NULL always, etc.
2016-04-29 18:08:15 +02:00
Benjamin Larsson 7fb90f94d6 fx2lafw: Add working glue layer for frontends 2016-04-29 15:19:08 +02:00
Joel Holdsworth 7e5ccff2ec fx2lafw: Add analog sampling handler
This will be needed for the MSO support of the CWAV USBee AX and clones.
2016-04-27 22:49:51 +02:00
Joel Holdsworth 7b5d1c64fc fx2lafw: Factor out packet sending
This will make it possible to use different senders based on
driver mode. This is needed for USBee AX support.
2016-04-27 22:29:56 +02:00
Joel Holdsworth ce35b282de fx2lafw: Add CTL2 clocking command flag to header
The USBee AX hardware needs a sampling clock that is lower than
the 30MHz or 48MHz that the FX2 has to offer. This flag will enable
clocking via the CTL2 pin that is an even divisor of the main clock.
2016-04-27 22:29:16 +02:00
Joel Holdsworth 232a975fe2 fx2lafw: Add support for AX analog channel probing 2016-04-27 22:29:16 +02:00
Uwe Hermann 152e7f4d7c hwdriver.c: Add missing SR_MQFLAG_FOUR_WIRE entry. 2016-04-23 17:45:49 +02:00
Alexandru Gagniuc 9a093be9f5 hp-3457a: Implement support for rear terminals and plug-in cards 2016-04-23 17:44:26 +02:00
Alexandru Gagniuc 2c04f943ef hp-3457a: Implement AC, ACDC, and four-wire resistance modes
The driver did not look at the mq_flags provided with the
SR_CONF_MEASURED_QUANTITY key, and it defaulted to DC measurements.
Use the second member of the tuple provided by the config key, which
represents the flags for the measurement, and set the instrument's
measurement mode accordingly.
2016-04-23 17:44:26 +02:00