Commit Graph

4865 Commits

Author SHA1 Message Date
Uwe Hermann 2377246220 Fix various gcc 8 compiler warnings related to ARRAY_SIZE.
Example:

  In file included from src/hardware/kecheng-kc-330b/protocol.h:26,
                   from src/hardware/kecheng-kc-330b/api.c:22:
  src/hardware/kecheng-kc-330b/api.c: In function ‘config_list’:
  src/libsigrok-internal.h:51:34: warning: division ‘sizeof (void *) / sizeof (void)’ does not compute the number of array elements [-Wsizeof-pointer-div]
   #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
                                    ^
  src/libsigrok-internal.h:55:32: note: in expansion of macro ‘ARRAY_SIZE’
   #define ARRAY_AND_SIZE(a) (a), ARRAY_SIZE(a)
                                  ^~~~~~~~~~
  src/libsigrok-internal.h:964:43: note: in expansion of macro ‘ARRAY_AND_SIZE’
    std_opts_config_list(key, data, sdi, cg, ARRAY_AND_SIZE(scanopts), \
                                             ^~~~~~~~~~~~~~
  src/hardware/kecheng-kc-330b/api.c:296:10: note: in expansion of macro ‘STD_CONFIG_LIST’
     return STD_CONFIG_LIST(key, data, sdi, cg, NULL, drvopts, devopts);
            ^~~~~~~~~~~~~~~
2018-10-06 19:13:39 +02:00
Peetz0r af930bcf7b fx2lafw: Add new VID:PID for usb-c-grok 2018-10-03 19:09:29 +02:00
Gerhard Sittig 7d40b5ee62 serial-dmm: introduce support for subdriver specific channel names
Default to the existing "P1" etc naming scheme for analog channels of
serial-dmm subdrivers. Add support for subdriver specific channel names
(which can reference the channel number if they desire). This is useful
for devices with multiple displays, or special purpose devices where
other names than P1 can better reflect the channel's nature.
2018-10-02 19:01:25 +02:00
Gerhard Sittig e91c9f6e25 serial-dmm: only send acquisition data for enabled channels
Respect the user's "channel enabled" status. Do not feed the session bus
when data for disabled channels was received.
2018-10-02 19:01:25 +02:00
Gerhard Sittig 48e2992f86 serial-dmm: count analog DMM channels starting at 1
Commit 556a926d43 introduced support for multiple displays in
subdrivers of serial-dmm, but also changed user visible channel numbers
to start from 0. Restore the previous behaviour, start counting from 1
which users may perceive as more natural (serial-dmm used to start at P1
in the past, scopes start with CH1 as well).
2018-10-02 19:01:25 +02:00
Gerhard Sittig 3ef305b079 brymen-bm86x: avoid NULL deref when usb->devhdl does not exist
There are code paths where dev_close() tries to access a USB handle
which does not exist. This was observed with this command:

  $ sigrok-cli -d brymen-bm86x --scan
2018-10-02 19:01:04 +02:00
Gerhard Sittig bd10287e7c Makefile: cosmetics, alpha-sort src/dmm/ entries 2018-10-02 19:01:04 +02:00
Uwe Hermann 822a9c0eda hantek-6xxx: Hantek 6022BL: Add VID/PID 04b5:602a support.
On Windows, this device can either enumerate as 04b4:602a or 04b5:602a,
depending on which vendor driver is currently being used, so we have to
support both in the hantek-6xxx driver as well.

This fixes bug #1295.
2018-10-02 15:15:27 +02:00
Martin Ling 56bcbbffd0 raw_analog: Set appropriate precision digits for sample format.
This fixes parts of bug #950.
2018-09-20 20:36:00 +02:00
Martin Ling cd1e7fd20d analog output: convert binary to digital digits of precision.
This fixes parts of bug #950.
2018-09-20 20:35:57 +02:00
Martin Ling 5e5fde6e2c Fix read past end of array in sr_analog_si_prefix_friendly.
In the case where the input unit was not in the array, the for loop would
complete, but the following test would then read past the end of the array
since 'i' would already have been incremented to the array size.

Spotted because unitless data was getting SI prefixes with no unit, though
this would not have been deterministically reproducible.

This fixes parts of bug #950.
2018-09-20 20:35:42 +02:00
Uwe Hermann 755793e991 scpi-pps: Add a missing "break" in config_get(). 2018-09-18 23:42:24 +02:00
Uwe Hermann 3bae09ab9f Make sr_packet_{copy,free} API calls public.
This fixes bug #1277.
2018-09-18 23:39:56 +02:00
Martin Ling 3d11872282 scpi-pps: Fix broken channel selection code.
Fixes bug #1279.
2018-09-11 13:08:12 +01:00
Martin Ling 88e4daa9ff scpi-pps: Use software sample and time limits. 2018-09-10 16:33:11 +01:00
Martin Ling 49f7cb2425 scpi-pps: Don't block waiting for a value on capture stop.
The comment says "A requested value is certainly on the way", but the code no
longer works this way. The receive handler requests a value and blocks until
it is received. There is no value pending between receive handler calls, so
this code now only leads to a timeout.
2018-09-10 16:12:58 +01:00
Martin Ling cda70c2c19 Add udev rules for Rigol DP800 series. 2018-09-10 13:51:17 +01:00
Uwe Hermann 04a0e0dc1c output/csv: Disable the dedup option by default.
Having this on by default is surprising to most users, since csv is
not usually associated with having a VCD-like dedup property/feature.
2018-09-05 21:50:02 +02:00
Uwe Hermann f696d27e05 std: Drop unneeded/duplicate log messages.
The sr_session_send() function will already log all of those anyway.
2018-09-05 20:31:48 +02:00
Andrej Valek ee1a7d2f9d hantek-4032l: Fix default threshold value selection (FP workaround).
Take value from generated array of range instead of using a hard-coded value.

Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-09-04 01:39:06 +02:00
Soeren Apel 653d087e15 std: Fix up non-zero FP value generation 2018-09-04 01:31:56 +02:00
Gerhard Sittig 0da8e0bd2b input: improve robustness, avoid NULL dereference in sr_input_send()
Applications might pass NULL for the buffer, and input modules might
accept it (or just cope). Eliminate a potential NULL dereference in
the emission of diagnostics messages.
2018-09-03 22:22:46 +02:00
Gerhard Sittig b736fa0c7d proto.h: move routine declaration to its respective group 2018-09-03 22:22:40 +02:00
Uwe Hermann 3ad0308c55 sr_resourcepaths_get(): Drop confusing log message.
This is not really needed and can sometimes confuse users.
2018-09-03 22:18:28 +02:00
Uwe Hermann 2efb3cd700 hantek-6xxx: Hantek 6022BE: Add VID/PID 04b5:6022 support.
On Windows, this device can either enumerate as 04b4:6022 or 04b5:6022,
depending on which vendor driver is currently being used, so we have to
support both in the hantek-6xxx driver as well.

This fixes bug #918.
2018-09-03 22:01:32 +02:00
Uwe Hermann 00f0016cc3 Consistently use the _WIN32 #define.
The _WIN32 variant is available pretty much on all compilers, others
might not be. G_OS_WIN32 would probably be an equally well-suited
alternative, but for now we standardize on _WIN32.

  http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system#WindowswithCygwinPOSIX
2018-09-01 21:11:45 +02:00
Uwe Hermann 9be587a148 ipdbg-la: Fix two compiler warnings on Windows.
This is happening because the send() and recv() functions
have different prototypes on POSIX and Windows. Using the casts
is required on Windows and doesn't hurt on POSIX systems.

  [...]/protocol.c: In function 'tcp_send':
  [...]/protocol.c:161:26: warning: pointer targets in passing argument 2 of 'send' differ in signedness [-Wpointer-sign]
    out = send(tcp->socket, buf, len, 0);
                            ^
  In file included from [...]/protocol.c:24:0:
  [...]/include/winsock2.h:997:34: note: expected 'const char *' but argument is of type 'const uint8_t * {aka const unsigned char *}'
     WINSOCK_API_LINKAGE int WSAAPI send(SOCKET s,const char *buf,int len,int flags);
                                    ^
  [...]/protocol.c: In function 'ipdbg_la_tcp_receive':
  [...]/protocol.c:201:32: warning: pointer targets in passing argument 2 of 'recv' differ in signedness [-Wpointer-sign]
      int len = recv(tcp->socket, buf, 1, 0);
                                  ^
  In file included from [...]/protocol.c:24:0:
  [...]/include/winsock2.h:992:34: note: expected 'char *' but argument is of type 'uint8_t * {aka unsigned char *}'
     WINSOCK_API_LINKAGE int WSAAPI recv(SOCKET s,char *buf,int len,int flags);
                                    ^
2018-09-01 21:08:10 +02:00
Uwe Hermann 3bfdadf6df ipdbg-la: Fix data_available() implementation on Windows.
[...]/protocol.c: In function 'data_available':
  [...]/protocol.c:73:38: error: 'bytes_available' undeclared (first use in this function)
    ioctlsocket(tcp->socket, FIONREAD, &bytes_available);
                                        ^
  [...]/protocol.c:73:38: note: each undeclared identifier is reported only once for each function it appears in
  [...]/protocol.c:84:1: warning: no return statement in function returning non-void [-Wreturn-type]
   }
   ^
2018-09-01 21:07:09 +02:00
Uwe Hermann 24fbd9f814 ipdbg-la: Fix a build issue on Windows.
[...]/protocol.c:41:23: fatal error: sys/ioctl.h: No such file or directory
2018-09-01 21:06:57 +02:00
Gerhard Sittig 4be5746d1d fx2lafw: silence error message in query for channel group's device options
The fx2lafw(4) driver supports mere logic analyzers as well as mixed
signal devices, but does not support channel group specific device
options. Avoid an error message when channel group device options get
queried, the condition is perfectly legal and non-fatal.

How to reproduce:
  $ pulseview -d fx2lafw
  $ sigrok-cli -d fx2lafw -g Logic --show

This fixes bug #1267.
2018-08-30 22:11:25 +02:00
Gerhard Sittig 1372bdcdb5 saleae and other FX2: show firmware name when loading fails
The "firmware load failed" message would be even more helpful if users
could learn which firmware file failed to load. Add those filenames to
various FX2-based drivers.

This addresses bug #1262.
2018-08-30 22:05:56 +02:00
Uwe Hermann ee425a466a Add a new sr_log_callback_get() API call. 2018-08-30 19:11:30 +02:00
Uwe Hermann 8bc8e9094c ipdbg-la: scan(): Use g_strdup_printf(). 2018-08-30 02:02:51 +02:00
Uwe Hermann 4d33f5e112 ipdbg-la: Make some functions static. 2018-08-30 01:56:35 +02:00
Uwe Hermann ac3625bef9 ipdbg-la: Avoid CamelCaps and ALLCAPS variable names. 2018-08-30 01:35:48 +02:00
Uwe Hermann 703fb45490 ipdbg-la: Drop some unneeded casts. 2018-08-30 01:22:10 +02:00
Uwe Hermann 4465837b7d ipdbg-la: data_available(): Return gboolean. 2018-08-30 01:22:10 +02:00
Uwe Hermann 3831eaf9f4 ipdbg-la: Use std_init() and std_dev_list(). 2018-08-30 01:22:02 +02:00
Uwe Hermann 4838c6ca5a ipdbg-la: Consistently use g_strerror(). 2018-08-30 00:53:18 +02:00
Uwe Hermann fac36d0a77 ipdbg-la: Drop unneeded g_malloc0() checks for small allocations. 2018-08-30 00:52:19 +02:00
Uwe Hermann 13ac501acd ipdbg-la: Drop unneeded sdi->status handling.
This is already done by the backend wrapper functions.
2018-08-30 00:50:35 +02:00
Uwe Hermann 77b6b98d1c ipdbg-la: Simplify config_get/_set/_list. 2018-08-30 00:47:03 +02:00
Uwe Hermann 1f9652a861 ipdbg-la: Fix devopts[] contents. 2018-08-30 00:39:40 +02:00
Uwe Hermann 1f15efc1f7 ipdbg-la: Drop various unneeded name prefixes. 2018-08-30 00:33:39 +02:00
Uwe Hermann 932ef10f12 ipdbg-la: Fix incorrect copyright headers.
As per Daniel Anselmi <danselmi@gmx.ch> in an email conversation, the
code was actually written by Eva Kissling <eva.kissling@bluewin.ch>
(as indicated in the commit logs as well). Fix the headers accordingly.
2018-08-30 00:33:39 +02:00
Uwe Hermann 8a9788e2b7 ipdbg-la: Consistently use the same naming everywhere.
Use "ipdbg-la" everywhere to refer to the driver, including
in function name prefixes etc. There's no need to encode
website details (.org) into the driver/function name(s).
2018-08-30 00:11:51 +02:00
Soeren Apel ed18648423 ipdbg-la: Allow rx to time out and handle invalid data properly
This is required for when we connect to invalid devices, e.g.
port 4243 of the IPDBG host instead of 4242.
2018-08-29 23:59:48 +02:00
Soeren Apel 8771222588 ipdbg-la: Remove SR_CONF_SERIALCOMM 2018-08-29 23:59:45 +02:00
Soeren Apel 9d2e5483dc ipdbg-la: Adjust to sigrok indentation style 2018-08-29 23:59:42 +02:00
Soeren Apel 7f4c9a0444 ipdbg-la: More style fixes 2018-08-29 23:59:39 +02:00