Commit Graph

4889 Commits

Author SHA1 Message Date
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
Soeren Apel 38e7493dd1 ipdbg-la: Style fixes 2018-08-29 23:59:35 +02:00
Eva Kissling b51288e3da ipdbg-la: stop-command 2018-08-29 23:59:32 +02:00
Eva Kissling b8fa29a175 ipdbg-la: stop-function pulseview 2018-08-29 23:59:30 +02:00
Eva Kissling a66099c6fa ipdbg-la: add edge trigger option 2018-08-29 23:59:27 +02:00
Eva Kissling 2f15f5bfec ipdbg-la: revers order of trigger settings 2018-08-29 23:59:25 +02:00
Eva Kissling a54144c0bd ipdbg-la: return correct samples limit 2018-08-29 23:59:22 +02:00
Eva Kissling 8f6b0eb12a ipdbg-la: add "loggs" 2018-08-29 23:59:20 +02:00
Eva Kissling 750303aab8 ipdbg-la: get rid of crash on shutdown 2018-08-29 23:59:17 +02:00
Eva Kissling d37c6daa84 ipdbg-la: reduce warnings (added explicit casts) 2018-08-29 23:59:14 +02:00
Eva Kissling a4210e1890 ipdbg-la: Add changes for IPDBG project 2018-08-29 23:59:10 +02:00
Uwe Hermann 17e0251d84 sr_buildinfo_libs_get(): Also support LIBUSBX_API_VERSION.
This fixes a build issue on some distros / libusb versions.
2018-07-22 18:01:22 +02:00
Uwe Hermann 0875f11de4 Fix multiple C++ bindings warnings with gcc 8.
bindings/cxx/classes.cpp: In function ‘int sigrok::call_log_callback(void*, int, const char*, __va_list_tag*)’:
  bindings/cxx/classes.cpp:242:17: warning: catching polymorphic type ‘class sigrok::Error’ by value [-Wcatch-value=]
    } catch (Error e) {
                   ^
  In file included from bindings/cxx/classes.cpp:1667:
  bindings/cxx/enums.cpp: In static member function ‘static Glib::VariantBase sigrok::ConfigKey::parse_string(std::__cxx11::string, sr_datatype)’:
  bindings/cxx/enums.cpp:789:13: warning: catching polymorphic type ‘class std::invalid_argument’ by value [-Wcatch-value=]
      } catch (invalid_argument) {
               ^~~~~~~~~~~~~~~~
  bindings/cxx/enums.cpp:804:13: warning: catching polymorphic type ‘class std::invalid_argument’ by value [-Wcatch-value=]
      } catch (invalid_argument) {
               ^~~~~~~~~~~~~~~~
2018-07-22 17:08:44 +02:00
Uwe Hermann 19d816c54a input/wav: Fix potential buffer overflow (and compiler warning).
With gcc 8 this yielded:

  src/input/wav.c: In function ‘receive’:
  src/input/wav.c:345:51: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 6 [-Wformat-truncation=]
       snprintf(channelname, sizeof(channelname), "CH%d", i + 1);
                                                     ^~
  src/input/wav.c:345:48: note: directive argument in the range [1, 2147483647]
       snprintf(channelname, sizeof(channelname), "CH%d", i + 1);
                                                  ^~~~~~
  src/input/wav.c:345:5: note: ‘snprintf’ output between 4 and 13 bytes into a destination of size 8
       snprintf(channelname, sizeof(channelname), "CH%d", i + 1);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2018-07-22 16:59:38 +02:00
Uwe Hermann 0f5bba9622 strutil.c: Use gboolean in favor of bool for consistency. 2018-07-22 16:37:58 +02:00
Gerhard Sittig 081aaebfc7 tests: add (negative) "." test case for rational conversion
A naive implementation of the parse rational conversion helper could
have accepted invalid input. Check for the expected conversion failure.
2018-07-22 16:36:15 +02:00
Gerhard Sittig 74d915331a tests: add more cases for text to rational number conversion
Test the ".1" and "1." cases which are assumed to be problematic on
MacOS (or may not have been supported before a recent update). Add more
tests with leading signs as well as whitespace instead of a sign.
2018-07-22 16:36:15 +02:00
Gerhard Sittig d875496366 strutil: insist in some mantissa for parse rational
The previous implementation accepted either empty integer or empty
fractional parts of a floating point number, but also when both parts
were missing ("." input). Insist in at least one of the parts to be
present.
2018-07-22 16:36:15 +02:00
Gerhard Sittig 7f5bfd6130 strutil: accept leading whitespace in parse rational
Programmatic output of floating point numbers might choose to print
spaces instead of an explicit '+' sign, to align the output with the
result of formatting negative numbers yet achieve a screen appearance
similar to what humans would have written. Skip leading whitespace
before insisting in seeing either signs or digits or decimals.
2018-07-22 16:36:15 +02:00
Gerhard Sittig 42408643f9 strutil: handle empty fractional in parse rational
Accept numbers like "123." where the period (dot) is present yet the
fractional part is empty. Adding a period but no additional digits is a
popular method of turning an otherwise integer literal into a float.
Compilers and strtod() routines accept this notation, too, so we have to
expect seeing such input.
2018-07-22 16:36:15 +02:00
Gerhard Sittig dd3202febf strutil: cosmetics, fixup minor style nits 2018-07-22 16:36:15 +02:00
Gerhard Sittig 83a05ca9b3 tests: echo text input when rational conversion fails
The previous implementation only echoed the p/q conversion results _if_
the return code signalled success but the result was unexpected. Although
the errno value for failed conversion attempts (non-zero return codes)
is not too helpful, seeing which text input failed the test is desirable.
2018-07-22 16:36:15 +02:00
Gerhard Sittig ed367d6820 input/vcd: abort VCD import when timestamp counts backwards
The VCD specification requests that timestamps will strictly increase as
one advances through the file. Add another check where the previous
implementation resulted in a tight loop and made the application stall.
Do print an error message and abort file processing in that case.

This fixes bug #1250.
2018-07-22 16:15:26 +02:00
Uwe Hermann e6104296c2 sr_buildinfo_libs_get(): Show LIBUSB_API_VERSION. 2018-07-19 23:56:33 +02:00
Uwe Hermann 9bf093011a configure.ac: Emit a warning if the C++ bindings are not being built. 2018-07-17 22:25:40 +02:00
Uwe Hermann 51bf39a163 strutil: Fix unit test failure (bug #1093).
Patch by Wojciech Lazarski, thanks a lot!
2018-07-17 19:06:05 +02:00
Gerhard Sittig 3387a5d8ee output: simplify trigger marker position calculation (readability)
This amends commit 67b345b981 which fixed the calculation of the
trigger marker's position. Improve readability of the formulae and
adjust comments.
2018-07-15 20:47:08 +02:00