Commit Graph

3465 Commits

Author SHA1 Message Date
Daniel Elstner 4619fab47a input: Use fseeko/ftello to get the size of a file
Introduce the sr_file_get_size() utility function to retrieve the
size of an open FILE stream. This is based on fseeko() followed by
ftello(), which are POSIX functions but quite portable in practice.
Since these calls operate on FILE streams instead of filenames, the
issue of filename encoding no longer arises.
2015-10-01 15:44:55 +02:00
Daniel Elstner 5e364d4fe0 input: Clean up input file scanning
Do not use Unix low-level I/O for reading a regular input file.
Read in the file header once and re-use the buffer for all input
modules participating in the scan. Also re-use a prefilled metadata
table instead of creating it anew for each input module tried.
2015-10-01 15:44:55 +02:00
Uwe Hermann ff85d65ec6 drivers.c: Fix HAVE_HW_GWINSTEK_GDS_800 position. 2015-09-30 19:54:58 +02:00
Martin Lederhilger b11afbb142 gwinstek-gds-800: Initial driver implementation. 2015-09-30 19:54:58 +02:00
Martin Lederhilger 7c198f968b gwinstek-gds-800: Initial driver skeleton. 2015-09-30 19:22:27 +02:00
Uwe Hermann 6e799d0799 manson-hcs-3xxx: Fix use-after-free and memory leaks.
Thanks to Hannu Vuolasaho for the report!
2015-09-25 12:19:08 +02:00
Uwe Hermann e57057aee7 Fix a few "value never read" scan-build warnings.
This fixes parts of bug #423.

The list of fixed warnings:

src/output/srzip.c:285:3: warning: Value stored to 'ret' is never read
                ret = zip_append(o, logic->data, logic->unitsize, logic->length);
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/scpi/scpi.c:610:2: warning: Value stored to 'ret' is never read
        ret = SR_OK;
        ^     ~~~~~
src/scpi/scpi.c:667:2: warning: Value stored to 'ret' is never read
        ret = SR_OK;
        ^     ~~~~~
src/dmm/vc870.c:410:2: warning: Value stored to 'info_local' is never read
        info_local = (struct vc870_info *)info;
        ^            ~~~~~~~~~~~~~~~~~~~~~~~~~
src/hardware/conrad-digi-35-cpu/api.c:130:2: warning: Value stored to 'ret' is never read
        ret = SR_OK;
        ^     ~~~~~
src/hardware/fx2lafw/api.c:658:2: warning: Value stored to 'timeout' is never read
        timeout = fx2lafw_get_timeout(devc);
        ^         ~~~~~~~~~~~~~~~~~~~~~~~~~
src/hardware/gmc-mh-1x-2x/protocol.c:941:3: warning: Value stored to 'retc' is never read
                retc = SR_ERR_ARG;
                ^      ~~~~~~~~~~
src/hardware/gmc-mh-1x-2x/api.c:168:2: warning: Value stored to 'model' is never read
        model = METRAHIT_NONE;
        ^       ~~~~~~~~~~~~~
src/hardware/ikalogic-scanalogic2/api.c:325:2: warning: Value stored to 'ret' is never read
        ret = SR_OK;
        ^     ~~~~~
src/hardware/openbench-logic-sniffer/api.c:185:3: warning: Value stored to 'devc' is never read
                devc = sdi->priv;
                ^      ~~~~~~~~~
src/hardware/rigol-ds/api.c:813:3: warning: Value stored to 'devc' is never read
                devc = sdi->priv;
                ^      ~~~~~~~~~
src/hardware/scpi-pps/api.c:405:2: warning: Value stored to 'ret' is never read
        ret = SR_OK;
        ^     ~~~~~
src/hardware/yokogawa-dlm/api.c:239:2: warning: Value stored to 'ret' is never read
        ret = SR_ERR_NA;
        ^     ~~~~~~~~~
2015-09-25 12:02:42 +02:00
Daniel Elstner 36cbd69e12 demo: Strictly round up the number of samples to send
This avoids getting stuck when the time limit is less than
half of the sampling interval.
2015-09-22 16:12:01 +02:00
Daniel Elstner 98c01fe127 demo: Increase timer interval to 100 ms
Timer intervals shorter than about 100 ms are unnecessarily taxing
on system resources. Also, on systems like Windows the smallest
resolvable time unit without using high precision timers is about
15 ms. Regular timer intervals should be well above that value to
avoid being dominated by noise and round-off.
2015-09-22 11:17:27 +02:00
Daniel Elstner a49a320dea demo: Fix continuous mode and honor time limit
Also deal more gracefully with changes to the samplerate while
running.
2015-09-22 11:17:27 +02:00
Bert Vermeulen 01b062390a scpi/usbtmc: Add Agilent DSO1000 series to RL1 blacklist.
These are rebadged Rigol DS1000 scopes, and suffer from the same USBTMC
implementation.
2015-09-22 10:57:04 +02:00
Bert Vermeulen de285cce11 scpi/usbtmc: Implement Rigol DS1000 workaround on any firmware version.
Firmware versions starting with 00.02.04 apparently cause the in and out
bulk endpoints to end up in a HALT state. This is likely related to the
larger transfer size quirk implemented in the Linux kernel for the Rigol
DS1000: this USBTMC implementation does not have that workaround.

Instead, if the firmware version is >= 00.02.04, both endpoints have the HALT
condition cleared on device close.

This fixes bug #354.
2015-09-22 10:56:58 +02:00
Bert Vermeulen 04229f7bfc scpi: Pass SCPI device instance to open and close callbacks.
Only close() really needs this (for access to a Rigol firmware quirk),
but do the same in open() for consistency.
2015-09-21 13:41:03 +02:00
Bert Vermeulen 27cd728f8a scpi/libgpib: Fix format argument in error message. 2015-09-21 13:30:33 +02:00
Scott Allen 6703bb2983 Fix RadioShack 22-812 DMM incorrect readings.
The wrong byte was being used to test for the nano indicator.

This resulted in reported resistance and capacitance readings being off
by orders of magnitude.

This fixes bug #657.
2015-09-21 12:47:15 +02:00
Bert Vermeulen 115826529c scpi/usbtmc: Implement blacklist for RL1 feature.
This is initially for the Rigol DS1000 series which pretends to support
RL1, but doesn't.
2015-09-21 12:44:24 +02:00
Martin Ling b07a1b04e5 sr_analog_to_float: Avoid comparison between signed and unsigned.
The check for p == q is basically checking whether p/q == 1. We should
be normalising the rational before it gets here though, so in this case
we should have p == q == 1 here.
2015-09-21 00:32:26 +02:00
Martin Ling 53e5d3d14d sr_rational_set: Accept signed numerator. 2015-09-21 00:32:26 +02:00
Martin Ling 18ea6b76fd sr_rational: Make numerator signed. 2015-09-21 00:32:26 +02:00
Martin Ling 83c1dbd9b5 sr_packet_free: Support SR_DF_ANALOG2. 2015-09-21 00:32:26 +02:00
Martin Ling dbdfa4fb50 sr_packet_copy: Support SR_DF_ANALOG2. 2015-09-21 00:32:25 +02:00
Martin Ling 7d65dd3a86 sr_analog_to_float: Support packets with multiple channels. 2015-09-21 00:32:25 +02:00
Martin Ling 3e27754989 sr_analog_to_float: Fix byte reordering. 2015-09-21 00:32:25 +02:00
Martin Ling fa74a26bc9 output/analog: Allocate correct buffer size for sr_analog_to_float(). 2015-09-21 00:32:25 +02:00
Martin Ling 39e0113533 sr_packet_copy: Allocate memory to copy analog data. 2015-09-21 00:32:25 +02:00
Bert Vermeulen 2a8f2d41ad No need to check return value of libusb_get_device_descriptor().
Since libusb 1.0.16 this is guaranteed to always succeed.

This fixes bug #658.
2015-09-21 00:25:40 +02:00
Bert Vermeulen 8de8551b88 Remove unnecessary call to libusb_get_device_descriptor(). 2015-09-21 00:16:42 +02:00
Aurelien Jacobs 069d9f25d9 scpi-pps: cleaner rewriting of output regulation GVariant 2015-09-20 16:43:43 +02:00
Aurelien Jacobs d66c93ccda scpi-pps: sr_scpi_get_string() is already called by scpi_cmd_resp()
This double call was causing the following error:
sr: scpi_usbtmc: USBTMC bulk in transfer error: LIBUSB_ERROR_TIMEOUT.
2015-09-20 16:22:21 +02:00
Aurelien Jacobs 6ab604c5c2 scpi: add obviously missing else statements 2015-09-20 16:19:48 +02:00
Aurelien Jacobs 485a285abe scpi: don't stop parsing table at command 0 which is a valid command
command 0 is SCPI_CMD_REMOTE
2015-09-20 16:18:18 +02:00
Aurelien Jacobs 06f63a749e scpi: scpi_cmd_resp() shouldn't return SR_OK without filling the gvar
scpi-pps at line 212 assumes that an SR_OK return means that the gvar
is valid, which leads to the following error:
** GLib:ERROR:/build/glib2.0-2.45.8/./glib/gvarianttypeinfo.c:184:g_variant_type_info_check: assertion failed: (0 <= index && index < 24)
2015-09-20 16:15:01 +02:00
Bert Vermeulen baed0211a1 scpi/usbtmc: Support RL1 feature.
This automatically locks out local controls when a USBTMC device is
opened, and returns local control on close.
2015-09-19 01:26:45 +02:00
Bartosz Golaszewski b41bbfdbe2 baylibre-acme: gpio: Don't set direction in get/set functions.
GPIO direction should be set once right after exporting. There's no need
to reset it again - in fact it's a bug which causes the probe to be reset
every time the value is read/set and gives incorrect results when reading
the GPIO values with direction == 'in'.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-09-18 19:52:39 +02:00
Bartosz Golaszewski 4678bdb607 baylibre-acme: Add basic support for ACME revB.
Revision B of ACME hardware introduces probes with on-board at24cs02
EEPROM. Extend the ACME driver to support reading the contents of
the EEPROM via linux' sysfs interface.

Also: make the driver be able to tell the difference between revisions,
add new GPIO layout and set the shunt resistance for revB at probe
registration.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-09-18 19:52:38 +02:00
Bartosz Golaszewski 8f1961209b baylibre-acme: Check for power-switch presence at probe's initialization.
Only perform a single check at initialization time to see if the probe is
equipped with a power-switch. This is done in preparation for revision B
support which has this kind of information encoded in EEPROM.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-09-18 19:52:38 +02:00
Bartosz Golaszewski 133016f6ab baylibre-acme: Move enum channel_type to protocol.c.
This enum is private and only used within protocol.c. Don't expose it
in protocol.h.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-09-18 19:52:38 +02:00
Daniel Elstner ad6181e25e sysclk-lwla: Set USB device configuration
After opening the USB device, set the device configuration to 1.
Actually, do it twice, just as the vendor driver seems to do. This
is supposed to trigger a lightweight reset of the device.

Originally, I omitted this reset sequence from the sigrok driver
because it simply did not work at all for me. However, it does seem
to work now, so that may have been a problem in libusb or the kernel
which is now fixed.

With some luck, this change may finally fix #327.
2015-09-16 23:37:58 +02:00
Daniel Elstner c81069b337 sysclk-lwla: Clean up open/closed state handling
Use states SR_ST_ACTIVE and SR_ST_INACTIVE to indicate that the
device is open or closed, respectively. Do not use any of the
other state values. Improve the robustness of the open and close
methods in face of errors. Introduce a separate flag to indicate
that a running acquisition should be canceled.
2015-09-16 23:37:58 +02:00
Daniel Elstner 225d3cb0c5 sysclk-lwla: Streamline trigger setup logic
Prepare the trigger masks at config_commit() time, so that the
trigger setup can be validated before starting an acquisition.
Accordingly, do actually report validation errors back to the
caller.
2015-09-16 23:37:58 +02:00
Daniel Elstner 2a09aac268 fx2lafw, sysclk-lwla: Avoid g_stat()
It turns out that g_stat() breaks apart when using 64 bit stat on
32-bit systems. Since the actual type of GStatBuf is decided when
glib/gstdio.h is included, it is thus possible for GLib itself to
be compiled with a different type than user code.

Ouch. Unfortunately going back to plain stat() also means that we
lose Unicode filename support on Windows.
2015-09-16 23:33:45 +02:00
Daniel Elstner eb2373f167 configure: Check for numpy Python module
This fixes bug #533.
2015-09-15 18:31:45 +02:00
Uwe Hermann 9851d35b0a lascar-el-usb: Fix copy-paste errors. 2015-09-15 11:20:57 +02:00
Uwe Hermann 3182d4ebb3 Makefile.am: Shorten ChangeLog target a bit. 2015-09-14 17:54:48 +02:00
Uwe Hermann 1a65c5e86f motech-lps-30x: Fix blocking serial write timeout.
This fixes bug #438.
2015-09-14 00:10:25 +02:00
Uwe Hermann d545c81c96 norma-dmm: Fix blocking serial write timeout.
This fixes bug #434.
2015-09-14 00:10:24 +02:00
Uwe Hermann 936b1c00e8 gmc-mh-1x-2x: Fix blocking serial write timeout.
This fixes bug #432.
2015-09-14 00:10:24 +02:00
Uwe Hermann 8b9eb639b2 conrad-digi-35-cpu: Fix blocking serial write timeout.
This fixes bug #430.
2015-09-13 23:55:22 +02:00
Uwe Hermann b9ed8eabfd brymen-dmm: Fix blocking serial write timeout.
This fixes bug #427.
2015-09-13 23:53:55 +02:00
Uwe Hermann 84d328ac98 center-3xx: Fix blocking serial write timeout.
This fixes bug #428.
2015-09-13 23:48:09 +02:00