Commit Graph

860 Commits

Author SHA1 Message Date
Uwe Hermann f4abaa9f6b asix-sigma: Fix two compiler warnings.
asix-sigma.c:648:9: warning: 'ret' may be used uninitialized in this
function [-Wmaybe-uninitialized]

asix-sigma.c:1337:20: warning: 'triggerselect' may be used uninitialized
in this function [-Wmaybe-uninitialized]
2012-12-31 21:21:39 +01:00
Uwe Hermann 6375e1c3eb victor-dmm: Fix compiler warning.
protocol.c:106:10: warning: 'factor' may be used uninitialized in this
function [-Wmaybe-uninitialized]
2012-12-31 21:03:45 +01:00
Uwe Hermann f057272cac nexus-osciprime: Fix compiler warning.
protocol.c:26:46: warning: unused parameter 'fd' [-Wunused-parameter]
2012-12-31 21:02:14 +01:00
Uwe Hermann 811155da46 uni-t-dmm: Fix compiler warning.
protocol.c:84:5: warning: 'ret' may be used uninitialized in this
function [-Wmaybe-uninitialized]
2012-12-31 21:01:53 +01:00
Uwe Hermann 6e9d545cf4 rs9lcd: Fix compiler warning.
rs9lcd.c:289:19: warning: 'rawval' may be used uninitialized in this
function [-Wmaybe-uninitialized]
2012-12-31 20:58:14 +01:00
Bert Vermeulen 9116262931 add USBTMC device search helper 2012-12-30 01:44:58 +01:00
Bert Vermeulen 80bc663296 tondaj-sl-814: remove unneeded debugging 2012-12-29 11:19:19 +01:00
Uwe Hermann 2239728c43 ols: Add missing 'extern'. 2012-12-28 17:13:20 +01:00
Uwe Hermann 1476661970 serial-dmm: Rename VOLTCRAFT_VC820 to VOLTCRAFT_VC820_SER.
This matches the _ser suffix of the other functions/variables for this
device ("ser" denotes that it is used with the serial UNI-T UT-D02 cable
as opposed the USB/HID based cables which are handled by the uni-t-dmm driver).

But more importantly, the _SER suffix for the enum value will prevent
name clashes later, when the uni-t-dmm driver gets a VOLTCRAFT_VC820 enum.

Do the same for VOLTCRAFT_VC840.
2012-12-26 02:11:00 +01:00
Uwe Hermann 35e199da50 Fix limit_samples check in various drivers.
Check whether a sample limit was actually set (> 0) before checking if
that sample limit is reached. This also fixes continuous acquisition mode
for drivers which have that.
2012-12-26 02:11:00 +01:00
Uwe Hermann 7869340103 Shorten probe_names[] arrays everywhere.
Also, NULL-terminate all of them.
2012-12-26 00:16:07 +01:00
Bert Vermeulen df36acb36a nexus-osciprime: suppress warnings 2012-12-26 00:02:58 +01:00
Alexandru Gagniuc f9b9bd632f serial-dmm: Handle time-limited acquisition
Implement SR_HWCAP_LIMIT_MSEC capability, to allow acquisition to automatically
stop after a specified amount of time.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-25 23:55:42 +01:00
Alexandru Gagniuc 47eda193b2 rs9lcd: Fix segfault with unusual modes.
Some unusual modes required re-parsing the value. Instead of assigning the
re-parsed value to *floatval, it was reassigned directly to *analog->data;
however, analog->data is not initialized at this point, causing a segfault.
This situation was created when moving the radioshack-dmm code to serial-dmm,
with the segfault not being observed at that time.

Do not write directly to analog->data, but instead use the intermediate
variable rawval.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-25 23:43:30 +01:00
Alexandru Gagniuc 0853d5e627 rs9lcd: Convenience fixes
Convert bit masks from hardcoded hex values to bit shifts. For example 0x80
becomes (1 << 7). This also fixes a typo error in the definition of INFO_DIODE.

Add comments explaining that some case values in sr_rs9lcd_parse() are meant to
fall through without a 'break;', and explain some of the unusual modes.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-25 23:43:02 +01:00
Bert Vermeulen 523dfc2497 nexus-osciprime: basic scanning functionality
Unfortunately the device doesn't have an EEPROM on board at all, and so
initially enumerates with the default Cypress FX2 VID:PID (04b4:8613).
Since we already support using plain FX2* as basic logic analyzers using
the fx2lafw firmware, we cannot support that same VID:PID for the
OsciPrime. Therefore a USB conn is required for the initial scan.

However, once the firmware is uploaded the device re-enumerates as
04b4:1004, which we do detect for scanning automatically.

Thus, the OsciPrime driver requires one scan with conn parameter to get
the firmware uploaded, but it will then keep working until powered off.
2012-12-25 19:09:12 +01:00
Bert Vermeulen 35a078bce5 nexus-osciprime: Initial driver skeleton. 2012-12-24 20:55:23 +01:00
Bert Vermeulen 2f1e5c7cb7 fluke-dmm: Properly handle continuous mode
Same bug+fix as commit d55c89f523
2012-12-24 20:27:45 +01:00
Uwe Hermann dc890b8f9f asix-sigma: Quickfix for an ASIX SIGMA issue.
It's not entirely clear whether this is the right fix, but we're merging
it for now, pending later review.

See also: http://sigrok.org/bugzilla/show_bug.cgi?id=26
2012-12-24 16:57:55 +01:00
Joel Holdsworth b36e715395 fx2lafw: Tidied probe_names 2012-12-24 13:53:58 +01:00
Uwe Hermann 0aba65da9f ols: Split into api.c and protocol.[ch].
Also, drop various no longer needed #include files.
2012-12-24 13:44:52 +01:00
Uwe Hermann a567547e20 ols: Use logging helper macro. 2012-12-24 13:21:12 +01:00
Bert Vermeulen 11fb7110f4 fluke-dmm: 190 series scopemeter support
199B only for now.
2012-12-24 11:22:01 +01:00
Bert Vermeulen 4cea0ff7fe fluke-dmm: parser cleanup 2012-12-24 11:22:01 +01:00
Bert Vermeulen 9fa0968027 fluke-dmm: adapt scanner to accomodate 190 series scopemeters 2012-12-24 11:22:01 +01:00
Bert Vermeulen d4b11de09a fluke-dmm: make poll timeout configurable
Defaulted to 1s before, but a simple "QM" command on a 199B in scope
mode takes 1.7s to come through.
2012-12-24 11:22:01 +01:00
Bert Vermeulen d92faf6cac serial: more debug cleanup 2012-12-24 11:22:01 +01:00
Bert Vermeulen 49aaa0bc68 serial: get rid of overly verbose spew
It just made spew-level logging unusable; the way sigrok async comms work
guarantees most of it was a false error.
2012-12-24 11:22:01 +01:00
Alexandru Gagniuc 9cd9f6b71c alsa: Split into api.c and protocol.c
This is the driver model agreed upon for all drivers.

As a result of the split, a devc->num_probes field had to be added in order to
reduce the interdependence between api.c and protocol.c .

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-23 17:25:37 +01:00
Alexandru Gagniuc d55c89f523 serial-dmm: Properly handle continuous mode
serial-dmm does not check if a sample limit is actually in place before deciding
to stop acquisition. Since the sample limit is set at 0 by default, operating
in continuous mode will cause acquisition to stop before even sending the first
sample.

Check to make sure we actually are in a sample-limited mode before stopping for
this reason.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-23 16:55:10 +01:00
Uwe Hermann 0254651dcb alsa: Update to latest APIs/conventions.
The alsa driver was out of date wrt APIs and libsigrok conventions in
general, and wasn't compiling.

This fixes the compile and updates it to _basically_ work with the current
state of analog support in libsigrok.

This is not finished/full support for ALSA analog sampling yet, though,
various TODOs remain that will be addressed later.
2012-12-20 14:42:15 +01:00
Uwe Hermann 16d6e56d12 hardware/agilent-dmm/Makefile.am: Fix typo. 2012-12-18 02:25:17 +01:00
Alexandru Gagniuc 4f9bf9a202 chronovu-la8: Fix memory leak in hw_scan
Hardware scanning creates an ftdi_context before attempting to locate devices
based on PID/VID. If no devices are detected, execution jumps to cleanup. The
context is freed with free(), instead of ftdi_free().

We cannot assume that the libftdi context is stored in a contiguous memory
region, and thus cannot use a simple free. Case in point, this situation is
identified by valgrind as a "definitely lost" memory leak.

Use ftdi_free() instead of a simple free() in hw_scan(). Valgrind no longer
complains about a memory leak in this area.

clear_instances() does not need any modification, as it correctly uses
ftdi_free().

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-18 02:08:36 +01:00
Uwe Hermann c0bf69c29b fx2lafw: Fix int64_t printing. 2012-12-18 01:30:34 +01:00
Uwe Hermann b99457f09c fx2lafw: Various cosmetics, typo fixes, etc. 2012-12-18 01:26:58 +01:00
Uwe Hermann a873c5940c Consistently use 'di' as variable name.
Use 'di' consistently in all drivers as the name for a local, static
pointer to the respective driver's 'struct sr_dev_driver'.
2012-12-18 00:52:39 +01:00
Alexandru Gagniuc 443a14d81f fx2lafw: Print device failed to renumerate error
commit 378abfeac6 tried to solve a bug where
the fx2lafw driver would print "Device came back" even if a timeout had occured.

It solved that issue, but inadvertently introduced a new bug:
"Device came back" would be printed even if no firmware upload was performed.
This is counterintuitive, as the device is only reset when a firmware upload is
performed.

There are three cases:
i)   Firmware upload was successful
ii)  Firmware upload failed
iii) Firmware upload was NOT needed

Each case warrants a separate message from the driver. Print the
following messages depending on the outcome:

i)   "Device came back"
ii)  "Device failed to renumerate"
iii) "Firmware upload was not needed."

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-18 00:48:56 +01:00
Alexandru Gagniuc f427daefb0 fx2lafw: Use DRIVER_LOG_DOMAIN for log messages
Use the new DRIVER_LOG_DOMAIN mechanism, where explicitly writing
the driver name in the message string is no longer required.

Thus:

- sr_err("fx2lafw: Something bad happened.");

becomes:

+ sr_err("Something bad happened.");

In either case, the log output is the same.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-17 12:26:10 -06:00
Uwe Hermann 006dbe5587 serial_stream_detect(): Drop unneeded sr_spew(). 2012-12-17 14:21:12 +01:00
Uwe Hermann 54d1122187 serial-dmm: Add Voltcraft VC-840 (UT-D02) support.
This works with the UNI-T UT-D02 (RS232) cable. For the USB/HID
based cable (UNI-T UT-D04), the uni-t-dmm driver must be used.

Note: This is untested, but should work just fine for all settings, with
the possible exception of temperature (testers needed!)
2012-12-17 14:21:12 +01:00
Uwe Hermann 40830061eb serial-dmm: Add Voltcraft VC-820 (UT-D02) support.
This works with the UNI-T UT-D02 (RS232) cable. For the USB/HID
based cable (UNI-T UT-D04), the uni-t-dmm driver must be used.
2012-12-17 14:21:12 +01:00
Uwe Hermann 16b7b79005 serial-dmm: Eliminate unneeded "subdriver" field.
Just use the 'int dmm' + wrapper method that is used for all other
functions which need this information. There is no real need to
special-case the hw_dev_acquisition_start() API call here.
2012-12-17 14:21:12 +01:00
Uwe Hermann 22f5419235 serial-dmm: Cosmetics, documentation fixes. 2012-12-17 14:21:12 +01:00
Bert Vermeulen 6aed917b13 lascar-el-usb: fix sample limit parameter 2012-12-16 23:06:15 +01:00
Bert Vermeulen 6787f4049a lascar-el-usb: support for EL-USB-2* 2012-12-16 18:48:20 +01:00
Bert Vermeulen 7f00750ca4 lascar-el-usb: properly submit CO concentration as a PPM value 2012-12-15 22:49:40 +01:00
Bert Vermeulen b0c95747e1 lascar-el-usb: add config saver 2012-12-15 22:34:40 +01:00
Bert Vermeulen b6506d5e03 lascar-el-usb: EL-USB-CO300 support
Works the same way as the EL-USB-CO, but with the more sensitive sensor,
so should work out of the box.
2012-12-15 11:15:30 +01:00
Bert Vermeulen 4f3bd685e6 add MQ/units for carbon monoxide concentration 2012-12-15 10:50:22 +01:00
Bert Vermeulen 6aa1eb4ea3 lascar-el-usb: generic EL-USB support + EL-USB-CO support 2012-12-15 04:07:25 +01:00
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 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 7ae6a75826 usb: sr_usb_find() uses standardized connection string to find a USB device 2012-12-04 23:25:11 +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 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 3a18cf625e serial-dmm: Drop accidentally committed file. 2012-12-02 16:11:42 +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
Uwe Hermann f0ac4929d3 serial-dmm: Add PeakTech 3410 support. 2012-12-02 14:22:51 +01:00
Uwe Hermann ce3777ada9 serial-dmm: Add Metex ME-31 support. 2012-12-02 14:22:46 +01:00
Uwe Hermann f086b83011 serial-dmm: Add Digitek DT4000ZC support. 2012-12-02 14:21:19 +01:00
Uwe Hermann e90cf076aa metex14: Add sr_metex14_packet_request(). 2012-12-02 14:21:18 +01:00
Uwe Hermann 8f46911e42 metex14: Fix 'is_ol' handling.
Thanks to Bert Vermeulen for the reminder.
2012-12-02 14:21:18 +01:00
Alexandru Gagniuc 2477fb9569 metex14: Parse microamp (uA) values.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-02 14:21:18 +01:00
Alexandru Gagniuc 3ebc9b59a2 metex14: Fix parsing of measurement flags.
strcmp(buf + 9, "  mA") does not work because buf is CR-terminated,
while "  mA" is NUL-terminated.

Drop ambiguities arising from the termination of the strings, and
only compare the characters we care about, using strncmp().

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-02 14:21:18 +01:00
Alexandru Gagniuc e82d7dbc20 metex14: Print contents of received packet.
The packet is an ASCII string. We can simply print the raw packet data.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-02 14:21:18 +01:00
Alexandru Gagniuc 76b55dfa8a metex14: Fix parsing of spaces.
When the parser found a space, it treated it as an invalid digit
and discarded the whole packet. This behavior was incorrect on
2000 count devices, where the first digit can be sent as a space
rather than a '0'.

Convert spaces to '0' and parse them as usual.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-02 14:21:18 +01:00
Uwe Hermann 21a7f2692e Rename tekpower-dmm to serial-dmm.
This is now a generic driver for multiple DMM "subdrivers" that use simple
serial port protocols.
2012-12-02 14:21:18 +01:00
Uwe Hermann 729b01f988 tekpower-dmm: Generalize & first-class TP4000ZC driver.
Prepare the tekpower-dmm driver to be able to support various simple
serial port based DMMs.

Also, make a 'tekpower-tp4000zc' "first-class" driver which is currently
the only user of this generic driver.
2012-12-02 14:21:18 +01:00
Uwe Hermann 1fbab46626 metex14: Pass 'info' as a void pointer.
This is done so that the function prototype of all sr_*_parse() DMM
functions is the same, which will be needed later.
2012-12-02 14:21:17 +01:00
Uwe Hermann 93357bc3ce fs9721: Pass 'info' as a void pointer.
This is done so that the function prototype of all sr_*_parse() DMM
functions is the same, which will be needed later.
2012-12-02 14:21:17 +01:00
Uwe Hermann d84fc9cb3b tekpower-dmm: Drop unneeded g_try_malloc(). 2012-12-02 14:21:17 +01:00
Uwe Hermann 5ddb0cc7d4 serial: Don't hardcode parity and stop bits on Windows. 2012-12-02 14:10:27 +01:00
Uwe Hermann 5ae35c29a7 serial: Full baudrate support on Windows/MinGW. 2012-12-02 13:56:13 +01:00
Uwe Hermann 39e5d79826 serial: RTS/DTR support on Windows/MinGW. 2012-12-02 13:41:49 +01:00
Uwe Hermann a54dd31e38 serial: Use OS-independent flags for serial port opening.
Add SERIAL_RDWR, SERIAL_RDONLY, and SERIAL_NONBLOCK (for now), which are
mapped to the respective OS-specific mechanism in serial_open().
2012-12-02 12:45:54 +01:00
Uwe Hermann 0f84cda05d serial: Fix Windows build. 2012-12-01 22:34:53 +01:00
Alexandru Gagniuc c216d62307 demo: Properly stop acquisition after reaching our sample quota
The demo driver was using sr_session_source_add_channel() to add
a poll source, but was relying on sr_session_run_poll() to call
sr_session_source_remove(). This, coupled with the design of the
driver caused errors once the samples were collected.

The error stream was most likely related to failing to properly close
one of the channels.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-01 22:00:16 +01:00
Alexandru Gagniuc 49145a63c7 demo: Be more verbose about starting/stopping acquisition
This is the first step in fixing the demo driver: figuring out what is
being called and what is not _and_ have it show up in the logs.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-01 22:00:15 +01:00
Bert Vermeulen 71caaad46b serial: allow for extra rts and dtr options in conn string
Options in addition to the usual "9600/8n1" syntax start with a
slash, and take the form of key=value, where different options are
also separated by slashes. For example:

	"9600/8n1/rts=0/dtr=1"

This sets RTS low and DTR high.
2012-11-27 00:55:08 +01:00
Uwe Hermann 700dcd5caa serial: Initial code for setting DTR/RTS.
Currently disabled until option parsing is in place.
2012-11-26 17:01:15 +01:00
Alexandru Gagniuc 9047358761 radioshack-dmm: Be more verbose with packet checks
Add sr_spew() messages to state why the packet was found to be invalid.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-11-21 19:33:55 -06:00
Alexandru Gagniuc 2ecc5d432f radioshack-dmm: Check for valid mode before calculating checksum
The packet mode byte is akin to a signature. If that is invalid, there's
no point in calculating the checksum, so check the mode first.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-11-21 19:30:26 -06:00
Alexandru Gagniuc 54be7c005e radioshack-dmm: Improve serial detection
For device detection, use serial_stream_detect() instead of
serial_readline() + custom logic.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-11-21 19:19:58 -06:00
Alexandru Gagniuc 551c3d8ce3 serial.c: Sanitize serial_stream_detect
Print the timeout in miliseconds, not microseconds.
Only calculate elapsed time once oer loop.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-11-21 19:18:21 -06:00
Uwe Hermann ac913e5c35 Add Metex 14-byte ASCII protocol parser. 2012-11-17 22:27:54 +01:00
Bert Vermeulen 90165efe55 ols: if no serial port specified, this driver is not used. 2012-11-16 15:26:47 +01:00
Uwe Hermann 766456be1c Move serial_stream_detect() to serial.c. 2012-11-14 18:40:07 +01:00
Uwe Hermann 4da1a800df serial: Compile-fix for Windows/MinGW. 2012-11-14 18:20:13 +01:00
Uwe Hermann 6bef68a7e1 tekpower-dmm: Cosmetics. 2012-11-14 18:13:56 +01:00
Alexandru Gagniuc 2546b05c80 tekpower-dmm: Improve serial detection.
Serial detection was using serial_readline, which stripped carriage
return from the packets. This made for a very unreliable detection
mechanism.

Switch to a timeout-based detection mechanism that parses the data
as it comes in. This also allows us to stop parsing once we found
our first valid packet.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-11-14 18:13:56 +01:00
Uwe Hermann bda8fc98b1 Drop obsolete genericdmm driver. 2012-11-14 15:26:11 +01:00
Bert Vermeulen d35afa87c9 tekpower-dmm: use new serial API 2012-11-12 12:50:42 +01:00
Bert Vermeulen 401476daaf radioshack-dmm: use new serial API 2012-11-12 12:41:10 +01:00
Bert Vermeulen 19ee7dff78 tondaj-sl-814: use new serial API 2012-11-12 03:00:32 +01:00
Bert Vermeulen f306ca61f6 colead-slm: use new serial API 2012-11-12 02:54:10 +01:00
Bert Vermeulen 109a3ba413 agilent-dmm: use new serial API 2012-11-12 02:25:37 +01:00
Bert Vermeulen 58d03f034f fluke-dmm: use new serial API 2012-11-12 02:25:17 +01:00
Bert Vermeulen 530f201eb8 ols: use new serial API 2012-11-12 02:24:47 +01:00
Bert Vermeulen 299bdb249e serial: revamp internal API
The only thing to get passed around now is the struct sr_serial_dev_inst
pointer. This should make things more portable as well.
2012-11-12 00:27:17 +01:00
Uwe Hermann de6e0eca95 sigma/la8/demo: s/SR_PROBE_ANALOG/SR_PROBE_LOGIC/. 2012-11-11 19:40:14 +01:00
Uwe Hermann 472bbb464b alsa: Use message logging helpers. 2012-11-11 18:14:17 +01:00
Uwe Hermann 64d33dc28e All drivers: Drop unneeded comments. 2012-11-11 18:09:11 +01:00
Uwe Hermann fa7730623a victor-dmm: Cosmetics. 2012-11-11 18:09:11 +01:00
Bert Vermeulen 5df7b20156 serial: avoid Cyrillic conversion specifiers 2012-11-11 03:27:51 +01:00
Bert Vermeulen fe1c50fba6 ols: fix device discovery 2012-11-11 03:12:10 +01:00
Alexandru Gagniuc a99e0d2a0c ols: Do not randomly probe serial ports
ols driver used to probe a series of available serial ports obtained
by regexp matching of common serial port names.
There are a number of problems with this approach:
1. It will probe all serial devices, including devices that do not
like to be probed, potentially causing them to act up.
2. It will try to probe serial ports which may already be opened in
other applications for other purposes.
3. It assumes the naming of the serial ports is set in stone, and
creates an unnecessary OS-specific list.
4. It produces unnecessary debug output even when an OLS device is
not connected.
5. etc...

Do not implicitly probe serial ports. Only probe the port specified
by the frontend, if any; otherwise, just quit.
Also get rid of all functionality in serial.c which was designed
specifically for random probing.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-11-11 03:12:10 +01:00
Uwe Hermann 56eb9f95ba link-mso19: Use message logging helpers. 2012-11-10 19:42:37 +01:00
Uwe Hermann 92bcedf6e8 demo: Use message logging helpers. 2012-11-10 19:42:37 +01:00
Uwe Hermann e98b7f1be0 hantek-dso: Use message logging helpers. 2012-11-10 19:42:37 +01:00
Uwe Hermann 47f4f073e0 asix-sigma: Use message logging helpers. 2012-11-10 19:42:37 +01:00
Uwe Hermann 936e27f197 radioshack-dmm: Use new file naming conventions. 2012-11-10 19:42:37 +01:00
Uwe Hermann 4e172b8f8d radioshack-dmm: Move some stuff out of .h file.
Most of the enums and #defines are not needed in multiple files, just
put them in the respective .c file where they're used.
2012-11-10 19:42:37 +01:00
Uwe Hermann ba6383f855 radioshack-dmm: Cosmetics, coding-style, cleanups.
Also, drop some uneeded code and simplify some parts.
2012-11-10 19:41:21 +01:00
Uwe Hermann 302c4b5ab5 serial: Deduplicate log messages a bit. 2012-11-10 01:45:51 +01:00