Commit Graph

1082 Commits

Author SHA1 Message Date
Bert Vermeulen 510b3e692a brymen-dmm: Adjust to GVariant-based sr_config_* functions 2013-04-11 18:32:07 +02:00
Bert Vermeulen 2c9c0df86e asix-sigma: Adjust to GVariant-based sr_config_* functions 2013-04-11 18:32:07 +02:00
Bert Vermeulen aa0dbd683c alsa: Adjust to GVariant-based sr_config_* functions 2013-04-11 18:32:07 +02:00
Bert Vermeulen 3316e149d0 zeroplus-logic-cube: fix samplerate setting 2013-04-11 18:32:07 +02:00
Bert Vermeulen 8386096f01 zeroplus-logic-cube: Adjust to GVariant-based sr_config_* functions 2013-04-11 18:32:07 +02:00
Bert Vermeulen c8733a2bbb nexus-osciprime: Adjust to GVariant-based sr_config_* functions 2013-04-11 18:32:07 +02:00
Bert Vermeulen e44ac12a29 agilent-dmm: Adjust to GVariant-based sr_config_* functions 2013-04-11 18:32:07 +02:00
Bert Vermeulen a59b4eef55 victor-dmm: Adjust to GVariant-based sr_config_* functions 2013-04-11 18:32:07 +02:00
Bert Vermeulen 70424328c1 fluke-dmm: Adjust to GVariant-based sr_config_* functions 2013-04-11 18:32:07 +02:00
Bert Vermeulen dccda194db colead-slm: Adjust to GVariant-based sr_config_* functions 2013-04-11 18:32:07 +02:00
Bert Vermeulen 7faf69da10 lascar-el-usb: Adjust to GVariant-based sr_config_* functions 2013-04-11 18:32:07 +02:00
Bert Vermeulen d40073113b hantek-dso: Small debug fix 2013-04-11 18:32:07 +02:00
Bert Vermeulen 86bb3f4a86 hantek-dso: deprecate struct sr_rational 2013-04-11 18:32:07 +02:00
Bert Vermeulen d00088ca6d demo: Adjust to GVariant-based sr_config_* functions 2013-04-11 18:32:06 +02:00
Bert Vermeulen f627afd65b hantek-dso: Adjust to GVariant-based sr_config_* functions 2013-04-11 18:32:06 +02:00
Bert Vermeulen aeea057220 ols: allow for disabling of RLE as well 2013-04-11 18:32:06 +02:00
Bert Vermeulen e46aa4f611 ols: Adjust to GVariant-based sr_config_* functions 2013-04-11 18:32:06 +02:00
Bert Vermeulen d6836bf129 fx2lafw: Adjust to GVariant-based sr_config_* functions 2013-04-11 18:32:06 +02:00
Bert Vermeulen 13d8e03c4f Bump copyright year 2013-04-11 18:32:06 +02:00
Uwe Hermann 3fd1d0ee1c configure.ac: Improve USB/EZUSB/serial checks.
- If libusb-1.0 is not found, do not compile in ezusb.c and usb.c since
   they require libusb.h. The respective hardware drivers that use
   libusb-1.0, and usb.c and/or ezusb.c will be excluded from the build
   elsewhere in configure.ac. Rename NEED_EZUSB to NEED_USB.

 - Drop the NEED_SERIAL check and always compile in serial.c. This is a
   very small chunk of code, it does not depend on any external
   libraries that might be missing, and it compiles on all architectures.
   Thus there's no need to conditionally include or exclude it.
2013-04-09 17:49:13 +02:00
Bert Vermeulen 3f98bf7017 Fix kernel driver attached check
The check is really only broken on darwin, but useful on all other
platforms, even if only Linux can actually detach a driver.
2013-04-07 14:14:16 +02:00
Bert Vermeulen 8c971b6e5c hantek-dso: cosmetics 2013-04-07 14:01:03 +02:00
Bert Vermeulen 7b78b2f78f hantek-dso: use per-device firmware filenames 2013-04-02 14:20:29 +02:00
Uwe Hermann 3ebce226a2 s/sr_config_make/sr_config_new/.
This matches the naming of other/similar functions better.
2013-03-23 14:16:00 +01:00
Uwe Hermann 333bf022e3 rigol-ds1xx2: Use ARRAY_SIZE. 2013-03-23 14:14:58 +01:00
Alexandru Gagniuc 3864648bb6 serial-dmm: Add support for RadioShack 22-805
Protocol-wise, this is identical to the 22-168, except that it communicates at
600 baud instead of 1200 baud.
2013-03-20 20:36:56 -05:00
Uwe Hermann cc840ab618 serial.c: FreeBSD and OpenBSD don't have OFILL either. 2013-03-17 15:07:50 +01:00
Bert Vermeulen 8e77bc20b9 lascar-el-usb: push samplerate before data log 2013-03-16 21:52:02 +01:00
Bert Vermeulen 361d15110c lascar-el-usb: support for SR_CONF_DATALOG 2013-03-11 16:37:02 +01:00
Bert Vermeulen 9857276261 ols: use ptr to int dereference for SR_T_BOOL
This mad ptr to int casting has to go.
2013-03-11 16:37:02 +01:00
Bert Vermeulen 2474d87e8c demo: sync get/set options 2013-03-03 21:21:08 +01:00
lelazary 365f04d61f mso-19: Initial analog probe support (unfinished).
- Added the analog probe (unfinished).

 - Reset trigger to state to 0 before capture, just incase the scope is in
   the middle of a capture.
2013-03-03 17:59:06 +01:00
lelazary 5952553f56 mso-19: Fixed warning. 2013-03-03 17:58:46 +01:00
Uwe Hermann ff17e6ba50 mic985xx: Add missing memset(). 2013-02-11 18:23:17 +01:00
Uwe Hermann 6f3e5335ad mic-985xx: Add support for the MIC 98581.
This device only supports temperature measurements, no humidity.
2013-02-11 16:53:28 +01:00
Bert Vermeulen be6db330f8 hantek-dso: minor fixes 2013-02-10 17:06:56 +01:00
Bert Vermeulen 8421ffa44d asix-sigma: don't try to free static storage 2013-02-10 17:06:56 +01:00
Uwe Hermann cd2f0fe22c Add/use std_hw_dev_acquisition_stop_serial(). 2013-02-08 23:32:45 +01:00
Uwe Hermann 17548571cc zeroplus: Only report supported samplerates.
The currently supported model LAP-C(16032) doesn't support the
samplerates 150MHz and 200MHz which some of the other models have.

Thus, do not report these samplerates to the frontends. E.g. sigrok-cli
should not show them via --show and GUIs should not list them in their
"Samplerates" drop-down.
2013-02-08 23:19:50 +01:00
Uwe Hermann e495a676eb zeroplus: Cosmetics, small fixes, drop unneeded stuff. 2013-02-08 23:19:50 +01:00
Uwe Hermann 58c5f2ed17 zeroplus: Split into api.c and protocol.c. 2013-02-08 21:53:50 +01:00
Uwe Hermann 3e9b7f9c77 Rename session_dev_id to cb_data everywhere.
We use 'cb_data' in all drivers these days, make the few remaining ones
that use 'session_dev_id' consistent.
2013-02-07 11:26:02 +01:00
Uwe Hermann 6fab7b8f53 Driver struct cleanups.
- Explicitly list .config_get in all drivers for consistency, and set it
   to NULL if unused (whether or not a driver implements it is optional).

 - List all 'struct sr_dev_driver' entries in the same order in all drivers.

 - Move the check whether .config_set/.config_list exist (i.e., are non-NULL)
   into sanity_check_all_drivers().
2013-02-07 10:58:35 +01:00
Uwe Hermann 4afdfd4628 Add and use std_session_send_df_header().
This is a small helper function which sends the SR_DF_HEADER packet that
drivers usually emit in their hw_dev_acquisition_start() API callback.
It simplifies and shortens the hw_dev_acquisition_start() functions
quite a bit.

It also simplifies the input modules which send an SR_DF_HEADER packet, too.

This patch also automatically removes some unneeded malloc/free in some
drivers for the 'packet' and 'header' structs used for SR_DF_HEADER.
2013-02-07 10:46:28 +01:00
Uwe Hermann 961009b0c4 hw_dev_close(): Move common checks to wrapper.
Check the relevant arguments for != NULL before calling the actual
driver-specific function, so that the driver can safely assume those
arguments are non-NULL. This removes the need to duplicate these
checks in every driver.
2013-02-05 18:46:33 +01:00
Uwe Hermann 0e94d524c1 Shorten/simplify hw_dev_list() implementations. 2013-02-05 18:27:05 +01:00
Uwe Hermann 7c8a9e1e0f serial-dmm: Drop unneeded g_try_malloc0(). 2013-02-02 12:34:25 +01:00
Uwe Hermann c5d6f5cc1c brymen-dmm: Cosmetics, coding-style, consistency.
Also, name the driver "brymen-bm857" in preparation to doing "subdrivers"
for other Brymen models later (similar to serial-dmm).
2013-02-02 12:07:45 +01:00
Uwe Hermann 943e94f567 brymen-dmm: Use std_hw_init(). 2013-02-02 11:19:27 +01:00
Alexandru Gagniuc 601fb67cc4 brymen-dmm: Add support for Brymen BM857
This patch might also work for a number of other Brymen models
-- 859(a), 867, 869---
including their respective rebadges from Greenlee, Extech, and Amprobe.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-02-02 11:19:27 +01:00
Alexandru Gagniuc 20cbc7854d brymen-dmm: Initial driver skeleton. 2013-02-02 11:19:27 +01:00
Uwe Hermann 0cd8e23140 Initial driver implementation for MIC 98583.
This is a USB/serial (Prolific) based temperature and humidity logger.
2013-02-02 11:13:45 +01:00
Uwe Hermann 7ec5b54955 mic-985xx: Initial driver skeleton. 2013-02-01 23:52:57 +01:00
Uwe Hermann 6d1161142d zeroplus: Use message logging helpers. 2013-02-01 00:24:40 +01:00
Uwe Hermann d3b38ad389 Drivers: Explicitly list sr_samplerates fields.
This makes it a bit easier to understand which value means what, just
from looking at the driver code.
2013-01-29 12:56:02 +01:00
Uwe Hermann 063e7aef6d Factor out common hw_init() driver code.
Most drivers do pretty much the same things in their hw_init()
right now, so factor out that code to std_hw_init() in std.c.
2013-01-29 12:56:02 +01:00
Uwe Hermann 4b97c74e0b sr_driver_scan(): Improve checks.
Check the relevant arguments for != NULL before calling the actual
driver-specific function, so that the driver can safely assume those
arguments are non-NULL. This removes the need to duplicate these
checks in every driver.

Also, do some minor whitespace and consistency improvements.
2013-01-29 12:56:02 +01:00
Uwe Hermann c0eea11c45 sr_driver_init(): Improve checks.
Check the relevant arguments for != NULL before calling the actual
driver-specific function, so that the driver can safely assume those
arguments are non-NULL. This removes the need to duplicate these
checks in every driver.

Also, change one SR_ERR to the more correct SR_ERR_MALLOC, and assign
sr_ctx in the rigol-ds1xx2's hw_init() function, like all the other
drivers do.
2013-01-29 12:56:02 +01:00
Uwe Hermann cbc6f3b253 hantek-dso: Use message logging helpers. 2013-01-29 12:56:02 +01:00
Uwe Hermann 7d4abe5a77 serial.c: NetBSD doesn't have OFILL. 2013-01-27 01:23:01 +01:00
Bert Vermeulen 6a4710fac2 drivers: Trim unused config_get() calls
None of the driver config_get/set/list calls are required.
2013-01-25 16:05:48 +01:00
Bert Vermeulen 0d485e30c6 Deprecate SR_DI_HWOPTS.
This is replaced by SR_CONF_SCAN_OPTIONS.
2013-01-25 15:09:20 +01:00
Bert Vermeulen 9a6517d14b Deprecate SR_DI_HWCAPS.
This is replaced by SR_CONF_DEVICE_OPTIONS.
2013-01-25 15:01:49 +01:00
Bert Vermeulen c50277a6ec Deprecate SR_DI_TRIGGER_TYPES.
This is replaced by SR_CONF_TRIGGER_TYPE.
2013-01-25 11:52:27 +01:00
Bert Vermeulen 328bafabd4 Deprecate SR_DI_TRIGGER_SOURCES.
This is replaced by SR_CONF_TRIGGER_SOURCE.
2013-01-25 11:25:32 +01:00
Bert Vermeulen 41f5bd09b0 Deprecate SR_DI_TIMEBASES.
This is replaced by SR_CONF_TIMEBASE.
2013-01-25 11:22:20 +01:00
Bert Vermeulen 6e1fbcc41b Deprecate SR_DI_FILTERS.
This is replaced by SR_CONF_FILTER.
2013-01-25 11:19:12 +01:00
Bert Vermeulen e4f2b2adc1 Deprecate SR_DI_VDIVS.
This is replaced by SR_CONF_VDIV.
2013-01-25 11:13:49 +01:00
Bert Vermeulen 2a7b113d13 Deprecate SR_DI_COUPLING.
This is replaced by SR_CONF_COUPLING.
2013-01-25 11:04:27 +01:00
Bert Vermeulen 6d1ceffa95 Deprecate SR_DI_BUFFERSIZES.
This is replaced by SR_CONF_BUFFERSIZE.
2013-01-25 10:58:37 +01:00
Bert Vermeulen dd96ea9879 Deprecate SR_DI_PATTERNS.
This is replaced by SR_CONF_PATTERN_MODE.
2013-01-25 03:38:44 +01:00
Bert Vermeulen 123e131383 Deprecate SR_DI_CUR_SAMPLERATE.
This is replaced by SR_CONF_SAMPLERATE.
2013-01-25 03:17:36 +01:00
Bert Vermeulen fbec8bd2f3 deprecate SR_DI_SAMPLERATES
This is replaced by a call to config_list() with id SR_CONF_SAMPLERATE.
2013-01-25 02:39:58 +01:00
Bert Vermeulen a1c743fc51 drivers: implement config_list() 2013-01-25 02:37:26 +01:00
Bert Vermeulen 035a1078fd drivers: rename and reorganize config get/set
The driver API calls info_get() and dev_config_set() have been renamed
to config_get() and config_set(), respectively.
2013-01-24 19:19:09 +01:00
Bert Vermeulen 69e19dd769 Always interleave analog data with all enabled probes.
The new "probes" field in sr_datafeed_analog contains a copy
of all enabled struct sr_probe.
2013-01-23 03:40:44 +01:00
Bert Vermeulen b1a051544d serial: more serial processing flags to turn off 2013-01-23 02:32:58 +01:00
Bert Vermeulen 431ec7ca4a uni-t-dmm: use new sr_config struct 2013-01-21 23:40:09 +01:00
Bert Vermeulen 1953564a96 Rename SR_HWOPT_* and SR_HWCAP_* to SR_CONF_* 2013-01-21 23:32:50 +01:00
Bert Vermeulen d8e3685c47 free USB config descriptor after use 2013-01-21 23:32:49 +01:00
Bert Vermeulen 1987b8d63e drivers: use new sr_config struct
Sending an SR_DF_META packet at the start of every stream is not
mandatory; the frontend should ask for what it needs, and any extra
information the driver wants to send will come in due time.
2013-01-21 23:32:49 +01:00
Uwe Hermann 86c02e6554 serial.c: Fix copy-paste error.
Thanks Bert Vermeulen for reporting.
2013-01-21 01:47:30 +01:00
Uwe Hermann 9d8fde40c3 uni-t-dmm: Quickfix for UNI-T UT61D.
This is a temporary fix only, since a major rework of uni-t-dmm is being
done at the moment, soon to be merged.
2013-01-21 01:45:02 +01:00
Uwe Hermann 5edc02c77c Add missing "ULL" suffixes.
These numbers are larger than 32bit, mark them as ULL to avoid compile
failures on 32bit systems.
2013-01-20 20:39:18 +01:00
Uwe Hermann 73365eaed0 uni-t-dmm: Expose hwopts. 2013-01-20 19:57:04 +01:00
Uwe Hermann 388f9d3e25 uni-t-dmm: Fix scanning, properly use new sr_usb_find(). 2013-01-20 19:55:33 +01:00
Uwe Hermann 4ebd48b352 Remove non-error hw_info_get() messages.
Currently hw_info_get() can receive requests for entries (info_id) that
the specific driver doesn't support. That is (right now) a valid
use-case and not an error (might change later, though).

Thus, for now, don't output messages for such requests at all (certainly
not as sr_err() where they show up in e.g. sigrok-cli output per default).
2013-01-20 18:48:02 +01:00
Uwe Hermann b97cbca6c9 serial.c: OpenBSD doesn't have B460800. 2013-01-19 15:55:22 +01:00
Uwe Hermann 3d6de074a4 alsa: Silence ALSA scanning process.
Errors while opening or configuring ALSA devices during scan for devices
should not be shown by default (i.e., no sr_err() usage). Non-working
or non-accessible devices (due to permissions or other reasons) will
simply not show up in frontends. Use sr_dbg() instead of sr_err().
2013-01-16 00:02:24 +01:00
Bert Vermeulen 6b8d6f93bb Get rid of obsolete SR_DI_NUM_PROBES and SR_DI_PROBE_NAMES.
Frontends should use the probe list in the device's sr_dev_inst
to get this information.
2013-01-15 17:42:23 +01:00
Bert Vermeulen 512bb890df rigol-ds1xx2: More selective Rigol DS1xx2 scan
Patch submitted by Martin Ling.
2013-01-13 22:42:21 +01:00
Alexandru Gagniuc cbc80f8f8a fx2lafw: Say if chip is old FX2 or FX2LP
Look at the extracted REVID, and print out if it is an FX2 (non-LP), or FX2LP.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-01-08 03:44:36 +01:00
Uwe Hermann a24e9d0484 link-mso19: Use more portable g_htons().
Not all systems provide <arpa/inet.h> and/or htons(). Use portable and
always available g_htons() from glib instead.
2013-01-08 03:13:45 +01:00
Uwe Hermann 753d722f34 link-mso19: Fix a bunch of compiler warnings. 2013-01-08 03:13:14 +01:00
Uwe Hermann 00b44ccb8b link-mso19: Fix white-space, cosmetics, coding-style.
Fix the bare minumum of whitespace/indentation/coding-style via
automatic 'indent' run, followed by some minor manual fixes.
Some more fixes and cleanups might follow later.
2013-01-08 03:13:08 +01:00
Uwe Hermann f48cef7897 link-mso19: Fix (C) lines.
Bring back the original (C) lines from before the split into api.c
and protocol.[ch].

Add "Copyright (C) 2013 Lior Elazary <lelazary@yahoo.com>" since there
were nontrivial changes to those files.
2013-01-08 02:30:40 +01:00
lelazary eb913174ab Added limit samples Eveything seems to work find up to 1024 samples 2013-01-08 01:00:14 +01:00
lelazary 087a9161ff Rewrote the trigger config. Added trigger position and trigger slope 2013-01-08 01:00:14 +01:00
lelazary 5a24e89ca4 Eveything seems to work now except for triggers. 2013-01-08 01:00:14 +01:00
lelazary 4db2aaffe7 More cleanup. Communication with mso19 is working, but its not triggering. Need to check why. 2013-01-08 01:00:13 +01:00
lelazary 26ddb5baca Added flow control to serial configuration to support xon/xoff for link-mso19 2013-01-08 01:00:13 +01:00
lelazary 4b719338cc Added missing mso functions 2013-01-08 01:00:13 +01:00
lelazary def5c35c4c Removing the old link-mso19 files and changing makefile 2013-01-08 01:00:13 +01:00
lelazary df92e5cf6b Rewrote the link-mso19.c into api and protocol. Still need to test and cleanup some more 2013-01-08 01:00:13 +01:00
Uwe Hermann 29d957ceae rigol-ds1xx2: Cosmetics, whitespace. 2013-01-03 19:04:11 +01:00
Martin Ling fb6e5ba8c7 rigol-ds1xx2: Autoprobe for usbtmc devices on Linux. 2013-01-03 18:41:29 +01:00
Martin Ling 4e108ace13 rigol-ds1xx2: Fix setting trigger parameters. 2013-01-03 18:41:29 +01:00
Martin Ling 542843f76f rigol-ds1xx2: Assorted parameter setting fixes. 2013-01-03 18:41:29 +01:00
Martin Ling e0b7d23ce8 rigol-ds1xx2: First working version.
Currently hardcoded to use /dev/usbtmc1. Analog data readout works.
2013-01-03 18:41:29 +01:00
Martin Ling f4816ac6cc rigol-ds1xx2: Initial driver skeleton. 2013-01-03 18:41:28 +01:00
Uwe Hermann aeabd30820 ols: Implement SR_DI_HWOPTS. 2013-01-03 02:15:27 +01:00
Uwe Hermann 986fde755d serial-dmm: Add UNI-T UT61E support (UT-D02 cable). 2013-01-03 01:13:57 +01:00
Uwe Hermann fe0c0b98c6 Add Cyrustek ES51922 DMM chip parser. 2013-01-03 01:13:06 +01:00
Uwe Hermann 21d3d4ee87 alsa: Add some more samplerates.
Add some more samplerates that seem to be supported by some devices
(found via random grepping of alsa and kernel sources).
2013-01-01 00:37:18 +01:00
Uwe Hermann a1b9a9bf44 alsa: Add missing % for PRIu64. 2013-01-01 00:37:17 +01:00
Uwe Hermann 52ba6e05d5 alsa: Improved error reporting. 2013-01-01 00:37:17 +01:00
Uwe Hermann 721ecf3d97 alsa: Cosmetics, coding style, typos. 2013-01-01 00:37:17 +01:00
Alexandru Gagniuc 65faa197ae alsa: Find supported samplerates during device scan
Since we are using the 'hw' interface of ALSA, we don't have the luxury of
samplerate conversion, given by the 'plughw' interface. If we try to set a
samplerate that is not supported, ALSA will just throw an error.

We can test for the supported samplerates, and create a list of supported
samplerates, then limit the selection to only those values. The frontend can
query the list of supported samplerates.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-01-01 00:37:17 +01:00
Alexandru Gagniuc 729850c9e7 alsa: Fix sample acquisition and send normalized values
The alsa driver requested signed 16-bit integers from ALSA, but casted them to
to an unsigned 16bit before finally casting them to a float. The end result was
that half of the wave would be clipped off.
We also requested data in little endian format. ALSA can be instructed to send
data with the correct endianness for the platform, without needing to worry
about what that is.

This patch attempts three points, which, together, fix the acquisition:
1) Request data from ALSA without specifying endianness; ALSA will handle the
endianness.
2) Simplify the int16_t to float loop by using straightforward indexes.
3) Normalize every value before sending it on the session bus.

NOTE: If testing with PulseView, it will appear as if sigrok is sending all
zeroes. sigrok is sending correct data, but since the data is normalized,
PulseView will incorrectly plot it as a straight line.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-01-01 00:37:17 +01:00
Alexandru Gagniuc 6944b2d02f alsa: Scan all soundcards and create a sigrok device per input
The alsa driver only works with device "default". This limits the driver's
scope to whatever device ALSA deems to be "default". It is desirable to have
access to all ALSA devices from sigrok.

Change the alsa device scan so that:
Each alsa device (not alsa card) gets its own sigrok device
For example,
    hw:1,0 == sigrok device 0
    hw:1,1 == sigrok device 1
    hw:2,0 == sigrok device 2
    hw:2,1 == sigrok device 3
    hw:2,2 == sigrok device 4
    [...]

We don't currently look at alsa subdevices. We only use subdevice 0.
Every input device will have its own channels (left, right, etc). Each of
those channels gets mapped to a different sigrok probe. A device with 4
channels will have 4 probes from sigrok's perspective.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-01-01 00:37:17 +01:00
Alexandru Gagniuc 0d6ff10394 alsa: Do not use snd_pcm_hw_params_set_rate_near()
snd_pcm_hw_params_set_rate_near() will try to use the samplerate closest to the
given value, potentially starting the acquisition with a different samplerate
than the one specified.

Instead, use snd_pcm_hw_params_set_rate(). It will return an error if the
samplerate is not supported by the hardware, which is arguably better than
collecting data with a different samplerate than the one specified.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-01-01 00:37:17 +01:00
Alexandru Gagniuc cbc8cbd8bb rs9lcd: Add missing 'break;'
A break was missing for "case MODE_AMP_WIDTH:" in sr_rs9lcd_parse().

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-31 22:26:43 +01:00
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