]> sigrok.org Git - libsigrok.git/log
libsigrok.git
9 years agosrzip: Avoid recent-ish zip_file_add()
Daniel Elstner [Fri, 16 Oct 2015 18:35:32 +0000 (20:35 +0200)]
srzip: Avoid recent-ish zip_file_add()

9 years agokorad-kdxxxxp: Use PRIi64 format for int64_t
Daniel Elstner [Fri, 16 Oct 2015 19:28:07 +0000 (21:28 +0200)]
korad-kdxxxxp: Use PRIi64 format for int64_t

9 years agodrivers: Add support for Tenma 72-7730 multimeter
Karl Palsson [Tue, 13 Oct 2015 16:19:24 +0000 (16:19 +0000)]
drivers: Add support for Tenma 72-7730 multimeter

Tested with a 72-7730 device.

Signed-off-by: Karl Palsson <redacted>
9 years agoconfigure.ac: Korad KDxxxxP depends on libserialport.
Uwe Hermann [Tue, 13 Oct 2015 21:26:40 +0000 (23:26 +0200)]
configure.ac: Korad KDxxxxP depends on libserialport.

9 years agoInitial driver for Korad KDxxxxP (Velleman LABPS3005D)
Hannu Vuolasaho [Fri, 25 Sep 2015 14:43:17 +0000 (16:43 +0200)]
Initial driver for Korad KDxxxxP (Velleman LABPS3005D)

With this driver it is possible to set voltage target and current
limit. Also enabling and disabling the output is possible.

Analog output sends read back values from output. If output is
disabled analog outputs 0.00.

In protocol.c there is a g_usleep() call. This gives almost
every time enough time for PSU to parse and process input.

Multichannel devices aren't supported.

9 years agokorad-kdxxxxp: Initial driver skeleton.
Hannu Vuolasaho [Thu, 24 Sep 2015 19:58:38 +0000 (21:58 +0200)]
korad-kdxxxxp: Initial driver skeleton.

9 years agobaylibre-acme: Fix EEPROM fields endianness.
Bartosz Golaszewski [Fri, 9 Oct 2015 13:52:28 +0000 (15:52 +0200)]
baylibre-acme: Fix EEPROM fields endianness.

Use RB32 instead of RL32 since integer types in probe EEPROM are in network
byte order.

Signed-off-by: Bartosz Golaszewski <redacted>
9 years agobaylibre-acme: Read EEPROM contents into buffer before processing.
Bartosz Golaszewski [Fri, 25 Sep 2015 21:48:30 +0000 (14:48 -0700)]
baylibre-acme: Read EEPROM contents into buffer before processing.

Instead of using a non-standard packed attribute, read the contents of the
probe EEPROM into a buffer and then process it using the R* macros.

Signed-off-by: Bartosz Golaszewski <redacted>
9 years agobaylibre-acme: Use fixed-size integer types in struct probe_eeprom.
Bartosz Golaszewski [Sat, 19 Sep 2015 18:08:26 +0000 (20:08 +0200)]
baylibre-acme: Use fixed-size integer types in struct probe_eeprom.

Standard integer types may differ in size on different targets. Use fixed-size
types instead.

Signed-off-by: Bartosz Golaszewski <redacted>
9 years agoC++: Remove leftover Context::begin_save() method
Daniel Elstner [Sun, 4 Oct 2015 20:11:39 +0000 (22:11 +0200)]
C++: Remove leftover Context::begin_save() method

9 years agobuild: Do not define FIRMWARE_DIR on Windows
Daniel Elstner [Sat, 3 Oct 2015 12:08:32 +0000 (14:08 +0200)]
build: Do not define FIRMWARE_DIR on Windows

The hard-coded location is bound to be wrong anyway. Instead, rely
on the new resource lookup code to find the firmware files in a
location relative to the library or executable.

9 years agoresource: Make definition of FIRMWARE_DIR optional
Daniel Elstner [Sat, 3 Oct 2015 11:58:50 +0000 (13:58 +0200)]
resource: Make definition of FIRMWARE_DIR optional

9 years agosession-file: Use 32-bit int for channel count
Daniel Elstner [Fri, 2 Oct 2015 18:09:46 +0000 (20:09 +0200)]
session-file: Use 32-bit int for channel count

SR_CONF_NUM_LOGIC_CHANNELS is defined as SR_T_INT32. Create the
GVariant with the correct type to avoid a type mismatch error in
sr_variant_type_check().

9 years agousb: Skip add/remove of FD on destroyed source
Daniel Elstner [Thu, 1 Oct 2015 22:36:10 +0000 (00:36 +0200)]
usb: Skip add/remove of FD on destroyed source

This avoids nasty GLib-CRITICALs on Windows with some drivers.

9 years agoC++: Wrap resource access API
Daniel Elstner [Sat, 26 Sep 2015 22:03:21 +0000 (00:03 +0200)]
C++: Wrap resource access API

Introduce a ResourceReader delegate class with virtual methods
corresponding to the C callback functions.

9 years agodrivers: Load firmware via new resource API
Daniel Elstner [Sat, 26 Sep 2015 20:41:05 +0000 (22:41 +0200)]
drivers: Load firmware via new resource API

9 years agoresource: Move sr_file_get_size() to resource.c
Daniel Elstner [Sat, 26 Sep 2015 16:10:28 +0000 (18:10 +0200)]
resource: Move sr_file_get_size() to resource.c

9 years agoresource: New internal API for accessing resource files
Daniel Elstner [Sat, 26 Sep 2015 11:38:30 +0000 (13:38 +0200)]
resource: New internal API for accessing resource files

The resource API provides a generic means for accessing resources
that are bundled with sigrok, such as device firmware files. Since
the manner of resource bundling is platform-dependent, users of
libsigrok may override the functions used to open, close and read
a resource. The default implementation accesses resources as files
located in one of the XDG data directories or a directory defined
at compile time.

9 years agosrzip: Avoid low-level FD-based I/O
Daniel Elstner [Sun, 20 Sep 2015 18:32:03 +0000 (20:32 +0200)]
srzip: Avoid low-level FD-based I/O

Use in-memory buffers instead of temporary files. This avoids
the need for low-level I/O on the FD returned by g_mkstemp().
Refactor the code accordingly. Also plug a number of leaks and
tighten the error checking.

9 years agosession-file: Remove old session save API
Daniel Elstner [Sun, 20 Sep 2015 12:10:42 +0000 (14:10 +0200)]
session-file: Remove old session save API

Completely remove the old session save code that has been
superseded by the srzip output module. Also refactor a bit,
plug a number of leaks and tighten the error checking.

9 years agovirtual-session: Plug ZIP archive leak
Daniel Elstner [Sun, 20 Sep 2015 12:07:01 +0000 (14:07 +0200)]
virtual-session: Plug ZIP archive leak

Refactor a bit to keep the code manageable. Also allow
stopping of a running acquisition.

9 years agovirtual-session: Advertise all config keys
Daniel Elstner [Sun, 20 Sep 2015 12:06:06 +0000 (14:06 +0200)]
virtual-session: Advertise all config keys

9 years agoinput: Use fseeko/ftello to get the size of a file
Daniel Elstner [Sat, 19 Sep 2015 18:43:25 +0000 (20:43 +0200)]
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.

9 years agoinput: Clean up input file scanning
Daniel Elstner [Fri, 18 Sep 2015 22:24:50 +0000 (00:24 +0200)]
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.

9 years agodrivers.c: Fix HAVE_HW_GWINSTEK_GDS_800 position.
Uwe Hermann [Wed, 30 Sep 2015 17:42:19 +0000 (19:42 +0200)]
drivers.c: Fix HAVE_HW_GWINSTEK_GDS_800 position.

9 years agogwinstek-gds-800: Initial driver implementation.
Martin Lederhilger [Sun, 16 Aug 2015 17:52:02 +0000 (19:52 +0200)]
gwinstek-gds-800: Initial driver implementation.

9 years agogwinstek-gds-800: Initial driver skeleton.
Martin Lederhilger [Sun, 16 Aug 2015 12:52:49 +0000 (14:52 +0200)]
gwinstek-gds-800: Initial driver skeleton.

9 years agomanson-hcs-3xxx: Fix use-after-free and memory leaks.
Uwe Hermann [Fri, 25 Sep 2015 07:00:05 +0000 (09:00 +0200)]
manson-hcs-3xxx: Fix use-after-free and memory leaks.

Thanks to Hannu Vuolasaho for the report!

9 years agoFix a few "value never read" scan-build warnings.
Uwe Hermann [Fri, 25 Sep 2015 06:52:58 +0000 (08:52 +0200)]
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;
        ^     ~~~~~~~~~

9 years agodemo: Strictly round up the number of samples to send
Daniel Elstner [Tue, 22 Sep 2015 14:12:01 +0000 (16:12 +0200)]
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.

9 years agodemo: Increase timer interval to 100 ms
Daniel Elstner [Tue, 22 Sep 2015 04:54:33 +0000 (06:54 +0200)]
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.

9 years agodemo: Fix continuous mode and honor time limit
Daniel Elstner [Tue, 22 Sep 2015 04:49:17 +0000 (06:49 +0200)]
demo: Fix continuous mode and honor time limit

Also deal more gracefully with changes to the samplerate while
running.

9 years agoscpi/usbtmc: Add Agilent DSO1000 series to RL1 blacklist.
Bert Vermeulen [Mon, 21 Sep 2015 22:53:28 +0000 (00:53 +0200)]
scpi/usbtmc: Add Agilent DSO1000 series to RL1 blacklist.

These are rebadged Rigol DS1000 scopes, and suffer from the same USBTMC
implementation.

9 years agoscpi/usbtmc: Implement Rigol DS1000 workaround on any firmware version.
Bert Vermeulen [Mon, 21 Sep 2015 11:45:36 +0000 (13:45 +0200)]
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.

9 years agoscpi: Pass SCPI device instance to open and close callbacks.
Bert Vermeulen [Mon, 21 Sep 2015 11:41:03 +0000 (13:41 +0200)]
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.

9 years agoscpi/libgpib: Fix format argument in error message.
Bert Vermeulen [Mon, 21 Sep 2015 10:39:33 +0000 (12:39 +0200)]
scpi/libgpib: Fix format argument in error message.

9 years agoFix RadioShack 22-812 DMM incorrect readings.
Scott Allen [Sat, 19 Sep 2015 01:42:24 +0000 (21:42 -0400)]
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.

9 years agoscpi/usbtmc: Implement blacklist for RL1 feature.
Bert Vermeulen [Sat, 19 Sep 2015 14:28:52 +0000 (16:28 +0200)]
scpi/usbtmc: Implement blacklist for RL1 feature.

This is initially for the Rigol DS1000 series which pretends to support
RL1, but doesn't.

9 years agosr_analog_to_float: Avoid comparison between signed and unsigned.
Martin Ling [Mon, 7 Sep 2015 08:15:52 +0000 (09:15 +0100)]
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.

9 years agosr_rational_set: Accept signed numerator.
Martin Ling [Wed, 9 Sep 2015 22:41:27 +0000 (23:41 +0100)]
sr_rational_set: Accept signed numerator.

9 years agosr_rational: Make numerator signed.
Martin Ling [Mon, 7 Sep 2015 08:15:35 +0000 (09:15 +0100)]
sr_rational: Make numerator signed.

9 years agosr_packet_free: Support SR_DF_ANALOG2.
Martin Ling [Sat, 5 Sep 2015 17:26:30 +0000 (18:26 +0100)]
sr_packet_free: Support SR_DF_ANALOG2.

9 years agosr_packet_copy: Support SR_DF_ANALOG2.
Martin Ling [Sat, 5 Sep 2015 17:22:33 +0000 (18:22 +0100)]
sr_packet_copy: Support SR_DF_ANALOG2.

9 years agosr_analog_to_float: Support packets with multiple channels.
Martin Ling [Thu, 17 Sep 2015 17:14:09 +0000 (18:14 +0100)]
sr_analog_to_float: Support packets with multiple channels.

9 years agosr_analog_to_float: Fix byte reordering.
Martin Ling [Thu, 17 Sep 2015 01:04:19 +0000 (02:04 +0100)]
sr_analog_to_float: Fix byte reordering.

9 years agooutput/analog: Allocate correct buffer size for sr_analog_to_float().
Martin Ling [Wed, 9 Sep 2015 23:45:32 +0000 (00:45 +0100)]
output/analog: Allocate correct buffer size for sr_analog_to_float().

9 years agosr_packet_copy: Allocate memory to copy analog data.
Martin Ling [Sat, 5 Sep 2015 17:03:23 +0000 (18:03 +0100)]
sr_packet_copy: Allocate memory to copy analog data.

9 years agoNo need to check return value of libusb_get_device_descriptor().
Bert Vermeulen [Sat, 19 Sep 2015 15:59:54 +0000 (17:59 +0200)]
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.

9 years agoRemove unnecessary call to libusb_get_device_descriptor().
Bert Vermeulen [Sat, 19 Sep 2015 15:58:22 +0000 (17:58 +0200)]
Remove unnecessary call to libusb_get_device_descriptor().

9 years agoscpi-pps: cleaner rewriting of output regulation GVariant
Aurelien Jacobs [Sun, 20 Sep 2015 14:43:43 +0000 (16:43 +0200)]
scpi-pps: cleaner rewriting of output regulation GVariant

9 years agoscpi-pps: sr_scpi_get_string() is already called by scpi_cmd_resp()
Aurelien Jacobs [Sun, 20 Sep 2015 14:22:21 +0000 (16:22 +0200)]
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.

9 years agoscpi: add obviously missing else statements
Aurelien Jacobs [Sun, 20 Sep 2015 14:19:48 +0000 (16:19 +0200)]
scpi: add obviously missing else statements

9 years agoscpi: don't stop parsing table at command 0 which is a valid command
Aurelien Jacobs [Sun, 20 Sep 2015 14:18:18 +0000 (16:18 +0200)]
scpi: don't stop parsing table at command 0 which is a valid command

command 0 is SCPI_CMD_REMOTE

9 years agoscpi: scpi_cmd_resp() shouldn't return SR_OK without filling the gvar
Aurelien Jacobs [Sun, 20 Sep 2015 14:15:01 +0000 (16:15 +0200)]
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)

9 years agoscpi/usbtmc: Support RL1 feature.
Bert Vermeulen [Thu, 17 Sep 2015 21:31:04 +0000 (23:31 +0200)]
scpi/usbtmc: Support RL1 feature.

This automatically locks out local controls when a USBTMC device is
opened, and returns local control on close.

9 years agobaylibre-acme: gpio: Don't set direction in get/set functions.
Bartosz Golaszewski [Wed, 16 Sep 2015 13:24:40 +0000 (15:24 +0200)]
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 <redacted>
9 years agobaylibre-acme: Add basic support for ACME revB.
Bartosz Golaszewski [Wed, 16 Sep 2015 12:18:11 +0000 (14:18 +0200)]
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 <redacted>
9 years agobaylibre-acme: Check for power-switch presence at probe's initialization.
Bartosz Golaszewski [Wed, 16 Sep 2015 11:30:54 +0000 (13:30 +0200)]
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 <redacted>
9 years agobaylibre-acme: Move enum channel_type to protocol.c.
Bartosz Golaszewski [Wed, 16 Sep 2015 08:55:42 +0000 (10:55 +0200)]
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 <redacted>
9 years agosysclk-lwla: Set USB device configuration
Daniel Elstner [Wed, 16 Sep 2015 20:35:13 +0000 (22:35 +0200)]
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.

9 years agosysclk-lwla: Clean up open/closed state handling
Daniel Elstner [Wed, 16 Sep 2015 19:31:42 +0000 (21:31 +0200)]
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.

9 years agosysclk-lwla: Streamline trigger setup logic
Daniel Elstner [Sun, 30 Aug 2015 16:20:41 +0000 (18:20 +0200)]
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.

9 years agofx2lafw, sysclk-lwla: Avoid g_stat()
Daniel Elstner [Wed, 16 Sep 2015 21:33:45 +0000 (23:33 +0200)]
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.

9 years agoconfigure: Check for numpy Python module
Daniel Elstner [Tue, 15 Sep 2015 16:26:51 +0000 (18:26 +0200)]
configure: Check for numpy Python module

This fixes bug #533.

9 years agolascar-el-usb: Fix copy-paste errors.
Uwe Hermann [Thu, 10 Sep 2015 16:52:15 +0000 (18:52 +0200)]
lascar-el-usb: Fix copy-paste errors.

9 years agoMakefile.am: Shorten ChangeLog target a bit.
Uwe Hermann [Mon, 14 Sep 2015 15:54:48 +0000 (17:54 +0200)]
Makefile.am: Shorten ChangeLog target a bit.

9 years agomotech-lps-30x: Fix blocking serial write timeout.
Uwe Hermann [Sun, 13 Sep 2015 22:01:18 +0000 (00:01 +0200)]
motech-lps-30x: Fix blocking serial write timeout.

This fixes bug #438.

9 years agonorma-dmm: Fix blocking serial write timeout.
Uwe Hermann [Sun, 13 Sep 2015 22:00:22 +0000 (00:00 +0200)]
norma-dmm: Fix blocking serial write timeout.

This fixes bug #434.

9 years agogmc-mh-1x-2x: Fix blocking serial write timeout.
Uwe Hermann [Sun, 13 Sep 2015 21:57:32 +0000 (23:57 +0200)]
gmc-mh-1x-2x: Fix blocking serial write timeout.

This fixes bug #432.

9 years agoconrad-digi-35-cpu: Fix blocking serial write timeout.
Uwe Hermann [Sun, 13 Sep 2015 21:55:22 +0000 (23:55 +0200)]
conrad-digi-35-cpu: Fix blocking serial write timeout.

This fixes bug #430.

9 years agobrymen-dmm: Fix blocking serial write timeout.
Uwe Hermann [Sun, 13 Sep 2015 21:53:55 +0000 (23:53 +0200)]
brymen-dmm: Fix blocking serial write timeout.

This fixes bug #427.

9 years agocenter-3xx: Fix blocking serial write timeout.
Uwe Hermann [Sun, 13 Sep 2015 21:48:09 +0000 (23:48 +0200)]
center-3xx: Fix blocking serial write timeout.

This fixes bug #428.

9 years agomic-985xx: Fix blocking serial write timeout.
Uwe Hermann [Sun, 13 Sep 2015 21:47:16 +0000 (23:47 +0200)]
mic-985xx: Fix blocking serial write timeout.

This fixes bug #433.

9 years agomanson-hcs-3xxx: Fix blocking serial write timeout.
Uwe Hermann [Sun, 13 Sep 2015 21:20:03 +0000 (23:20 +0200)]
manson-hcs-3xxx: Fix blocking serial write timeout.

This fixes bug #437.

9 years agotondaj-sl-814: Fix blocking serial write timeout.
Uwe Hermann [Sun, 13 Sep 2015 20:44:40 +0000 (22:44 +0200)]
tondaj-sl-814: Fix blocking serial write timeout.

This fixes bug #436.

9 years agoDrop obsolete SR_CONF_MEASURED_2ND_QUANTITY.
Uwe Hermann [Sun, 13 Sep 2015 19:43:17 +0000 (21:43 +0200)]
Drop obsolete SR_CONF_MEASURED_2ND_QUANTITY.

9 years agoclasses.cpp: Define _XOPEN_SOURCE for isascii()
Daniel Elstner [Sun, 13 Sep 2015 18:12:12 +0000 (20:12 +0200)]
classes.cpp: Define _XOPEN_SOURCE for isascii()

The GNU libstdc++ headers use isascii(), which is not part of any
POSIX standard. On BSD, this breaks the build. It is however part
of XOPEN, which on Linux is apparently enabled implicitly for C++.

This should fix #649.

9 years agoBuild: Move _POSIX_C_SOURCE definition to config.h
Daniel Elstner [Sun, 13 Sep 2015 16:35:28 +0000 (18:35 +0200)]
Build: Move _POSIX_C_SOURCE definition to config.h

Do not redefine it though when already set, so that it can be
overridden by the user, or indirectly by the compiler settings.

9 years agoBuild: Include <config.h> first in all source files
Daniel Elstner [Sun, 13 Sep 2015 16:22:17 +0000 (18:22 +0200)]
Build: Include <config.h> first in all source files

Since Autoconf places some important feature flags only into the
configuration header, it is necessary to include it globally to
guarantee a consistent build.

9 years agolibsigrok-internal.h: Remove unused prototypes
Daniel Elstner [Fri, 11 Sep 2015 21:22:54 +0000 (23:22 +0200)]
libsigrok-internal.h: Remove unused prototypes

The sr_source_* prototypes are not used anywhere, so remove them.
Also get rid of the SERIAL_PARITY_* aliases for SP_PARITY_*.

9 years agoserial: Make serial device event sources more robust
Daniel Elstner [Fri, 11 Sep 2015 21:08:10 +0000 (23:08 +0200)]
serial: Make serial device event sources more robust

Disallow polling for input/error and output-ready events at the
same time, and ensure only a single FD event source is installed.
Also, do not leak if the FD event source is removed by means
other than calling serial_source_remove().

9 years agoFix two more format warnings uncovered by MinGW build
Daniel Elstner [Sun, 13 Sep 2015 13:39:04 +0000 (15:39 +0200)]
Fix two more format warnings uncovered by MinGW build

9 years agoBuild: Force ISO-conforming format syntax on MinGW
Daniel Elstner [Sun, 13 Sep 2015 13:07:54 +0000 (15:07 +0200)]
Build: Force ISO-conforming format syntax on MinGW

On MinGW, two implementations of printf() are available: either
the Microsoft native one or a standard-conforming replacement from
gnulib. Since we build in C99 mode, headers such as <inttypes.h>
already select the standard-conforming variant. However, MinGW's
GCC does not seem to know about this and assumes MS-style format
syntax by default, which triggers a lot of wrong warnings.

Thus, on MinGW, explicitly decorate sr_log() with the gnu_printf
format flavor attribute. Also use GLib's printf replacements in
the logging implementation to make sure we link to a conforming
printf on any platform, independently of the compiler flags.

This gets rid of the mistaken -Wformat warnings for sr_log(), but
does not cover functions such as g_strdup_printf() which do not
explicitly specify the gnu_printf flavor in the format attribute.
This can be overcome by adding "-D__printf__=__gnu_printf__" to
CPPFLAGS, but it would be inappropriate for libsigrok to define
this on its own.

9 years agolog: Bring back the "sr: " default log prefix
Daniel Elstner [Sun, 13 Sep 2015 10:32:03 +0000 (12:32 +0200)]
log: Bring back the "sr: " default log prefix

This got lost accidentally with the removal of the logdomain API.

9 years agolog: Remove sr_log_logdomain_{get,set} from the API
Daniel Elstner [Sun, 13 Sep 2015 09:58:44 +0000 (11:58 +0200)]
log: Remove sr_log_logdomain_{get,set} from the API

The confusingly named sr_log_logdomain_set() simply set a global
string prefixed to the log message by the default log callback.
This is pretty much useless, misleadingly named, and not used by
either sigrok-cli or PulseView.

9 years agoFix log varargs bugs indicated by -Wformat
Daniel Elstner [Sun, 13 Sep 2015 00:29:38 +0000 (02:29 +0200)]
Fix log varargs bugs indicated by -Wformat

A few of these were pretty serious, like missing arguments,
passing integers where a string was expected, and so on.
In some places, change the types used by the code rather than
just the format strings.

9 years agolog: Output timestamps at level SR_LOG_DBG too
Daniel Elstner [Sat, 12 Sep 2015 22:58:36 +0000 (00:58 +0200)]
log: Output timestamps at level SR_LOG_DBG too

SR_LOG_DBG and above are targeted at developers, so it makes sense
to extend timestamp output to that. Also sanitize the calculation
of the timestamp components a bit.

9 years agolog: Use generalized sr_log() to implement logging helpers
Daniel Elstner [Sat, 12 Sep 2015 20:41:22 +0000 (22:41 +0200)]
log: Use generalized sr_log() to implement logging helpers

Get rid of the specicialized sr_err(), sr_warn(), etc. functions.
Instead, define the logging helper macros in terms of sr_log(),
and remove the sr_log() helper macro so that no function is hidden
by a macro anymore.

Decorate sr_log() with G_GNUC_PRINTF to detect varargs errors. This
unearthed a gazillion warnings all over the place which will have
to be fixed.

Also convert the helper macros to ISO C99 __VA_ARGS__ style instead
of relying on a GNU C extension. Paste the log prefix directly into
the format string to make this work.

9 years agosession: Return immediately if there are no event sources
Daniel Elstner [Fri, 11 Sep 2015 17:15:55 +0000 (19:15 +0200)]
session: Return immediately if there are no event sources

Some drivers, such as zeroplus-logic-cube, run everything they do
right away in dev_acquisition_start(), never installing any event
sources. Handle that evilness by returning from sr_session_run()
immediately if there are no sources.

9 years agosession: Port to GLib main loop
Daniel Elstner [Thu, 10 Sep 2015 07:46:45 +0000 (09:46 +0200)]
session: Port to GLib main loop

Replace the custom session main loop with the GLib main loop.
This is phase one of the port, which leaves the session and
driver APIs unchanged while replacing the internals.

9 years agoserial: On Windows, include <windows.h> for HANDLE
Daniel Elstner [Thu, 10 Sep 2015 18:41:55 +0000 (20:41 +0200)]
serial: On Windows, include <windows.h> for HANDLE

9 years agosigrok.m4: Remove SR_PROG_MAKE_NO_PRINT_DIRECTORY
Daniel Elstner [Thu, 10 Sep 2015 17:38:10 +0000 (19:38 +0200)]
sigrok.m4: Remove SR_PROG_MAKE_NO_PRINT_DIRECTORY

9 years agoBuild: Use GNUMAKEFLAGS for --no-print-directory
Daniel Elstner [Thu, 10 Sep 2015 17:35:17 +0000 (19:35 +0200)]
Build: Use GNUMAKEFLAGS for --no-print-directory

9 years agohung-chang-dso-2100: Enable only if libieee1284 is available
Daniel Elstner [Thu, 10 Sep 2015 16:36:30 +0000 (18:36 +0200)]
hung-chang-dso-2100: Enable only if libieee1284 is available

9 years agohung-chang-dso-2100: Add driver
Daniel Glöckner [Mon, 7 Sep 2015 00:18:14 +0000 (02:18 +0200)]
hung-chang-dso-2100: Add driver

The Hung-Chang DSO-2100 is a parallel port PC oscilloscope sold back
in 1999 under brand names like Protek and Voltcraft.

This inital version of the driver has the following limitations:

 - Hardcoded calibration values. All parameters are set to 50%.
 - No support for auto triggering
 - No support for TV sync trigger modes
 - No support for the "scroll acquisition" mode

In scroll acquisition mode the device behaves more like a multimeter
and reports the current voltage of a probe on request. While in this
mode the sample rate is limited by the parallel port interface, it is
the only way to capture both channels at the same time (well, sort of).

Calibration would need auto triggering. The calibration values are very
temperature dependent and the device takes literally hours to reach its
final temperature. Every vdiv setting needs its own set of calibration
values. Without hardware modifications, the calibration settings wear
of in less than a second while waiting for a trigger because the
capacitors storing those values are not recharged in state 0x21.

9 years agohung-chang-dso-2100: Initial driver skeleton.
Daniel Glöckner [Mon, 7 Sep 2015 00:18:13 +0000 (02:18 +0200)]
hung-chang-dso-2100: Initial driver skeleton.

9 years agoportability: Use g_strerror() in favor of strerror().
Uwe Hermann [Wed, 9 Sep 2015 07:16:58 +0000 (09:16 +0200)]
portability: Use g_strerror() in favor of strerror().

9 years agoportability: Use g_ascii_strcasecmp() in favor of strcasecmp().
Uwe Hermann [Wed, 9 Sep 2015 07:17:59 +0000 (09:17 +0200)]
portability: Use g_ascii_strcasecmp() in favor of strcasecmp().

This is more portable and guaranteed locale-independent.

9 years agoMakefile.am: Use @ORDER@ instead of |.
Uwe Hermann [Wed, 9 Sep 2015 06:21:01 +0000 (08:21 +0200)]
Makefile.am: Use @ORDER@ instead of |.

This is set to | (or left empty) by SR_PROG_MAKE_ORDER_ONLY for
portability reasons, since not all Make implementations support
order-only prerequisites.

9 years agoDon't rebuild Python or Java bindings unless C++ interface changes.
Martin Ling [Mon, 7 Sep 2015 11:32:05 +0000 (12:32 +0100)]
Don't rebuild Python or Java bindings unless C++ interface changes.