]>
sigrok.org Git - libserialport.git/log
Martin Ling [Sat, 4 Jan 2020 00:13:58 +0000 (00:13 +0000)]
windows: Loop over WriteFile() if write size exceeds limit.
Fixes #1469.
Martin Ling [Mon, 20 Jan 2020 03:43:49 +0000 (03:43 +0000)]
Add test program for timing functions.
Martin Ling [Sat, 4 Jan 2020 00:43:41 +0000 (00:43 +0000)]
Move timing routines to separate file.
Martin Ling [Sat, 4 Jan 2020 00:33:50 +0000 (00:33 +0000)]
Move commonly used start flag into timeout helpers.
Martin Ling [Sat, 4 Jan 2020 00:13:24 +0000 (00:13 +0000)]
Move special case for poll() timeout to call site.
Martin Ling [Fri, 3 Jan 2020 23:50:31 +0000 (23:50 +0000)]
Support timing helpers on Windows.
Martin Ling [Fri, 3 Jan 2020 23:33:48 +0000 (23:33 +0000)]
More generic solution for limiting per-call timeout.
Martin Ling [Fri, 3 Jan 2020 22:42:00 +0000 (22:42 +0000)]
Move repetitive timeout code into helper functions.
Martin Ling [Sun, 23 Sep 2018 16:10:21 +0000 (17:10 +0100)]
Abstract all time handling operations.
Uwe Hermann [Sun, 5 Jan 2020 17:19:00 +0000 (18:19 +0100)]
Makefile.am: Add example files to the tarball.
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.
Martin Ling [Sun, 5 Jan 2020 16:17:40 +0000 (16:17 +0000)]
Update Doxyfile for doxygen 1.8.16.
Martin Ling [Sun, 5 Jan 2020 14:53:09 +0000 (14:53 +0000)]
Release examples as public domain.
Martin Ling [Sun, 5 Jan 2020 03:28:58 +0000 (03:28 +0000)]
Add some additional formatting hints to Doxygen comments.
Martin Ling [Sun, 5 Jan 2020 03:04:38 +0000 (03:04 +0000)]
Integrate examples into Doxygen.
Martin Ling [Sun, 5 Jan 2020 02:04:06 +0000 (02:04 +0000)]
Add examples directory with two example programs.
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.
Martin Ling [Sat, 4 Jan 2020 15:39:54 +0000 (15:39 +0000)]
Define _POSIX_C_SOURCE to 199309L to get clock_gettime().
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.
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.
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)
^
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.
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.
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.
Martin Ling [Sun, 23 Sep 2018 16:22:20 +0000 (17:22 +0100)]
configure: Check whether clock_gettime is available.
Martin Ling [Sun, 23 Sep 2018 16:19:50 +0000 (17:19 +0100)]
Move all gettimeofday() calls into a wrapper function.
Martin Ling [Sat, 28 Dec 2019 18:47:06 +0000 (19:47 +0100)]
windows: Use architecture-specific size limit for WriteFile calls.
Martin Ling [Mon, 3 Jul 2017 20:43:38 +0000 (21:43 +0100)]
windows: Use an adaptively sized buffer for nonblocking writes.
Martin Ling [Mon, 3 Jul 2017 19:56:21 +0000 (20:56 +0100)]
windows: Await completion of previous write before changing config.
Martin Ling [Sat, 28 Dec 2019 16:53:11 +0000 (17:53 +0100)]
unix: Fix handling of EAGAIN in sp_nonblocking_write().
Uwe Hermann [Sat, 28 Dec 2019 18:23:30 +0000 (19:23 +0100)]
Random minor whitespace fixes.
Uwe Hermann [Sat, 28 Dec 2019 16:08:49 +0000 (17:08 +0100)]
windows: Fix incorrect wc_to_utf8() calls.
This fixes bug #1079.
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.
Uwe Hermann [Sun, 17 Dec 2017 17:15:56 +0000 (18:15 +0100)]
README: Add link to bug tracker.
Uwe Hermann [Fri, 15 Dec 2017 17:38:11 +0000 (18:38 +0100)]
README: Add missing contact info.
Martin Ling [Mon, 3 Jul 2017 19:55:13 +0000 (20:55 +0100)]
windows: Break out helper function for awaiting previous write completion.
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.
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.
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.
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.
Uwe Hermann [Sun, 5 Mar 2017 16:01:17 +0000 (17:01 +0100)]
configure summary: Show compiler version and flags.
Uwe Hermann [Sun, 5 Mar 2017 15:43:58 +0000 (16:43 +0100)]
configure summary: Show whether shared/static build is enabled.
Uwe Hermann [Sun, 5 Mar 2017 15:42:37 +0000 (16:42 +0100)]
configure summary: Slightly change formatting.
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) {
^~~~~
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>
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>
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.
Uwe Hermann [Fri, 8 Jan 2016 23:48:39 +0000 (00:48 +0100)]
NEWS: Last updates for the upcoming 0.1.1 release.
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.
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.
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)
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)
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.
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>
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.
Martin Ling [Tue, 13 Oct 2015 14:04:03 +0000 (15:04 +0100)]
sp_wait: Avoid overflow of timeout parameter to poll().
Daniel Elstner [Sun, 13 Sep 2015 18:04:31 +0000 (20:04 +0200)]
Build: Include config.h first in all source files
Daniel Elstner [Thu, 10 Sep 2015 20:03:07 +0000 (22:03 +0200)]
Build: Use GNUMAKEFLAGS and $@
Daniel Elstner [Thu, 27 Aug 2015 09:46:06 +0000 (11:46 +0200)]
autogen.sh: Create autostuff/ dir if it does not exist
Daniel Elstner [Wed, 26 Aug 2015 20:49:40 +0000 (22:49 +0200)]
configure: Enable largefile support on 32-bit systems
Daniel Elstner [Wed, 26 Aug 2015 20:01:03 +0000 (22:01 +0200)]
Clean up .gitignore
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.
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.
Martin Ling [Sun, 31 May 2015 12:07:20 +0000 (13:07 +0100)]
Update copyright notices.
Martin Ling [Sun, 31 May 2015 11:32:21 +0000 (12:32 +0100)]
Update AUTHORS file.
Uwe Hermann [Sat, 30 May 2015 20:04:56 +0000 (22:04 +0200)]
NEWS: Update for the upcoming 0.1.1 release.
Martin Ling [Sat, 30 May 2015 20:03:38 +0000 (21:03 +0100)]
doc: Provided channel is binary, not necessarily 8-bit.
Martin Ling [Wed, 27 May 2015 10:21:56 +0000 (11:21 +0100)]
Fix possible use of uninitialised variable in poll() setup.
Martin Ling [Wed, 27 May 2015 09:53:46 +0000 (10:53 +0100)]
doc: Additional introductory text.
Martin Ling [Sun, 24 May 2015 12:47:38 +0000 (13:47 +0100)]
doc: Expanded introductory text.
Martin Ling [Sun, 24 May 2015 12:47:09 +0000 (13:47 +0100)]
doc: Additional notes on sp_last_error_{code,message}.
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
Martin Ling [Thu, 7 May 2015 09:07:55 +0000 (10:07 +0100)]
Add new sp_blocking_read_next() function.
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.
Martin Ling [Thu, 7 May 2015 09:04:11 +0000 (10:04 +0100)]
posix: Make sure blocking operations can't time out without trying.
Martin Ling [Thu, 7 May 2015 08:41:41 +0000 (09:41 +0100)]
posix: Consistent debug output when blocking operations time out.
Martin Ling [Thu, 7 May 2015 08:41:02 +0000 (09:41 +0100)]
posix: Move FD_ZERO() and FD_SET() calls outside loops.
Martin Ling [Thu, 7 May 2015 08:19:47 +0000 (09:19 +0100)]
windows: Always check return value of GetOverlappedResult().
Martin Ling [Wed, 6 May 2015 23:09:49 +0000 (00:09 +0100)]
windows: Restructure if/else blocks with unnecessary indentation.
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().
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.
Martin Ling [Wed, 6 May 2015 19:11:17 +0000 (20:11 +0100)]
windows: Refactor duplicated code into a static function.
Martin Ling [Wed, 6 May 2015 15:40:41 +0000 (16:40 +0100)]
windows: Avoid unnecessary calls to SetCommTimeouts().
This fixes bug #586.
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.
Martin Ling [Thu, 23 Apr 2015 21:23:14 +0000 (22:23 +0100)]
doc: correct structure name in sp_get_port_handle() documentation.
Uwe Hermann [Sat, 2 May 2015 19:20:30 +0000 (21:20 +0200)]
libserialport.h.in: Fix/update some API docs.
Uwe Hermann [Sat, 2 May 2015 19:18:36 +0000 (21:18 +0200)]
sp_list_ports(): Actually set list_ptr NULL as documented.
Uwe Hermann [Sat, 2 May 2015 19:10:21 +0000 (21:10 +0200)]
Fix a potential segfault in sp_get_config_*().
Uwe Hermann [Thu, 30 Apr 2015 20:38:58 +0000 (22:38 +0200)]
Fix a potential segfault in sp_get_port_handle().
Uwe Hermann [Sun, 19 Apr 2015 17:33:22 +0000 (19:33 +0200)]
windows.c: Constify a few function parameters.
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.
Uwe Hermann [Sun, 19 Apr 2015 16:53:26 +0000 (18:53 +0200)]
Rename timeout to timeout_ms for clarity in a few places.
Uwe Hermann [Sun, 19 Apr 2015 16:36:58 +0000 (18:36 +0200)]
autotools: Don't set/override "user variables".
This fixes bug #577.
Uwe Hermann [Sun, 19 Apr 2015 16:33:47 +0000 (18:33 +0200)]
Makefile.am: Simplify LDFLAGS handling a bit.
Uwe Hermann [Sun, 19 Apr 2015 17:00:52 +0000 (19:00 +0200)]
Constify the sp_get_port_description() parameter.
Uwe Hermann [Sun, 19 Apr 2015 16:28:10 +0000 (18:28 +0200)]
Constify the sp_get_port_transport() parameter.
Uwe Hermann [Sun, 19 Apr 2015 16:21:19 +0000 (18:21 +0200)]
configure.ac: Drop no longer needed SP_PKGLIBS.
Uwe Hermann [Sat, 18 Apr 2015 21:48:29 +0000 (23:48 +0200)]
Various Doxygen comment updates and fixes.
- Add some missing @param lines.
- Add [in], [out], or [in,out] markers for @param tags.
- Add explicit "Must not be NULL" comments for parameters where
the caller should not pass in a NULL.
Uwe Hermann [Wed, 15 Apr 2015 23:05:04 +0000 (01:05 +0200)]
libserialport.h.in: Drop unneeded <windows.h> #include.
This is not needed and would pollute the namespace of every
libserialport user on Windows.
Uwe Hermann [Wed, 15 Apr 2015 22:53:50 +0000 (00:53 +0200)]
libserialport.h.in: Add @since tags for new enums.