1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00
Commit Graph

389 Commits

Author SHA1 Message Date
Martin Ling
b87deb7c70 Clarify documentation regarding signals and EINTR. 2013-11-27 14:12:12 +00:00
Martin Ling
859874648e Fix error in documentation. 2013-11-27 14:12:04 +00:00
Martin Ling
2007ce5e14 Document EINTR handling. 2013-11-27 13:18:29 +00:00
Martin Ling
63a17c64ae Handle EINTR by repeating the call. 2013-11-27 12:43:12 +00:00
Martin Ling
1b34204261 Fix conversion of timeout to struct timeval. 2013-11-27 11:11:55 +00:00
Martin Ling
3353c22f32 Add sp_input_waiting() and sp_output_waiting() functions. 2013-11-27 02:55:18 +00:00
Martin Ling
e3dcf9068e New API and implementation for blocking and non-blocking I/O. 2013-11-27 01:45:48 +00:00
Martin Ling
8fbf876dfd Set VMIN = 1, not zero which forces non-blocking reads. 2013-11-27 01:37:35 +00:00
Martin Ling
afb518f04a Return SP_ERR_SUPP on attempt to set mark/space parity without CMSPAR. 2013-11-26 15:26:18 +00:00
Uwe Hermann
00d8c56d91 Minor cosmetics. 2013-11-26 16:12:20 +01:00
Uwe Hermann
dd7742fb15 Use "sp: " as prefix for debug logs (nicer/shorter). 2013-11-26 16:00:53 +01:00
Uwe Hermann
c3e0509275 Fix the build on NetBSD/OpenBSD/FreeBSD, possibly others.
Various termios flags used in sp_open() are Linux-specific (or even
specific to certain architectures / drivers) and not available on all
OSes (and/or versions or kernels thereof).

Thus, #ifdef out flags that we know might not be available everywhere.
2013-11-26 16:00:53 +01:00
Martin Ling
bccc7c9fa0 Set some sane defaults in sp_open() on Windows too. 2013-11-25 18:30:34 +00:00
Martin Ling
3f5c06d067 Apply termios setting changes immediately. 2013-11-25 18:21:49 +00:00
Martin Ling
e432ce6006 Support mark/space parity settings. 2013-11-25 18:05:58 +00:00
Martin Ling
b251be4b26 Turn off all the fancy termios features. 2013-11-25 17:55:37 +00:00
Martin Ling
0765af5644 Windows nonblocking write: 1 byte at a time to know when buffer fills. 2013-11-25 15:23:05 +00:00
Martin Ling
a3cb91f5e1 Implement non-blocking I/O on Windows. 2013-11-25 12:01:13 +00:00
Martin Ling
aac4d7f292 Fix SET_FAIL macro. 2013-11-25 11:34:42 +00:00
Martin Ling
33d5ff47b5 Handle -EAGAIN in non-blocking reads on Unix, and return 0 from sp_read(). 2013-11-25 10:23:13 +00:00
Martin Ling
0ba3e49b45 Fix bug in debug message generation in sp_flush(). 2013-11-23 21:21:18 +00:00
Martin Ling
59131d6028 Initialise structure in sp_new_config(). 2013-11-23 20:55:18 +00:00
Martin Ling
35ff018b49 Add generator program for configuration accessor headers. 2013-11-23 20:45:09 +00:00
Martin Ling
9b1502efce Make configuration structure opaque. 2013-11-23 20:43:13 +00:00
Martin Ling
0151b15710 Clarify documentation. 2013-11-23 18:23:45 +00:00
Martin Ling
3c126654b3 Add sp_get_port_handle() function. 2013-11-23 17:50:45 +00:00
Martin Ling
1c5aae9dc5 Make port structure opaque. 2013-11-23 17:11:19 +00:00
Martin Ling
70cd37def2 Add back previously deleted sp_get_config function. 2013-11-23 12:04:21 +00:00
Martin Ling
a6cda1e8c7 Fix swapped DCD & RI signals on Windows. 2013-11-23 11:59:42 +00:00
Martin Ling
6b93ede419 Return SP_ERR_SUPP from sp_list_ports() on unsupported platforms. 2013-11-23 11:57:17 +00:00
Martin Ling
64690702cb Generate debug output when returning using TRY() macro. 2013-11-23 11:49:35 +00:00
Martin Ling
dec10e31d0 Additional argument checking. 2013-11-23 11:39:59 +00:00
Martin Ling
ea667be751 Add additional debug messages. 2013-11-23 01:08:57 +00:00
Martin Ling
c33efc482e Add debug output for all entry and exit points. 2013-11-23 00:26:44 +00:00
Martin Ling
92f756f8c1 Add debug macros. 2013-11-23 00:19:38 +00:00
Martin Ling
863b35e69c Add API for and default handler for debug messages. 2013-11-22 22:41:03 +00:00
Uwe Hermann
71c8a9b906 serialport.c: Add missing linux_termios.h #include.
This is safe to include (at the moment) on all non-win32 OSes, since it
doesn't contain anything OS-specific.
2013-11-22 22:41:23 +01:00
Martin Ling
f36c639545 Remove dupliate/redundant return value documentation. 2013-11-22 21:58:51 +01:00
Martin Ling
6aabf62a90 Use new SP_ERR_SUPP error to indicate unsupported operations. 2013-11-22 21:46:26 +01:00
Uwe Hermann
6a1d6318e5 Makefile.am: Add missing linux_termios.h.
If the file is not listed in SOURCES, it won't end up in the tarball.

Thanks to Dan Horák for the report.
2013-11-22 20:28:20 +01:00
Martin Ling
68ec29db5e Check for termiox support at runtime. 2013-11-22 20:28:20 +01:00
Martin Ling
8d43110ad7 Fix memory leaks. 2013-11-22 20:28:20 +01:00
Uwe Hermann
7de20e3915 Use common 3-digit package version number. 2013-11-22 16:44:29 +01:00
Uwe Hermann
1d5d2a166f Temporarily disable USE_TERMIOX code (breaks the lib).
On some systems the use of the code enabled by USE_TERMIOX leads to a
non-working sp_open() which breaks all functionality provided by the lib.

Thus, temporarily disable that code until the details are investigated.

This has been tested with a serial port DMM and the OLS logic analyzer
on an x86 64bit Linux system with kernel version 3.11. The code compiles
fine but doesn't work at runtime. The configure output included:

checking for struct termios2... yes
checking for struct termiox... yes

The root cause for the problem is that the ioctl(fd, TCGETX, data) call in
get_flow() returns -1 ("Invalid argument"), which in turn lets sp_open()
return SP_ERR_FAIL.
2013-11-22 16:44:19 +01:00
Uwe Hermann
24abdb680f Minor cosmetics. 2013-11-22 16:10:55 +01:00
Uwe Hermann
8645feda60 Add missing #include guards. 2013-11-22 11:59:12 +01:00
Uwe Hermann
da21834e42 Fix the build on non-Linux platforms. 2013-11-22 11:56:40 +01:00
Bert Vermeulen
d2ac0e3bbe Ignore linux_termios leftovers. 2013-11-22 02:24:04 +01:00
Martin Ling
82f424e6cd Fix to sp_flush() on Unix. 2013-11-22 02:19:12 +01:00
Martin Ling
3f099f4fe8 Add missing @param port entries to documentation. 2013-11-22 02:11:45 +01:00