]> sigrok.org Git - libserialport.git/log
libserialport.git
4 years agoUse SP_API prefix for functions in libserialport.h.
Martin Ling [Mon, 20 Jan 2020 05:02:27 +0000 (05:02 +0000)]
Use SP_API prefix for functions in libserialport.h.

For MSVC, we need to set the __declspec() for public symbols to
dllexport or dllimport, depending if we are building or using the
library. So, detect MSVC and define SP_API appropriately if found.
We use the LIBSERIALPORT_MSBUILD define to distinguish between
building and using the library, which will need to be set in the
project configuration when building the library using MS tools.

For normal client use of the header on other systems, we need to
define SP_API to nothing to avoid it being undefined, but we need
to avoid doing this in the case where we are including the header
whilst building the library with autotools and SP_API is already
set by autoconf. So define LIBSERIALPORT_ATBUILD in AM_CFLAGS,
and don't touch SP_API in the header if that's set.

4 years agoUse a static header file, not dependent on autoconf.
Martin Ling [Mon, 20 Jan 2020 04:51:52 +0000 (04:51 +0000)]
Use a static header file, not dependent on autoconf.

4 years agowindows: wc_to_utf8: use some clearer variable names.
Martin Ling [Sun, 29 Dec 2019 16:15:08 +0000 (17:15 +0100)]
windows: wc_to_utf8: use some clearer variable names.

4 years agowindows: Don't try to include <unistd.h>.
Martin Ling [Sun, 29 Dec 2019 13:22:00 +0000 (14:22 +0100)]
windows: Don't try to include <unistd.h>.

This should enable compatibility with MSVC.

4 years agowindows: wc_to_utf8: Eliminate variable-length array.
Martin Ling [Sat, 28 Dec 2019 21:38:04 +0000 (22:38 +0100)]
windows: wc_to_utf8: Eliminate variable-length array.

This should enable compatibility with MSVC.

4 years agowindows: Use a fixed worst-case WRITEFILE_MAX_SIZE.
Martin Ling [Mon, 20 Jan 2020 02:01:38 +0000 (02:01 +0000)]
windows: Use a fixed worst-case WRITEFILE_MAX_SIZE.

This saves needing to include and isolate the DDK headers.

4 years agowindows: Handle the case where there are no serial ports at all.
Martin Ling [Mon, 20 Jan 2020 01:42:00 +0000 (01:42 +0000)]
windows: Handle the case where there are no serial ports at all.

It's possible for the HARDWARE\DEVICEMAP\SERIALCOMM key to not exist in
the registry if there are no serial ports at all and never have been, as
discovered on my rather minimalist gaming machine.

Handle that case gracefully and return an empty list.

4 years agowindows: Handle registry lookup failures correctly.
Martin Ling [Mon, 20 Jan 2020 01:28:17 +0000 (01:28 +0000)]
windows: Handle registry lookup failures correctly.

RegOpenKeyEx() and RegQueryInfoKey() return system error codes directly,
not by setting the thread-local errno equivalent that is returned by
GetLastError().

When returning SP_ERR_FAIL, our API specifies that sp_last_error_code()
may be called immediately afterwards to get the system error code. In
this case that would not work, as it would call GetLastError() and miss
the directly-returned result.

We therefore need to call SetLastError() with the error code before
returning with SP_ERR_FAIL.

4 years agowindows: Loop over WriteFile() if write size exceeds limit.
Martin Ling [Sat, 4 Jan 2020 00:13:58 +0000 (00:13 +0000)]
windows: Loop over WriteFile() if write size exceeds limit.

Fixes #1469.

4 years agoAdd test program for timing functions.
Martin Ling [Mon, 20 Jan 2020 03:43:49 +0000 (03:43 +0000)]
Add test program for timing functions.

4 years agoMove timing routines to separate file.
Martin Ling [Sat, 4 Jan 2020 00:43:41 +0000 (00:43 +0000)]
Move timing routines to separate file.

4 years agoMove commonly used start flag into timeout helpers.
Martin Ling [Sat, 4 Jan 2020 00:33:50 +0000 (00:33 +0000)]
Move commonly used start flag into timeout helpers.

4 years agoMove special case for poll() timeout to call site.
Martin Ling [Sat, 4 Jan 2020 00:13:24 +0000 (00:13 +0000)]
Move special case for poll() timeout to call site.

4 years agoSupport timing helpers on Windows.
Martin Ling [Fri, 3 Jan 2020 23:50:31 +0000 (23:50 +0000)]
Support timing helpers on Windows.

4 years agoMore generic solution for limiting per-call timeout.
Martin Ling [Fri, 3 Jan 2020 23:33:48 +0000 (23:33 +0000)]
More generic solution for limiting per-call timeout.

4 years agoMove repetitive timeout code into helper functions.
Martin Ling [Fri, 3 Jan 2020 22:42:00 +0000 (22:42 +0000)]
Move repetitive timeout code into helper functions.

4 years agoAbstract all time handling operations.
Martin Ling [Sun, 23 Sep 2018 16:10:21 +0000 (17:10 +0100)]
Abstract all time handling operations.

4 years agoMakefile.am: Add example files to the tarball.
Uwe Hermann [Sun, 5 Jan 2020 17:19:00 +0000 (18:19 +0100)]
Makefile.am: Add example files to the tarball.

4 years agoDoxygen: Fix an issue causing missing #define documentation output.
Uwe Hermann [Sun, 5 Jan 2020 17:17:04 +0000 (18:17 +0100)]
Doxygen: Fix an issue causing missing #define documentation output.

  Searching for documented defines...
  [...]libserialport.h:1624: warning: documentation for unknown define SP_PACKAGE_VERSION_MAJOR found.
  [...]libserialport.h:1627: warning: documentation for unknown define SP_PACKAGE_VERSION_MINOR found.
  [...]libserialport.h:1630: warning: documentation for unknown define SP_PACKAGE_VERSION_MICRO found.
  [...]libserialport.h:1633: warning: documentation for unknown define SP_PACKAGE_VERSION_STRING found.
  [...]libserialport.h:1640: warning: documentation for unknown define SP_LIB_VERSION_CURRENT found.
  [...]libserialport.h:1643: warning: documentation for unknown define SP_LIB_VERSION_REVISION found.
  [...]libserialport.h:1646: warning: documentation for unknown define SP_LIB_VERSION_AGE found.
  [...]libserialport.h:1649: warning: documentation for unknown define SP_LIB_VERSION_STRING found.

4 years agoUpdate Doxyfile for doxygen 1.8.16.
Martin Ling [Sun, 5 Jan 2020 16:17:40 +0000 (16:17 +0000)]
Update Doxyfile for doxygen 1.8.16.

4 years agoRelease examples as public domain.
Martin Ling [Sun, 5 Jan 2020 14:53:09 +0000 (14:53 +0000)]
Release examples as public domain.

4 years agoAdd some additional formatting hints to Doxygen comments.
Martin Ling [Sun, 5 Jan 2020 03:28:58 +0000 (03:28 +0000)]
Add some additional formatting hints to Doxygen comments.

4 years agoIntegrate examples into Doxygen.
Martin Ling [Sun, 5 Jan 2020 03:04:38 +0000 (03:04 +0000)]
Integrate examples into Doxygen.

4 years agoAdd examples directory with two example programs.
Martin Ling [Sun, 5 Jan 2020 02:04:06 +0000 (02:04 +0000)]
Add examples directory with two example programs.

4 years agoandroid: Fix build compatibility with NDK platform 21 and up.
Martin Ling [Sat, 4 Jan 2020 23:00:17 +0000 (23:00 +0000)]
android: Fix build compatibility with NDK platform 21 and up.

In platforms 21 and higher of the NDK, linux/serial.h is available,
which it was not before. This broke the build, because the configure
script would detect the availability of 'struct serial_struct' in that
header and set HAVE_STRUCT_SERIAL_STRUCT, but the #ifndef __ANDROID__
in libserialport_internal.h stopped us actually including the header.

This change fixes things to build with all versions of the NDK, and is
tested with builds for arm from versions 9 to 24.

Version 21 also added availability of tcdrain(), so we also use that
where available, and only use the direct ioctl() method on NDK < 21.

Fixes #1078.

4 years agoDefine _POSIX_C_SOURCE to 199309L to get clock_gettime().
Martin Ling [Sat, 4 Jan 2020 15:39:54 +0000 (15:39 +0000)]
Define _POSIX_C_SOURCE to 199309L to get clock_gettime().

4 years agolinux: Fix compile warning on gcc 6+ for readlink() call.
Martin Ling [Tue, 31 Dec 2019 15:50:55 +0000 (16:50 +0100)]
linux: Fix compile warning on gcc 6+ for readlink() call.

Fixes #1268.

4 years agoUse O_CLOEXEC where available
Christian Seiler [Sun, 15 Oct 2017 17:28:05 +0000 (19:28 +0200)]
Use O_CLOEXEC where available

Ensures that the file descriptor is (by default) not passed to
subprocesses spawned by applications using libserialport.

This fixes bug #1051.

4 years agowindows: Fix a build error.
Uwe Hermann [Sat, 28 Dec 2019 22:39:15 +0000 (23:39 +0100)]
windows: Fix a build error.

  serialport.c: In function 'get_time':
  serialport.c:64:6: warning: implicit declaration of function 'clock_gettime' [-Wimplicit-function-declaration]
    if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
        ^
  serialport.c:64:20: error: 'CLOCK_MONOTONIC' undeclared (first use in this function)
    if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
                      ^
  serialport.c:64:20: note: each undeclared identifier is reported only once for each function it appears in
  serialport.c:65:17: error: 'CLOCK_REALTIME' undeclared (first use in this function)
     clock_gettime(CLOCK_REALTIME, &ts);
                   ^
  serialport.c: At top level:
  serialport.c:60:13: warning: 'get_time' defined but not used [-Wunused-function]
   static void get_time(struct timeval *time)
               ^

4 years agoFall back to CLOCK_REALTIME if CLOCK_MONOTONIC not usable.
Martin Ling [Sun, 23 Sep 2018 17:03:32 +0000 (18:03 +0100)]
Fall back to CLOCK_REALTIME if CLOCK_MONOTONIC not usable.

Sounds like this may be necessary on some older systems.

4 years agoUse mach_absolute_time() on OSX without clock_gettime().
Martin Ling [Sun, 23 Sep 2018 16:43:46 +0000 (17:43 +0100)]
Use mach_absolute_time() on OSX without clock_gettime().

This should fix #759 for OSX versions below 10.12.

4 years agoUse clock_gettime(CLOCK_MONOTONIC) if available.
Martin Ling [Sun, 23 Sep 2018 16:28:11 +0000 (17:28 +0100)]
Use clock_gettime(CLOCK_MONOTONIC) if available.

Should fix #759 except on OSX versions below 10.12, which don't
have clock_gettime.

4 years agoconfigure: Check whether clock_gettime is available.
Martin Ling [Sun, 23 Sep 2018 16:22:20 +0000 (17:22 +0100)]
configure: Check whether clock_gettime is available.

4 years agoMove all gettimeofday() calls into a wrapper function.
Martin Ling [Sun, 23 Sep 2018 16:19:50 +0000 (17:19 +0100)]
Move all gettimeofday() calls into a wrapper function.

4 years agowindows: Use architecture-specific size limit for WriteFile calls.
Martin Ling [Sat, 28 Dec 2019 18:47:06 +0000 (19:47 +0100)]
windows: Use architecture-specific size limit for WriteFile calls.

4 years agowindows: Use an adaptively sized buffer for nonblocking writes.
Martin Ling [Mon, 3 Jul 2017 20:43:38 +0000 (21:43 +0100)]
windows: Use an adaptively sized buffer for nonblocking writes.

4 years agowindows: Await completion of previous write before changing config.
Martin Ling [Mon, 3 Jul 2017 19:56:21 +0000 (20:56 +0100)]
windows: Await completion of previous write before changing config.

4 years agounix: Fix handling of EAGAIN in sp_nonblocking_write().
Martin Ling [Sat, 28 Dec 2019 16:53:11 +0000 (17:53 +0100)]
unix: Fix handling of EAGAIN in sp_nonblocking_write().

4 years agoRandom minor whitespace fixes.
Uwe Hermann [Sat, 28 Dec 2019 18:23:30 +0000 (19:23 +0100)]
Random minor whitespace fixes.

4 years agowindows: Fix incorrect wc_to_utf8() calls.
Uwe Hermann [Sat, 28 Dec 2019 16:08:49 +0000 (17:08 +0100)]
windows: Fix incorrect wc_to_utf8() calls.

This fixes bug #1079.

5 years agowindows: wc_to_utf8(): Fix a WCHAR related issue causing crashes.
Martin Jackson [Sat, 9 Sep 2017 22:37:48 +0000 (00:37 +0200)]
windows: wc_to_utf8(): Fix a WCHAR related issue causing crashes.

In wc_to_utf8() in windows.c, the zero terminator is written to an invalid
array index, which results in 2 bytes being zeroed in a random place in the
stack. This sometimes causes a crash when running sp_list_ports() (depending
on string length and compiler optimisation settings).

sizeof(wc_str) returns the size in bytes, so cannot be used directly as an
index into that array, it should be divided by sizeof(WCHAR). Otherwise the
zero terminator index is approximately twice what it should be.

This fixes bug #1031.

6 years agoREADME: Add link to bug tracker.
Uwe Hermann [Sun, 17 Dec 2017 17:15:56 +0000 (18:15 +0100)]
README: Add link to bug tracker.

6 years agoREADME: Add missing contact info.
Uwe Hermann [Fri, 15 Dec 2017 17:38:11 +0000 (18:38 +0100)]
README: Add missing contact info.

7 years agowindows: Break out helper function for awaiting previous write completion.
Martin Ling [Mon, 3 Jul 2017 19:55:13 +0000 (20:55 +0100)]
windows: Break out helper function for awaiting previous write completion.

7 years agoRemove redundant inclusions of limits.h
Stefan Tauner [Sun, 21 May 2017 21:44:03 +0000 (23:44 +0200)]
Remove redundant inclusions of limits.h

The first one would be included for Windows too which seems to be
an error. The second one is obviously redundant.

7 years agoCanonicalize symlinks in portnames
Stefan Tauner [Sun, 21 May 2017 21:42:06 +0000 (23:42 +0200)]
Canonicalize symlinks in portnames

This allows users to supply symlinks created e.g. by udev rules instead
of the actual device names.

7 years agoFreeBSD: Add missing libusb-2.0 to pkg-config file.
Uwe Hermann [Wed, 13 Sep 2017 13:04:35 +0000 (15:04 +0200)]
FreeBSD: Add missing libusb-2.0 to pkg-config file.

This fixes bug #1033.

7 years agoLinux: fix for alpha where BOTHER is not defined.
Martin Ling [Sun, 19 Mar 2017 12:16:49 +0000 (12:16 +0000)]
Linux: fix for alpha where BOTHER is not defined.

Fixes bug #363.

7 years agoconfigure summary: Show compiler version and flags.
Uwe Hermann [Sun, 5 Mar 2017 16:01:17 +0000 (17:01 +0100)]
configure summary: Show compiler version and flags.

7 years agoconfigure summary: Show whether shared/static build is enabled.
Uwe Hermann [Sun, 5 Mar 2017 15:43:58 +0000 (16:43 +0100)]
configure summary: Show whether shared/static build is enabled.

7 years agoconfigure summary: Slightly change formatting.
Uwe Hermann [Sun, 5 Mar 2017 15:42:37 +0000 (16:42 +0100)]
configure summary: Slightly change formatting.

8 years agouse readdir() instead of the deprecated readir_r()
Aurelien Jacobs [Fri, 14 Oct 2016 21:50:08 +0000 (23:50 +0200)]
use readdir() instead of the deprecated readir_r()

readir() is threadsafe on both linux and freebsd anyway.
The rationale behind the readdir_r() deprecation is in the glibc manual:
https://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html

This fixes the following warning with recent glibc:

linux.c: In function ‘list_ports’:
linux.c:197:2: warning: ‘readdir_r’ is deprecated [-Wdeprecated-declarations]
  while (!readdir_r(dir, &entry, &result) && result) {
  ^~~~~

8 years agolibserialport: Fix Linux files not compiled in with a toolchain for ucLinux
Paul Cercueil [Mon, 29 Aug 2016 13:05:20 +0000 (15:05 +0200)]
libserialport: Fix Linux files not compiled in with a toolchain for ucLinux

Buildroot can create toolchains for the no-MMU flavour of Linux, with a triple
containing 'uclinux' instead of just 'linux'.

Signed-off-by: Paul Cercueil <redacted>
8 years agolinux: freebsd: do check on proper pointer libserialport-unreleased
Wolfram Sang [Fri, 19 Feb 2016 21:25:00 +0000 (22:25 +0100)]
linux: freebsd: do check on proper pointer

We want to check here if we added something to the list, not if the
function argument was valid. Problem spotted by Coverity, CID 50754.

Signed-off-by: Wolfram Sang <redacted>
8 years agoBump libtool version (not package version) to 1:0:1.
Uwe Hermann [Sat, 9 Jan 2016 00:13:45 +0000 (01:13 +0100)]
Bump libtool version (not package version) to 1:0:1.

The last release (0.1.0) had the libtool version (current:revision:age)
set to 0:0:0. Since this release doesn't change/remove any
interfaces (it does *add* new interfaces, though), 'current' and 'age'
are increased and 'revision' is set to 0, resulting in 1:0:1.

http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info

Programs using libserialport don't need to be recompiled or relinked.

8 years agoNEWS: Last updates for the upcoming 0.1.1 release.
Uwe Hermann [Fri, 8 Jan 2016 23:48:39 +0000 (00:48 +0100)]
NEWS: Last updates for the upcoming 0.1.1 release.

8 years agoFix ERROR_SEM_TIMEOUT issue on Windows.
Uwe Hermann [Wed, 27 Jan 2016 07:19:38 +0000 (08:19 +0100)]
Fix ERROR_SEM_TIMEOUT issue on Windows.

The sp_blocking_write() call was incorrectly returning an error upon
ERROR_SEM_TIMEOUT. It now returns 0 instead.

8 years agoFix sp_blocking_read_next() implementation on Windows.
Uwe Hermann [Fri, 22 Jan 2016 14:30:44 +0000 (15:30 +0100)]
Fix sp_blocking_read_next() implementation on Windows.

A ReadFile() call needed to check the actual number of bytes read,
instead of assuming all requested bytes were read.

8 years agowindows: Fix iSerial for composite devices.
Martino Facchin [Wed, 16 Dec 2015 18:07:49 +0000 (19:07 +0100)]
windows: Fix iSerial for composite devices.

USB composite devices can contain an ACM serial interface.
On Windows, the correct iSerial descriptor field is assigned to the parent
(composite) device instead of to the actual serial interface. A bogus
value is returned if the serial interface is asked to provide the S/N.
This patch provides a fallback for this kind of device (tested on Android
with adb + cdc gadgets and on Arduino Zero Programming Port)

8 years agomacosx: Fix port listing on ElCapitan.
Martino Facchin [Fri, 18 Dec 2015 11:40:58 +0000 (12:40 +0100)]
macosx: Fix port listing on ElCapitan.

On OSX 10.11 (ElCapitan) the query for IOProviderClass fails to list ACM
devices as USB.
Add a fallback query using IOClass to correctly recognize these devices.
The fix has no effect on previous OSX versions (tested on Mavericks)

8 years agoChange debug message to "Port not open" when a closed port is used.
Martin Ling [Tue, 29 Dec 2015 02:36:04 +0000 (02:36 +0000)]
Change debug message to "Port not open" when a closed port is used.

Fixes bug #710.

8 years agolibserialport_internal: use new macro to enable timeradd, etc.
Wolfram Sang [Mon, 28 Dec 2015 13:33:40 +0000 (14:33 +0100)]
libserialport_internal: use new macro to enable timeradd, etc.

Since glibc 2.20, the usage of _BSD_SOURCE is deprecated. Fix it like
described here:

https://sourceware.org/glibc/wiki/Release/2.20#Deprecation_of__BSD_SOURCE_and__SVID_SOURCE_feature_macros

This fixes bug #716.

Signed-off-by: Wolfram Sang <redacted>
8 years agowindows: Handle ERROR_IO_PENDING from ReadFile in sp_nonblocking_read().
Martin Ling [Tue, 8 Dec 2015 20:08:49 +0000 (20:08 +0000)]
windows: Handle ERROR_IO_PENDING from ReadFile in sp_nonblocking_read().

This fixes bug #707.

9 years agosp_wait: Avoid overflow of timeout parameter to poll().
Martin Ling [Tue, 13 Oct 2015 14:04:03 +0000 (15:04 +0100)]
sp_wait: Avoid overflow of timeout parameter to poll().

9 years agoBuild: Include config.h first in all source files
Daniel Elstner [Sun, 13 Sep 2015 18:04:31 +0000 (20:04 +0200)]
Build: Include config.h first in all source files

9 years agoBuild: Use GNUMAKEFLAGS and $@
Daniel Elstner [Thu, 10 Sep 2015 20:03:07 +0000 (22:03 +0200)]
Build: Use GNUMAKEFLAGS and $@

9 years agoautogen.sh: Create autostuff/ dir if it does not exist
Daniel Elstner [Thu, 27 Aug 2015 09:46:06 +0000 (11:46 +0200)]
autogen.sh: Create autostuff/ dir if it does not exist

9 years agoconfigure: Enable largefile support on 32-bit systems
Daniel Elstner [Wed, 26 Aug 2015 20:49:40 +0000 (22:49 +0200)]
configure: Enable largefile support on 32-bit systems

9 years agoClean up .gitignore
Daniel Elstner [Wed, 26 Aug 2015 20:01:03 +0000 (22:01 +0200)]
Clean up .gitignore

9 years agoBuild: Clean up configure.ac and Makefile.am
Daniel Elstner [Wed, 26 Aug 2015 19:42:32 +0000 (21:42 +0200)]
Build: Clean up configure.ac and Makefile.am

Among other things, rename some config defines so we can take
advantage of standard Autoconf macros.

9 years agoBuild: Reduce autogen.sh to trivial stub
Daniel Elstner [Wed, 26 Aug 2015 17:46:43 +0000 (19:46 +0200)]
Build: Reduce autogen.sh to trivial stub

Use autoreconf instead of invoking the various Auto tools
separately. Get rid of the Darwin-specific guesswork -- it does
not make sense to handle this at the level of libserialport.

People should set up their ACLOCAL_PATH themselves as appropriate
for their own system; just as they already need to set up various
other paths.

9 years agoUpdate copyright notices.
Martin Ling [Sun, 31 May 2015 12:07:20 +0000 (13:07 +0100)]
Update copyright notices.

9 years agoUpdate AUTHORS file.
Martin Ling [Sun, 31 May 2015 11:32:21 +0000 (12:32 +0100)]
Update AUTHORS file.

9 years agoNEWS: Update for the upcoming 0.1.1 release.
Uwe Hermann [Sat, 30 May 2015 20:04:56 +0000 (22:04 +0200)]
NEWS: Update for the upcoming 0.1.1 release.

9 years agodoc: Provided channel is binary, not necessarily 8-bit.
Martin Ling [Sat, 30 May 2015 20:03:38 +0000 (21:03 +0100)]
doc: Provided channel is binary, not necessarily 8-bit.

9 years agoFix possible use of uninitialised variable in poll() setup.
Martin Ling [Wed, 27 May 2015 10:21:56 +0000 (11:21 +0100)]
Fix possible use of uninitialised variable in poll() setup.

9 years agodoc: Additional introductory text.
Martin Ling [Wed, 27 May 2015 09:53:46 +0000 (10:53 +0100)]
doc: Additional introductory text.

9 years agodoc: Expanded introductory text.
Martin Ling [Sun, 24 May 2015 12:47:38 +0000 (13:47 +0100)]
doc: Expanded introductory text.

9 years agodoc: Additional notes on sp_last_error_{code,message}.
Martin Ling [Sun, 24 May 2015 12:47:09 +0000 (13:47 +0100)]
doc: Additional notes on sp_last_error_{code,message}.

9 years agoHandle the case when /sys/class/tty/ entries are not symlinks.
silverbuddy [Wed, 20 May 2015 12:51:47 +0000 (15:51 +0300)]
Handle the case when /sys/class/tty/ entries are not symlinks.

For example:

$ uname -a
Linux RT-N66U 2.6.22.19 #1 Thu Feb 12 20:33:36 CST 2015 mips GNU/Linux

$ ls -lF /sys/class/tty/
drwxr-xr-x    2 foo  root             0 May 18 18:12 ttyACM0/

$ ls -lF /sys/class/tty/ttyACM0/
-r--r--r--    1 foo  root          4096 May 18 18:12 dev
lrwxrwxrwx    1 foo  root             0 May 18 18:12 device -> ../../../devices/pci0000:00/0000:00:04.1/usb1/1-1/1-1.1/1-1.1:1.0/
lrwxrwxrwx    1 foo  root             0 May 18 18:12 subsystem -> ../../../class/tty/
-rw-r--r--    1 foo  root          4096 May 18 18:12 uevent

9 years agoAdd new sp_blocking_read_next() function.
Martin Ling [Thu, 7 May 2015 09:07:55 +0000 (10:07 +0100)]
Add new sp_blocking_read_next() function.

9 years agowindows: Always check and set ReadTotalTimeoutMultiplier.
Martin Ling [Thu, 7 May 2015 09:06:33 +0000 (10:06 +0100)]
windows: Always check and set ReadTotalTimeoutMultiplier.

This is not currently touched, but will be by the upcoming
sp_blocking_read_next() function.

9 years agoposix: Make sure blocking operations can't time out without trying.
Martin Ling [Thu, 7 May 2015 09:04:11 +0000 (10:04 +0100)]
posix: Make sure blocking operations can't time out without trying.

9 years agoposix: Consistent debug output when blocking operations time out.
Martin Ling [Thu, 7 May 2015 08:41:41 +0000 (09:41 +0100)]
posix: Consistent debug output when blocking operations time out.

9 years agoposix: Move FD_ZERO() and FD_SET() calls outside loops.
Martin Ling [Thu, 7 May 2015 08:41:02 +0000 (09:41 +0100)]
posix: Move FD_ZERO() and FD_SET() calls outside loops.

9 years agowindows: Always check return value of GetOverlappedResult().
Martin Ling [Thu, 7 May 2015 08:19:47 +0000 (09:19 +0100)]
windows: Always check return value of GetOverlappedResult().

9 years agowindows: Restructure if/else blocks with unnecessary indentation.
Martin Ling [Wed, 6 May 2015 23:09:49 +0000 (00:09 +0100)]
windows: Restructure if/else blocks with unnecessary indentation.

9 years agowindows: restart_wait_if_needed(): Inline receive buffer check.
Martin Ling [Wed, 6 May 2015 19:18:37 +0000 (20:18 +0100)]
windows: restart_wait_if_needed(): Inline receive buffer check.

This removes all the debug spam arising from calling sp_input_waiting().

9 years agowindows: restart_wait_if_needed(): Skip buffer check if no bytes read.
Martin Ling [Wed, 6 May 2015 19:15:46 +0000 (20:15 +0100)]
windows: restart_wait_if_needed(): Skip buffer check if no bytes read.

9 years agowindows: Refactor duplicated code into a static function.
Martin Ling [Wed, 6 May 2015 19:11:17 +0000 (20:11 +0100)]
windows: Refactor duplicated code into a static function.

9 years agowindows: Avoid unnecessary calls to SetCommTimeouts().
Martin Ling [Wed, 6 May 2015 15:40:41 +0000 (16:40 +0100)]
windows: Avoid unnecessary calls to SetCommTimeouts().

This fixes bug #586.

9 years agowindows: Strip CR/LF from end of system error messages.
Martin Ling [Wed, 6 May 2015 15:12:27 +0000 (16:12 +0100)]
windows: Strip CR/LF from end of system error messages.

This fixes bug #585.

9 years agodoc: correct structure name in sp_get_port_handle() documentation.
Martin Ling [Thu, 23 Apr 2015 21:23:14 +0000 (22:23 +0100)]
doc: correct structure name in sp_get_port_handle() documentation.

9 years agolibserialport.h.in: Fix/update some API docs.
Uwe Hermann [Sat, 2 May 2015 19:20:30 +0000 (21:20 +0200)]
libserialport.h.in: Fix/update some API docs.

9 years agosp_list_ports(): Actually set list_ptr NULL as documented.
Uwe Hermann [Sat, 2 May 2015 19:18:36 +0000 (21:18 +0200)]
sp_list_ports(): Actually set list_ptr NULL as documented.

9 years agoFix a potential segfault in sp_get_config_*().
Uwe Hermann [Sat, 2 May 2015 19:10:21 +0000 (21:10 +0200)]
Fix a potential segfault in sp_get_config_*().

9 years agoFix a potential segfault in sp_get_port_handle().
Uwe Hermann [Thu, 30 Apr 2015 20:38:58 +0000 (22:38 +0200)]
Fix a potential segfault in sp_get_port_handle().

9 years agowindows.c: Constify a few function parameters.
Uwe Hermann [Sun, 19 Apr 2015 17:33:22 +0000 (19:33 +0200)]
windows.c: Constify a few function parameters.

9 years agosp_get_port_usb_vid_pid(): Document that usb_vid/usb_pid can be NULL.
Uwe Hermann [Sun, 19 Apr 2015 17:18:05 +0000 (19:18 +0200)]
sp_get_port_usb_vid_pid(): Document that usb_vid/usb_pid can be NULL.

9 years agoRename timeout to timeout_ms for clarity in a few places.
Uwe Hermann [Sun, 19 Apr 2015 16:53:26 +0000 (18:53 +0200)]
Rename timeout to timeout_ms for clarity in a few places.