Commit Graph

1141 Commits

Author SHA1 Message Date
Bert Vermeulen c5f1a021b8 usb: strip overly verbose debugging 2012-12-15 04:07:25 +01:00
Bert Vermeulen 9ec7ff94ed victor-dmm: free in the right order 2012-12-15 04:07:25 +01:00
Bert Vermeulen e7f378fd1a usb: strip useless code 2012-12-15 04:07:25 +01:00
Alexandru Gagniuc e7ed87a469 serial-dmm: Use dummy info struct for rs9lcd parser
The rs9lcd parser, which is used for the RadioShack 22-812 does not use its
*info parameter, and therefore did not have a rs9lcd_info struct declared.

With recent re-factoring of the receive data callbacks, it became necessary to
pass a struct pointer. This made the RECV_DATA macro look like:

- RECV_DATA(RADIOSHACK_22_812, metex14)

giving the wrong impression that the RadioShack 22-182 uses the
metex14 protocol, which is not the case.

Create a dummy rs9lcd_info struct, and correctly identify the parser
as rs9lcd in the RECV_DATA macro:

+ RECV_DATA(RADIOSHACK_22_812, rs9lcd)

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-13 23:16:34 +01:00
Alexandru Gagniuc c69049091e libsigrok.h: Don't store subdriver in sr_dev_driver
Not all drivers use subdrivers. The only reason the subdriver field was
introduced was to accomodate the model of serial-dmm.

The sr_dev_driver struct is available to the frontend. Exposing the subdriver
field creates the problem of exposing knowledge of libsigrok's internal driver
layout, even though the drivers are designed to be a flat list to the frontend.

Store the subdriver in the dev_context struct of serial-dmm.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-13 23:16:34 +01:00
Alexandru Gagniuc d128bf12b2 serial-dmm: Remove global sr_dev_driver *di alias
The global *di alias was used to keep track of the driver context.
It caused issues with trying to use several subdrivers at once, so
its use was obsoleted.

The correct context is preserved through different mechanisms, either
the *sdi pointer, or wrappers which pass the correct context.

The *di alias is no longer used, so remove it.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-13 23:16:34 +01:00
Alexandru Gagniuc 3098b3902d serial-dmm: Simplify wrapper layout
Wrappers for hw_init, hw_cleanup, clear_instances, and hw_scan are needed for
each subdriver due to the nature of serial-dmm. These wrappers are implemented
as macros, in order to reduce the number of lines of code.

For each of those functions, we have a separate wrapper list, then we connect
them together in a first-class driver using a DRV macro, and yet another list
(the DRV list).

Instead of declaring those wrappers in separate lists, include them in the DRV
macro. This approach reduces the number of macro lists from five to just one.

From the perspective of adding a new subdriver, this also greatly reduces the
number of places needed to hook in a new device.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-13 23:16:34 +01:00
Uwe Hermann fd9b2b865a serial-dmm: Add per-driver clear_instances() wrappers. 2012-12-13 01:54:13 +01:00
Uwe Hermann 0c23677d0b serial-dmm: Add per-driver hw_cleanup() wrappers. 2012-12-13 01:47:02 +01:00
Uwe Hermann ca4b130943 serial-dmm: Add per-driver hw_dev_list() wrappers. 2012-12-13 01:41:34 +01:00
Uwe Hermann ea4c6c2311 serial-dmm: Add per-driver hw_scan() wrappers. 2012-12-13 01:34:21 +01:00
Uwe Hermann dccfe01586 serial-dmm: Use a macro for receive_data() wrappers. 2012-12-13 01:34:21 +01:00
Uwe Hermann f1437c6814 serial-dmm: Use a macro for driver struct simplification. 2012-12-13 01:34:21 +01:00
Uwe Hermann 06b7a8af7e serial-dmm: Simplify code a bit.
Store/use the receive_data() function and a pointer to the driver struct
in the dmms[] array. Use a ".subdriver" entry in the driver struct.
Use a macro to simplify hw_init() wrappers.
2012-12-13 01:30:43 +01:00
Alexandru Gagniuc 5b389efcfe serial-dmm: Avoid duplicate symbol error
Declare dmm_info dmms as extern in protocol.h to prevent duplicate
symbol error from the linker.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-13 01:00:06 +01:00
Joel Holdsworth 378abfeac6 fx2lafw: Don't say "Device came back" when it didn't 2012-12-06 22:40:00 +01:00
Alexandru Gagniuc 26be4ebef3 serial-dmm: Fix segfault when no device is used
di was initialized as NULL. If no device covered by this driver
is used, di remains NULL. This causes a segmentation fault when
calling clear_instances().

Check for di being NULL.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-06 00:21:45 +01:00
Peter Stuge 63c07e48c6 backend.c: Return a sigrok error in sr_init() on libusb_init() errors 2012-12-05 01:34:15 +01:00
Peter Stuge 123d97b177 backend.c: Fix memory leak in sr_init() error path
Commit 785b9ff290 added libusb init into
sr_init() which can generate an error. In this case, the already
allocated struct sr_context would have leaked.
2012-12-05 01:34:15 +01:00
Peter Stuge 1740429d70 hardware: A few further USB error message fixups 2012-12-05 01:34:15 +01:00
Peter Stuge d4928d7102 hardware: Call libusb_error_name() in all USB-related error messages 2012-12-05 01:14:44 +01:00
Bert Vermeulen 851d5b2274 lascar-el-usb: add scanning functionality 2012-12-04 23:58:26 +01:00
Bert Vermeulen 402704445e add thermometer and hygrometer HWCAPs 2012-12-04 23:58:03 +01:00
Bert Vermeulen 7ae6a75826 usb: sr_usb_find() uses standardized connection string to find a USB device 2012-12-04 23:25:11 +01:00
Bert Vermeulen 5ea1e54ab5 add VID:PID for generic SILabs F32x USBXpress chips
Used in Lascar EL-USB series devices
2012-12-04 23:22:35 +01:00
Alexandru Gagniuc d458a0ac29 ezusb: Use DRIVER_LOG_DOMAIN for debug output
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-04 13:31:49 -06:00
Alexandru Gagniuc f428493435 tondaj-sl-814: Fix unused parameter warning
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-03 19:39:58 -06:00
Peter Stuge d4abb463a7 hardware: Make USB drivers use the libusb_context in struct sr_context 2012-12-03 12:07:40 +01:00
Peter Stuge 1ebe4b4e69 hw_init(): Save struct sr_context * parameter in struct drv_context 2012-12-03 12:07:40 +01:00
Peter Stuge 34f06b903e Add a struct sr_context * parameter to hw_init() 2012-12-03 12:07:40 +01:00
Peter Stuge 44fc870c9c Add a struct sr_context * parameter to sr_driver_init()
Since the public API is changed, this commit also bumps the libtool
version component SR_LIB_VERSION_CURRENT in configure.ac.
2012-12-03 12:07:40 +01:00
Peter Stuge 73496bb571 alsa: Remove unused and unprovided hw_init() parameter `devname' 2012-12-03 12:07:40 +01:00
Bert Vermeulen 46697e38b2 lascar-el-usb: Initial driver skeleton. 2012-12-03 03:53:44 +01:00
Uwe Hermann 162b735218 Remove some radioshack-dmm leftovers. 2012-12-02 22:22:07 +01:00
Alexandru Gagniuc ea088bb693 serial.c: Be more verbose about failing to parse parameter string
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-02 22:22:07 +01:00
Alexandru Gagniuc 21829e6708 radioshack-dmm: Integrate into serial-dmm
Use the infrastructure of serial-dmm to handle the RadioShack 22-812,
and completely remove radioshack-dmm.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-02 22:22:07 +01:00
Alexandru Gagniuc 05f134abc2 radioshack-dmm: Separate protocol parser from driver
Move the parsing part of radioshack-dmm into a separate protocol
parser, following the model from hardware/common/dmm.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-02 22:18:22 +01:00
Alexandru Gagniuc ae95ffebfa radioshack-dmm: Fix opening of serial port.
During scan the serial port is opened with SERIAL_RDONLY | SERIAL_NONBLOCK,
which works fine, but when acquisition starts, it is opened only with
SERIAL_RDONLY. On Linux, if cdc_acm can make a claim to the USB to serial
converter, opening the port will fail.

Open port with SERIAL_RDONLY | SERIAL_NONBLOCK.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-02 21:48:17 +01:00
Alexandru Gagniuc d5ce233fe1 serial-dmm: Add RadioShack 22-168 support.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-02 17:38:05 +01:00
Uwe Hermann eebb606762 demo: Add missing dev_clear() API call. 2012-12-02 17:21:13 +01:00
Uwe Hermann 55a6daf59f sr_init(): Add driver sanity checks.
After sr_init() has successfully run, we can be sure that all drivers
define all the API calls, so we don't have to do these checks later
in the individual API functions / wrappers.

If there are one or more drivers with missing API functions (or driver
name / longname, and so on), sr_init() will fail. This helps catch this
kind of developer error early on.
2012-12-02 17:14:45 +01:00
Uwe Hermann 3a18cf625e serial-dmm: Drop accidentally committed file. 2012-12-02 16:11:42 +01:00
Uwe Hermann 7f64e88fa9 Reduce glib minimum version to 2.28.0 again.
We no longer use g_thread_try_new() which is only available since 2.32.0.
2012-12-02 16:09:31 +01:00
Alexandru Gagniuc 3b20367381 demo: Do not use a separate thread for generating data
We already have an event-based mechanism in place. Using a thread just
adds unneeded complexity, especially for a driver designed not for
performance, but for providing a testbed to frontends.
Generate the data in the event handler, not in a separate thread.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-02 16:08:03 +01:00
Uwe Hermann d4bd66a0c7 serial-dmm: Add PCE PCE-DM32 support. 2012-12-02 14:28:29 +01:00
Uwe Hermann a376ffea49 serial-dmm: Add PeakTech 4370 support. 2012-12-02 14:22:51 +01:00
Uwe Hermann a53da08254 serial-dmm: Add Metex M-3640D support. 2012-12-02 14:22:51 +01:00
Uwe Hermann 9871215c83 metex14: Add dB mode and hFE mode support.
This is found e.g. on the Metex M-3640D DMM.
2012-12-02 14:22:51 +01:00
Uwe Hermann 6dca2f16ee serial-dmm: Add V&A VA18B support. 2012-12-02 14:22:51 +01:00
Uwe Hermann 5887c9cc1a serial-dmm: Add MASTECH MAS345 support. 2012-12-02 14:22:51 +01:00