Commit Graph

1613 Commits

Author SHA1 Message Date
Uwe Hermann 86a1571135 dreamsourcelab-dslogic: Fix incorrect default threshold setting.
This was leading to an invalid threshold config value and indirectly
to frontend issues.

Slightly modified patch from James Churchill <pelrun@gmail.com>, thanks!
2017-09-14 11:15:06 +02:00
Frank Stettner 57837aeda5 conrad-digi-35-cpu: Fix key names for setting voltage and current 2017-09-13 14:11:07 +02:00
Frank Stettner fcc73918b0 serial-dmm: Add Metex M-3860M 2017-09-13 14:03:40 +02:00
Frank Stettner eea576077b conrad-digi-35-cpu: Add and use missing dev_context structure 2017-09-13 14:03:40 +02:00
Uwe Hermann bc98407b8f dreamsourcelab-dslogic: config_list: Handle SR_CONF_TRIGGER_MATCH.
This fixes bug #1032.
2017-09-13 13:05:42 +02:00
Uwe Hermann 7bf81cb7a9 chronovu-la: Silence overly verbose log message.
This triggered all kinds of unrelated / confusing log messages
for unrelated hardware devices, e.g.:

  sr: [00:00.613080] chronovu-la: Unknown iProduct string 'USB-based Instrument'.
  sr: [00:00.614374] chronovu-la: Unknown iProduct string 'GL3220      '.
  sr: [00:00.614907] chronovu-la: Unknown iProduct string 'USB 3.0 HUB      '.
  sr: [00:00.615558] chronovu-la: Unknown iProduct string 'USB 2.0 HUB      '.
  sr: [00:00.619846] chronovu-la: Unknown iProduct string 'Bluetooth USB Host Controller'.
  sr: [00:00.620411] chronovu-la: Unknown iProduct string 'USB 3.0 HUB      '.
  sr: [00:00.624293] chronovu-la: Unknown iProduct string 'UAC1 DAC'.
  sr: [00:00.627849] chronovu-la: Unknown iProduct string 'BRCM20702 Hub'.
  sr: [00:00.628640] chronovu-la: Unknown iProduct string 'USB 2.0 HUB      '.
  sr: [00:00.674777] chronovu-la: Unknown iProduct string 'USB2223'.
  sr: [00:00.675034] chronovu-la: Unknown iProduct string ''.
  sr: [00:00.675180] chronovu-la: Unknown iProduct string ''.
  sr: [00:00.675205] hwdriver: Scan found 0 devices (chronovu-la).
2017-09-12 22:15:32 +02:00
Marcus Comstedt 393375e1fe drivers: Remove dependency on linker implementation specific behaviour 2017-09-02 17:06:37 +02:00
turboaffe 9520fd4134 manson-hcs-3xxx: enabled output guaranteed write 2017-08-19 19:21:54 +02:00
turboaffe 6508294dca manson-hcs-3xxx: added new name for 3304, adjustment to new manson fw 2017-08-19 19:21:54 +02:00
Gerhard Sittig 5753d2e84b brymen-bm86x: support channel selection (enable/disable channels)
The previous implementation unconditionally submitted analog data
whenever values could get extracted out of received serial packets.
This commit checks the channels' enabled state before submission. Care
is taken to obey the user's acquisition limits, exclusively counting
submitted not received values.
2017-08-19 19:21:54 +02:00
Gerhard Sittig 503519b70a lsr/es51919: support channel selection (enable/disable P1/P2)
Upon reception of serial data from the ES51919 LCR chipset, the data for
channels P1 and P2 was extracted from the packet, and unconditionally got
sent to the sigrok session.

Do check the channels' enabled state before submission. This fixes for
serial-lcr what recently got reported for a Brymen DMM. Tested with

  $ sigrok-cli -d peaktech-2170:conn=/dev/ttyUSB0 --channels P2

and other --channels specifications.
2017-08-19 19:21:53 +02:00
Gerhard Sittig 12788e7e40 lcr/es51919: clean but don't free dev context in cleanup callback
The es51919_serial_clean() routine is called by std_dev_clear_with_callback().
Common code unconditionally frees the 'priv' part. The cleanup callback only
shall release descending resources which are local to the callee and opaque
to the caller.

This fixes a double free error. Tested with PeakTech 2170.

  $ sigrok-cli -d peaktech-2170:conn=/dev/ttyUSB0 --show
2017-08-19 19:21:51 +02:00
Uwe Hermann 1503d4571b resource: Also check $SIGROK_FIRMWARE_DIR for firmware files.
If the SIGROK_FIRMWARE_DIR environment variable is specified, look there
first for firmware files.
2017-08-15 22:15:47 +02:00
Gerhard Sittig dde0175d19 asix-sigma: download sample data upon user initiated stop, too
When the acquisition was stopped before a configured limit was reached,
no sample data was retrieved. This is because the api.c stop routine did
unregister the receive callback.

Pass the stop request to the receive routine instead when stop is called
while the acquisition is still running. Have sample data downloaded very
much like it's done for reached limits, and existing logic will run the
stop routine again after state was advanced to "idle".

Extend the 'state' tracking while we are here, mark sample download as
well (that was omitted in the previous implementation). Though the
omission was non-fatal. Move the release of 'dram_line' to some earlier
location (as soon as the resource is not needed any longer), before some
rather complex calls to other routines will execute.

Reported-By: Michael Kaplan <M.KAPLAN@evva.com>
2017-08-11 18:52:23 +02:00
Uwe Hermann 379e95c587 drivers: Use serial_write_blocking() everywhere.
This fixes bug #962.
2017-08-07 14:22:52 +02:00
Uwe Hermann b5df922e4f sr_voltage_string(): Add a space before the unit.
This makes the output consistent with most of the other functions
in libsigrok.
2017-08-06 19:45:45 +02:00
Uwe Hermann d2391b5453 drivers: Use g_strdup_printf() where possible. 2017-08-06 19:38:31 +02:00
Uwe Hermann 8ebad34370 drivers: Random whitespace fixes. 2017-08-06 17:31:46 +02:00
Uwe Hermann db85496ed1 drivers: Simplify some more trigger slope settings. 2017-08-06 17:31:46 +02:00
Uwe Hermann 3782e57129 drivers: Reduce unnecessarily high indentation in some places. 2017-08-06 17:31:46 +02:00
Uwe Hermann 612336970d drivers: Consistently use the same method to check for !cg. 2017-08-06 17:31:46 +02:00
Uwe Hermann fcd6a8bdf1 drivers: Factor out std_cg_idx(). 2017-08-06 17:31:46 +02:00
Uwe Hermann d1ac53ccd5 drivers: Start counting at 0 for some loops. 2017-08-06 17:31:46 +02:00
Uwe Hermann b3fd09937c drivers: Use NUM_CHANNELS in favor of hardcoded values. 2017-08-06 17:31:46 +02:00
Uwe Hermann bd633efa32 drivers: Use std_*idx*() helpers in some more places. 2017-08-03 16:35:19 +02:00
Uwe Hermann 76f0fa5dfb lecroy-xstream: Use array-based approach for timebases/vdivs.
This makes the driver more consistent with the rest of the code-base
and allows us to use the new array helpers in a few more places.
2017-08-03 16:35:19 +02:00
Uwe Hermann 692716f5d1 drivers: Use array-based approach in some places.
This allows us to use the new array helpers in a few more places.
2017-08-03 16:35:19 +02:00
Uwe Hermann 373e92a491 drivers: Consistently name SCPI helper functions 'probe_device'. 2017-07-31 16:23:32 +02:00
Uwe Hermann 21fe5dba36 drivers: Drop some unneeded voltage_/volt_ prefixes. 2017-07-31 16:23:32 +02:00
Uwe Hermann e124cf9b7a drivers: Drop some unneeded _names suffixes. 2017-07-31 16:23:32 +02:00
Uwe Hermann efad7cccec drivers: SR_CONF_CAPTURE_RATIO fixes.
Move the check for the capture ratio being 0..100 into the wrappers,
drop unneeded helper functions, fix incorrect variable types, minor
other consistency fixes.
2017-07-31 16:23:32 +02:00
Uwe Hermann 758906aa71 drivers: Remove some unneeded 'ret' variables. 2017-07-31 16:23:31 +02:00
Uwe Hermann 50ccb36f20 drivers: Random SR_CONF_LIMIT_* cleanups.
Drop unneeded variables and checks (performed by the wrappers already).
2017-07-31 16:23:31 +02:00
Uwe Hermann 697fb6ddfc drivers: Factor out std_*_idx*(). 2017-07-31 16:23:31 +02:00
Uwe Hermann 94e64a0b89 drivers: Replace struct voltage_threshold with an array.
This makes the code-base more consistent and will allow for wider usage
of upcoming array helper functions.
2017-07-31 16:23:31 +02:00
Uwe Hermann 87dc541027 drivers: Move SR_ERR_CHANNEL_GROUP log messages to wrappers. 2017-07-31 16:23:31 +02:00
Uwe Hermann 00ed77f27c drivers/input: Remove some hardcoded values. 2017-07-31 16:23:31 +02:00
Uwe Hermann 95c1fe62f7 drivers: Use g_variant_new_printf() where possible. 2017-07-31 16:23:31 +02:00
Uwe Hermann 9fb9afb573 drivers: Factor out std_gvar_thresholds(). 2017-07-31 16:23:31 +02:00
Uwe Hermann 43995cda36 drivers: Factor out std_gvar_tuple_double(). 2017-07-31 16:23:31 +02:00
Uwe Hermann a162eeb2e8 drivers: Factor out std_gvar_tuple_u64(). 2017-07-31 16:23:31 +02:00
Uwe Hermann dd7a72ea69 drivers: Consistently use same indentation for config_*() API calls. 2017-07-31 16:23:31 +02:00
Uwe Hermann 58ffcf9712 std_gvar_tuple_array(): Change to allow for more ARRAY_AND_SIZE usage.
Thanks to Marcus Comstedt <marcus@mc.pp.se> for the hint!
2017-07-21 19:04:34 +02:00
Uwe Hermann 8dacbcf68f drivers: Consistently use the exact driver name as LOG_PREFIX. 2017-07-21 18:46:27 +02:00
Uwe Hermann f272d7ddc0 drivers: Consistently make LOG_PREFIX the first item after #includes. 2017-07-21 18:46:27 +02:00
Uwe Hermann b15ff1c92a drivers: Eliminate some unnecessary vendor/model #defines.
Most drivers use the vendor/model strings directly already; make all
of them do that consistently.
2017-07-21 18:46:26 +02:00
Uwe Hermann f8195cb2da drivers: Shorten some unnecessarily long arrays. 2017-07-21 17:06:40 +02:00
Uwe Hermann 76d10d1324 drivers: Consistently use the name trigger_matches[] everywhere. 2017-07-21 17:06:40 +02:00
Uwe Hermann 9e411f4be8 rigol-ds: config_set: Move error printing to wrapper. 2017-07-21 17:06:40 +02:00
Uwe Hermann 0f8bee7162 rigol-ds: Update a code comment. 2017-07-21 17:06:40 +02:00
Uwe Hermann 396cdca0c3 rigol-ds: Drop two unneeded #defines. 2017-07-21 17:06:40 +02:00
Uwe Hermann 53012da658 drivers: Use ARRAY_AND_SIZE where possible. 2017-07-21 17:06:40 +02:00
Uwe Hermann 105df67463 drivers: Factor out std_gvar_array_*(). 2017-07-21 16:54:05 +02:00
Uwe Hermann 7bc3cfe6ff drivers: Factor out std_gvar_min_max_step_thresholds(). 2017-07-21 16:54:05 +02:00
Uwe Hermann bcee129962 scpi-pps: Change some floats to doubles.
This makes the code more consistent with the rest of the code-base
and also allows std_gvar_min_max_step_array() to work here.

Without this change:

  src/hardware/scpi-pps/api.c: In function ‘config_list’:
  src/hardware/scpi-pps/api.c:570:40: warning: passing argument 1 of ‘std_gvar_min_max_step_array’ from incompatible pointer type [-Wincompatible-pointer-types]
      *data = std_gvar_min_max_step_array(ch_spec->voltage);
                                          ^~~~~~~
  In file included from src/scpi.h:30:0,
                   from src/hardware/scpi-pps/api.c:23:
  src/libsigrok-internal.h:964:19: note: expected ‘const double *’ but argument is of type ‘const float *’
   SR_PRIV GVariant *std_gvar_min_max_step_array(const double a[3]);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/hardware/scpi-pps/api.c:573:40: warning: passing argument 1 of ‘std_gvar_min_max_step_array’ from incompatible pointer type [-Wincompatible-pointer-types]
      *data = std_gvar_min_max_step_array(ch_spec->frequency);
                                          ^~~~~~~
  In file included from src/scpi.h:30:0,
                   from src/hardware/scpi-pps/api.c:23:
  src/libsigrok-internal.h:964:19: note: expected ‘const double *’ but argument is of type ‘const float *’
   SR_PRIV GVariant *std_gvar_min_max_step_array(const double a[3]);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/hardware/scpi-pps/api.c:576:40: warning: passing argument 1 of ‘std_gvar_min_max_step_array’ from incompatible pointer type [-Wincompatible-pointer-types]
      *data = std_gvar_min_max_step_array(ch_spec->current);
                                          ^~~~~~~
  In file included from src/scpi.h:30:0,
                   from src/hardware/scpi-pps/api.c:23:
  src/libsigrok-internal.h:964:19: note: expected ‘const double *’ but argument is of type ‘const float *’
   SR_PRIV GVariant *std_gvar_min_max_step_array(const double a[3]);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
2017-07-21 16:49:01 +02:00
Uwe Hermann 54d471f498 drivers: Factor out std_gvar_min_max_step{,_array}(). 2017-07-21 16:49:01 +02:00
Uwe Hermann 463160cbca drivers: Factor out std_gvar_samplerates{,_steps}(). 2017-07-21 16:49:01 +02:00
Uwe Hermann db944f1622 drivers: Factor out std_gvar_tuple_{array,rational}(). 2017-07-21 16:40:15 +02:00
Uwe Hermann 6b82c3e57a drivers: Consistently name per-cg options 'devopts_cg_*'. 2017-07-21 15:45:03 +02:00
Uwe Hermann 4b25cbffa1 drivers: Drop some unnecessary prefixes. 2017-07-21 15:45:03 +02:00
Uwe Hermann ca314e060f drivers: Drop unneeded or duplicate comments.
Drop various comments which are not really needed, too verbose, document
obvious things, are duplicated across all drivers, or simply incorrect.
2017-07-21 15:23:56 +02:00
Uwe Hermann c8e789fa0c baylibre-acme: Add SR_CONF_POWERMETER key. 2017-07-19 15:40:41 +02:00
Uwe Hermann 31bdc10ec2 Add SR_CONF_POWERMETER. 2017-07-19 15:40:41 +02:00
Uwe Hermann b258c09f26 testo: Drop unneeded sdi->driver assignment.
This is already done by std_scan_complete().
2017-07-19 15:39:23 +02:00
Uwe Hermann 05199c0ac9 drivers: Provide proper drvopts.
The device class config keys should be in drvopts (not devopts).
2017-07-19 15:39:23 +02:00
Uwe Hermann 55fb76b348 drivers: Always use same scanopts/drvopts/devopts/devopts_cg* order. 2017-07-19 15:11:01 +02:00
Uwe Hermann e66d1892d0 drivers: Add and use STD_CONFIG_LIST().
This ensures consistent handling of the SR_CONF_SCAN_OPTIONS and
SR_CONF_DEVICE_OPTIONS (with sdi NULL or non-NULL) config keys
and also reduces copy-pasted boilerplate in the drivers a bit.

This function does not handle channel-group specific items, that's
very driver-specific and thus left to the individual drivers.

Also move some generic checks and error messages from the drivers into
the sr_config_list() wrapper.
2017-07-19 15:11:01 +02:00
Uwe Hermann 13d2ac54f4 saleae-logic-pro: Use sr_dev_acquisition_stop() wrapper. 2017-07-17 11:26:12 +02:00
Jan Luebbe f2b8a31be5 saleae-logic-pro: Detect and abort on capture errors
The HW simply stops sending data on overflows, so if we receive no data
in one second, we abort the acquisition. We also need to allocate more
buffers to support higher sample rates.
2017-07-16 19:28:58 +02:00
Jan Luebbe da39089014 saleae-logic-pro: Implement bitstream upload and initialization
The control packets can be longer than 256 bytes, so change the
low-level functions accordingly.
2017-07-16 19:25:46 +02:00
Jan Luebbe f1aca068c7 saleae-logic-pro: Implement FX3 firmware upload 2017-07-16 19:24:27 +02:00
Uwe Hermann a9010323dd drivers: Remove some uneeded 'ret' variables. 2017-07-13 11:59:11 +02:00
Uwe Hermann b4fde527b6 session_driver: Use std_cleanup(). 2017-07-13 11:59:11 +02:00
Uwe Hermann 029b20425b session_driver: Don't open-code std_dev_clear(). 2017-07-13 11:59:11 +02:00
Uwe Hermann 3553451f1e clear_helper(): Use a cast to shorten all implementations. 2017-07-13 11:59:11 +02:00
Uwe Hermann 8bf18daabb sr_dev_clear(): Always free sdi->priv (devc).
Until now, clear_helper() callbacks for std_dev_clear_with_callback()
were expected to g_free(devc), but not all of them did that.

Have std_dev_clear_with_callback() unconditionally g_free(sdi->priv)
(i.e., devc), regardless of whether a clear_helper() callback was
provided or not. It was doing g_free(sdi->priv) when no callback
was provided already anyway.

This makes the individual drivers' clear_helper() implementations
shorter and prevents errors such as missing g_free(devc) calls.

This works, because all drivers either call std_dev_clear_with_callback()
directly, or indirectly via std_dev_clear().

This also allows us to remove some no-longer needed dev_clear()
and clear_helper() implementations that only did g_free(devc)
in favor of std_dev_clear().
2017-07-13 11:59:11 +02:00
Uwe Hermann 53279f13e4 dev_clear(): Consistently name callback 'clear_helper()'. 2017-07-13 11:59:11 +02:00
Uwe Hermann f778bf02ea std: Add and use std_dev_clear() where possible.
Be explicit and consistent in the drivers about which dev_clear function
will be called to avoid confusion and inconsistencies.

Drop some open-coded implementations of std_dev_clear().
2017-07-13 11:59:11 +02:00
Uwe Hermann 6e43c3d531 std: Rename std_dev_clear() to std_dev_clear_with_callback(). 2017-07-13 11:59:11 +02:00
Uwe Hermann 4d67b9d9dc std: Factor out some API call dummy implementations. 2017-07-13 11:59:11 +02:00
Uwe Hermann 91057d2fc2 Various log message cleanups.
Drop unneeded log messages, add some others that might be useful,
document which ones we're intentionally not emitting.

Don't log "$operation successful" type of messages in most cases,
that's too verbose; logging failures only is sufficient there.

baylibre-acme: Don't log "No such file or directory" messages during scan,
this triggers on all kinds of unrelated devices (e.g. "AMDGPU i2c bit
bus 0x91" in this case):

  sr: [...] baylibre-acme: Name for probe 1 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0040/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 2 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0041/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 3 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0044/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 4 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0045/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 5 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0042/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 5 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-004c/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 6 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0043/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 6 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0049/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 7 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0046/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 7 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-004f/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 8 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0047/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 8 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-004b/name”: No such file or directory
2017-07-13 11:59:11 +02:00
Uwe Hermann 12852b0337 std: Simplifications, random fixes, Doxygen cosmetics.
- sr_dev_clear(): Don't try to clear uninitialized drivers (the same
   check was previously done in std_dev_clear()).

 - Document some places where we intentionally don't emit log messages.

 - std: Various Doxygen fixes and updates.

 - std: Add some more sanity-checks on input parameters.
2017-07-13 11:59:11 +02:00
Uwe Hermann e374786753 session_file: Start out with SR_ST_INACTIVE like all drivers. 2017-07-08 14:25:23 +02:00
Uwe Hermann f1ba6b4b2c sr_dev_close(): Set status to SR_ST_INACTIVE.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-08 14:25:23 +02:00
Uwe Hermann 7e46362338 sr_dev_open(): Set status to SR_ST_ACTIVE upon success.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-08 14:25:23 +02:00
Uwe Hermann 6402c37916 sr_dev_open(): Factor out SR_ST_ACTIVE check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-08 14:25:23 +02:00
Uwe Hermann 093e1cba6b sr_dev_close(): Factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-07 21:51:25 +02:00
Uwe Hermann 89ab9fc39c sr_config_commit(): Factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-07 21:51:22 +02:00
Uwe Hermann c3cd66a00c sr_config_set(): Factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-07 21:51:19 +02:00
Uwe Hermann f670835f1f Add sr_dev_acquisition_start(), factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-07 21:51:16 +02:00
Uwe Hermann d2f7c417fd Add sr_dev_acquisition_stop(), factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-07 21:51:10 +02:00
Soeren Apel 6ad2fbaad2 Introduce A2L methods
The memory allocation for sr_datafeed_logic is broken, the memory
will never be freed. #994 is used to handle this issue.
2017-07-06 00:16:24 +02:00
Richard f97c159536 serial-dmm: Add support for the SparkFun 70C multimeter. 2017-07-04 12:10:29 +02:00
Richard b0e1a1ecc4 Mark some arrays as const 2017-07-04 12:10:29 +02:00
Uwe Hermann fbbafc6909 saleae-logic-pro: Fix two compiler warnings.
src/hardware/saleae-logic-pro/protocol.c:389:12: warning: 'set_led' defined but not used [-Wunused-function]
   static int set_led(const struct sr_dev_inst *sdi, uint8_t r, uint8_t g, uint8_t b)
              ^
    CC       src/hardware/saleae-logic-pro/api.lo
  src/hardware/saleae-logic-pro/api.c: In function 'dev_acquisition_handle':
  src/hardware/saleae-logic-pro/api.c:332:9: warning: missing initializer for field 'tv_sec' of 'struct timeval' [-Wmissing-field-initializers]
    struct timeval tv = {};
           ^
  In file included from /usr/include/x86_64-linux-gnu/sys/time.h:27:0,
                   from include/libsigrok/libsigrok.h:24,
                   from src/hardware/saleae-logic-pro/protocol.h:25,
                   from src/hardware/saleae-logic-pro/api.c:23:
  /usr/include/x86_64-linux-gnu/bits/time.h:32:14: note: 'tv_sec' declared here
       __time_t tv_sec;  /* Seconds.  */
                ^
2017-07-03 11:57:02 +02:00
Uwe Hermann bb0c52719e saleae-logic-pro: Random minor cosmetics/consistency fixes. 2017-06-28 12:35:05 +02:00
Uwe Hermann b6189f7c8a saleae-logic-pro: Driver name consistency fixes. 2017-06-28 12:35:05 +02:00
Jan Luebbe ca7d19b5c8 saleae-logicpro: Initial implementation.
The driver currently support only digital channels and a limited set of
sample rates.
2017-06-28 12:09:32 +02:00
Jan Luebbe a8e913c452 saleae-logicpro: Initial driver skeleton. 2017-06-28 12:09:32 +02:00
Gerhard Sittig 1f4f98e05c asix-sigma: Only open the USB device once (fails with newer libftdi)
The asix-sigma driver was reported to fail in combination with newer
libftdi versions, because the firmware upload routine opened again an
already opened device, and then failed to claim the interface. Which was
not fatal before with previous libftdi versions.

Remove the redundant open call. Remove the local FTDI context variable,
which brings the firmware upload routine in line with all other calls
that communicate to the USB device.

This fixes bug #471.

Suggested-By: Marian Cingel <cingel.marian@gmail.com>
2017-06-27 13:28:25 +02:00
Gerhard Sittig ac9534f48a asix-sigma: Only change number of channels after successful firmware upload
The asix-sigma driver supports different samplerates, which will involve
different firmware images and will affect the number of available logic
channels as well as their memory layout in downloaded sample data.

Make sure to only store the configuration's parameters after the setup
of that configuration has successfully completed, and make sure to store
a consistent set of parameters. Specifically don't change the number of
channels when the firmware upload failed.

This fixes part of bug #471.

Suggested-By: Marian Cingel <cingel.marian@gmail.com>
2017-06-27 13:28:25 +02:00
Gerhard Sittig 7bcf21683e asix-sigma: Propagate errors from firmware upload
The firmware upload code paths in the asix-sigma driver used to return
either the SR_OK code, or the magic number 0 for error conditions. Which
happens to be identical and cannot be told apart by callers.

Provide proper SR_ERR return codes for error conditions, such that
callers can tell whether the firmware upload succeeded.

This fixes part of bug #471.

Suggested-By: Marian Cingel <cingel.marian@gmail.com>
2017-06-27 13:28:25 +02:00
Gerhard Sittig ad466f86cc strutil: Assume bool is true when no value is specified
Adjust the string to boolean conversion for an edge case. Accept empty
text (either NULL or empty strings) to mean true instead of false.

This behaviour is more useful from the user's point of view, when the
option's name alone will enable a feature, and an explicit "option=yes"
specification is not strictly necessary. All calling applications in
mainline already implemented this semantics.
2017-06-25 20:42:21 +02:00
Uwe Hermann 276d7b18bb hung-chang-dso-2100: Fix a gcc 7 compiler warning.
../src/hardware/hung-chang-dso-2100/api.c: In function ‘config_commit’:
  ../src/hardware/hung-chang-dso-2100/api.c:562:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
     state = 0x01;
     ~~~~~~^~~~~~
  ../src/hardware/hung-chang-dso-2100/api.c:563:2: note: here
    default:
    ^~~~~~~
  ../src/hardware/hung-chang-dso-2100/api.c:565:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
     if (ret != SR_OK)
        ^
  ../src/hardware/hung-chang-dso-2100/api.c:567:2: note: here
    case 0x01:
    ^~~~
2017-06-24 18:56:53 +02:00
Uwe Hermann 317c97bebb output/csv: Fix a gcc 7 compiler warning.
../src/output/csv.c: In function ‘receive’:
  ../src/output/csv.c:580:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
     *out = g_string_new(ctx->frame);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
  ../src/output/csv.c:582:2: note: here
    case SR_DF_END:
    ^~~~
2017-06-24 18:29:26 +02:00
Uwe Hermann 1a14a62349 input/wav: Fix incorrect memset() call.
../src/input/wav.c: In function ‘send_chunk’:
  ../src/input/wav.c:200:2: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
    memset(fdata, 0, CHUNK_SIZE);
    ^~~~~~
2017-06-24 17:26:02 +02:00
Uwe Hermann 41b8fca1a1 input/raw_analog: Fix gcc 7 compiler warnings.
../src/input/raw_analog.c: In function ‘init’:
  ../src/input/raw_analog.c:133:31: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 6 [-Wformat-truncation=]
     snprintf(channelname, 8, "CH%d", i + 1);
                                 ^~
  ../src/input/raw_analog.c:133:28: note: directive argument in the range [1, 2147483647]
     snprintf(channelname, 8, "CH%d", i + 1);
                              ^~~~~~
  ../src/input/raw_analog.c:133:3: note: ‘snprintf’ output between 4 and 13 bytes into a destination of size 8
     snprintf(channelname, 8, "CH%d", i + 1);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2017-06-24 17:23:56 +02:00
Gerhard Sittig 4a465510fb demo: Mask out logic data for disabled channels in datafeed packets
The previous implementation used to provide datafeed packets which
contain logic data in positions that correspond to disabled channels.

Do mask out logic data of disabled channels in the memory image before
it is sent to the session's datafeed. This implementation works fine for
those situations where either all logic channels are enabled (default
configuration) or when only the upper channels get disabled (which can
be considered a typical use case).

For those configurations where enabled channels follow disabled channels
(i.e. setups with gaps in the sequence of enabled channels) behaviour
will be unexpected: Neither is the mask adjusted to contain gaps, nor
will enabled channels get mapped to result in a dense representation.
The respective code paths are marked with TODO comments.

Add a comment to discuss a non-obvious generator call for analog data in
the acquisition start routine, while we are here.
2017-06-24 16:33:50 +02:00
Gerhard Sittig 1b7b72d49e demo: Skip generating data when all channels in a group are disabled
The generator logic determines how many samples per group (analog and
logic) need to get produced, then keeps iterating until each group has
reached the specified count. Different groups can generate different
numbers of samples per iteration, they have their own stride.

It's essential to check whether all channels in a group are disabled, to
then completely skip the respective half of the generation loop. Without
this check, the group would be expected to generate data but it won't,
which results in an endless loop. This was observed with analog channels.

There was another issue with logic channels. Unexpected logic data was
seen in the output although neither logic channel was selected.

This commit fixes bug #923.
2017-06-23 19:33:24 +02:00
Gerhard Sittig 01f2adb07a demo: Don't generate analog output data for disabled channels
Skip the emission of session datafeed packets for disabled analog
channels.

Implementation detail: Allow for quick lookup of the channel that is
associated with an analog generator, as the data generation routines
only pass generator references in later calls.

This fixes part of bug #923 (which initially is about unexpected
logic data while analog channels were affected in similar ways).
2017-06-23 19:33:24 +02:00
Gerhard Sittig d114464551 demo: Only send average result data when averaging is active
After the requested number of samples was sent, another session df
packet was emitted with one sample for the analog channels, which
contained the most recent result of averaging. Make this emission
depend on the "averaging requested?" flag.

This fixes bug #930.
2017-06-23 19:33:24 +02:00
Gerhard Sittig d91d0b1250 demo: Unbreak execution with all analog channels disabled
The 'demo' driver supports scan options to adjust the number of
supported channels, and runtime control for the enabled state of
channels.

Starting with zero analog channels created (scan option) resulted in a
runtime assertion. Creating but disabling analog channels (GUI checkbox,
CLI option) resulted in unexpected output for disabled channels.

Move the creation of a hash table out of the conditional loop that
iterates over created analog channels. Which results in the table's
always being valid, and iteration during data acquisition yields no
analog output as is expected.

This fixes bug #625.
2017-06-23 19:33:24 +02:00
Gerhard Sittig f1c79a6a35 demo: Drop previous "default enabled" logic (experiment remainder)
A previous implementation of the demo driver supported the creation of
larger channel counts yet only enabling part of them by default. This
was kind of pointless, I just was not aware of the available scan
options.

Drop the "enabled channels" limitation, enable all channels that get
created (like the implementation before the experiment did), and create
as many channels as was compiled in by default or later got specified
by scan options.
2017-06-23 19:33:24 +02:00
Uwe Hermann ecadb11845 dreamsourcelab-dslogic: Drop an assert(). 2017-06-21 18:02:50 +02:00
Uwe Hermann 4984ca28f7 dreamsourcelab-dslogic: Don't check for USB manufacturer/product.
Before firmware upload some models (e.g. the original DSLogic or the
DSLogic Pro) don't have any USB manufacturer or product strings set, so
they wouldn't be detected.
2017-06-21 18:02:50 +02:00
Uwe Hermann 7962b129c3 dreamsourcelab-dslogic: Drop an unneeded dslogic_ prefix. 2017-06-20 23:33:29 +02:00
Uwe Hermann 44b46d7036 dreamsourcelab-dslogic: Naming and other consistency fixes. 2017-06-20 23:33:29 +02:00
Joel Holdsworth f74485b608 dslogic: Recast samples into sigrok-compatible sample words 2017-06-20 00:18:16 +02:00
Joel Holdsworth 03a0002ed4 dslogic: Fixed buffer size calculation 2017-06-20 00:18:16 +02:00
Joel Holdsworth 6dfa2c39bf dslogic: Factored out enabled_channel_count, enabled_channel_mask 2017-06-20 00:18:16 +02:00
Joel Holdsworth 5e23d42f07 dslogic: Don't leak the trigger transfers array 2017-06-20 00:18:16 +02:00
Joel Holdsworth 5e7e327ac8 dslogic: Removed trigger_fired option 2017-06-20 00:18:16 +02:00
Joel Holdsworth 658caaf0d1 dslogic: Merged trigger_request into dslogic_acquisition_start 2017-06-20 00:18:16 +02:00
Joel Holdsworth 4bd770f56b dslogic: Moved all protocol handling to protocol.c
Previously the USB communication code was split between api.ci,
dslogic.c and protocol.c, with protocol internals split between
both. This patch puts all the protocol handling code into one
source file reducing the number of internal interfaces and making
the code more readable.
2017-06-20 00:18:16 +02:00
Joel Holdsworth b0acb693f9 fx2lafw: Moved all protocol handling to protocol.c
Previously the USB communication code was split between api.c
and protocol.c, with protocol internals split between both. This
patch puts all the protocol handling code into one source file
reducing the number of internal interfaces and making the code
more readable.
2017-06-20 00:18:16 +02:00
Joel Holdsworth 2f3cf5c21d dslogic: Fixed FPGA setting code 2017-06-20 00:18:16 +02:00
Joel Holdsworth 731fcfb456 dslogic: Declare memory depths 2017-06-20 00:18:16 +02:00
Joel Holdsworth 1ee7074616 dslogic: Fixed voltage selection 2017-06-20 00:18:16 +02:00
Joel Holdsworth 3c749da174 dslogic: Updated matching of device with loaded firmware 2017-06-20 00:18:16 +02:00
Joel Holdsworth 84f6d40a11 dslogic: Renamed D0-16 channels to 0-16 2017-06-20 00:18:16 +02:00
Joel Holdsworth 780c5e2466 dslogic: Added half and quater-mode flags 2017-06-20 00:18:16 +02:00
Joel Holdsworth 6c317a8d75 dslogic: Simplified supported_device table 2017-06-20 00:18:16 +02:00
Joel Holdsworth 3566348b92 dslogic: Refactored firmware selection into dslogic_fpga_firmware_upload 2017-06-20 00:18:16 +02:00
Joel Holdsworth adcb9951f8 fx2lafw/dslogic: Split DSLogic into a separate driver 2017-06-20 00:18:16 +02:00
Joel Holdsworth 69f7d9b4a9 usb.c: Moved in usb_match_manuf_product 2017-06-20 00:18:16 +02:00
Joel Holdsworth e40ee26b45 fx2lafw/dslogic: Updated dslogic_fpga_config structure to reflect v0.97 firmware 2017-06-20 00:18:16 +02:00
Joel Holdsworth cf398cc058 fx2lafw/dslogic: Imported FPGA config mode flags 2017-06-20 00:18:16 +02:00
Joel Holdsworth cd189a44f8 fx2lafw/dslogic: Use const buffer instead of memset 2017-06-20 00:18:16 +02:00
Joel Holdsworth c2f35321b3 fx2lafw/dslogic: Fixed dslogic_set_vth package structure 2017-06-20 00:18:16 +02:00
Joel Holdsworth ac0facf4e0 fx2lafw/dslogic: Added register address #defines 2017-06-20 00:18:16 +02:00
Joel Holdsworth 9d71f81532 fx2lafw/dslogic: Updated bRequest #defines to reflect libsigrok4DSL 2017-06-20 00:18:16 +02:00
Joel Holdsworth 9082b5ccf7 fx2lafw: Call dslogic_get_number_of_transfers into fx2lafw_get_number_of_transfers 2017-06-20 00:18:16 +02:00
Joel Holdsworth c33f32a922 fx2lafw/dslogic: Added DSLogic Plus and Basic variants 2017-06-20 00:18:16 +02:00
Uwe Hermann f200d59ee2 Various Doxygen fixes. 2017-06-12 02:44:28 +02:00
Gerhard Sittig 2355d22919 input/csv: Eliminate remaining memory leaks in error paths
When the processing of columns of text lines detected errors, the loop
was aborted and the routine was left, but allocated resources were not
freed. Fix the remaining memory leaks in the error code paths.
2017-06-09 23:21:03 +02:00
Gerhard Sittig f027208ea7 input/csv: Fixup datafeed chunk size calculation
The constant at the top of the source file is the number of samples in a
datafeed submission chunk. The previous implementation erroneously made
it the size in bytes. There is no need to round down the buffer size
according to the unit size.
2017-06-09 23:21:03 +02:00
Gerhard Sittig d05b1a8606 output/csv: Nit, remove an unused loop iteration variable
The i variable is not used in the bottom loop in gen_header(). Remove it
to not obfuscate the purpose of the iteration.
2017-06-09 23:20:36 +02:00
Gerhard Sittig cd59e6eca1 input/csv: Send larger datafeed chunks, to speedup import
The previous implementation sent one sigrok session datafeed packet per
processed CSV line. This is rather inefficient for the CSV input module,
and triggers a dramatic performance loss in the srzip output format.

Communicate up to 128K samples within one datafeed packet. This fixes
bug #695.

Factor out repeated calculation of the unit size which is derived from
the channel count. Fix a minor memory leak in an error path while we are
here. (Other memory leaks in rare error paths remain with this commit.)

Suggested-By: Elias Oenal <sigrok@eliasoenal.com>
2017-06-08 23:26:47 +02:00
Gerhard Sittig de788af410 input/csv: Update developer comment (fix for last EOL marker) 2017-06-06 23:28:15 +02:00
Gerhard Sittig 7f4c3a6224 input/csv: Accept absence of last end-of-line termination sequence
On the Windows platform it appears to be popular to _not_ terminate the
very last line in a text file. Which results in an unmet constraint in
the CSV input module and an internal exception in PulseView which aborts
program execution.

Cope with the absence of the text line termination sequence at the very
end of the input stream. Keep all other checks in place, such that only
completely received text lines get processed.

This fixes bug #635.
2017-06-06 23:28:09 +02:00