Commit Graph

884 Commits

Author SHA1 Message Date
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