Uwe Hermann
23e7fa372a
Fix two compiler warnings on platforms without enumeration support.
...
serialport.c: In function 'sp_list_ports':
serialport.c:326:6: warning: unused variable 'ret' [-Wunused-variable]
int ret;
^
serialport.c:325:19: warning: unused variable 'list' [-Wunused-variable]
struct sp_port **list;
^
2015-04-03 22:11:07 +02:00
Uwe Hermann
ac323d80e0
add_handle(): Fix a realloc() related issue.
2015-04-03 22:02:42 +02:00
Uwe Hermann
948f63f0fd
add_handle(): Fix a memory leak.
...
This fixes the following scan-build warning:
serialport.c:1170:3: warning: Potential leak of memory pointed to by 'new_handles'
RETURN_ERROR(SP_ERR_MEM, "Mask array realloc() failed");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2015-04-03 17:51:41 +02:00
Martin Ling
8d12e620f2
Clarify sp_list_ports() code.
...
This also fixes the following scan-build warning:
serialport.c:335:15: warning: Result of 'malloc' is converted to a
pointer of type 'struct sp_port *', which is incompatible with sizeof
operand type 'struct sp_port **'
if (!(list = malloc(sizeof(struct sp_port **))))
^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
2015-04-03 17:46:26 +02:00
Martin Ling
34442106ef
windows: Set fAbortOnError=FALSE.
...
Since we're not handling and clearing receive errors (framing, parity and
overrun), we should turn them off to avoid crashing out with
ERROR_OPERATION_ABORTED in various calls if they occur. Invalid data
will then simply not end up in the buffer. This is consistent with our
current behaviour on posix/termios systems.
It might be nice to be able to inform calling code about receive errors, but I
can't see a good way to do this in a cross-platform way at the moment.
This fixes (parts of) bug #341 .
2015-03-29 22:18:46 +02:00
Martin Ling
47fcf8ec85
windows: Revise management of WaitCommEvent() operations.
...
This fixes (at least parts of) bug #341 .
2015-03-29 22:18:46 +02:00
Uwe Hermann
6c6aebe78c
Make std_baudrates[] static (only used in one file).
2015-03-26 23:57:56 +01:00
Uwe Hermann
dc422c04af
Various cosmetic and consistency fixes.
2015-03-26 23:57:56 +01:00
Martin Ling
f446cfbf65
windows: Fix restart of RX/error wait operation after reads.
...
This fixes bug #421 .
2015-02-15 20:52:45 +01:00
Boris Gjenero
e31f2c6b8b
Fix free() of uninitialized pointer.
...
Explicitly set port->usb_path to NULL, otherwise a free(port->usb_path)
can happen where port->usb_path is uninitialized.
This closes bug #512 .
2014-12-05 18:42:43 +01:00
Janne Huttunen
ad7498553c
Flush only the requested buffers
...
Fix the sp_flush() so that it flushes only the requested buffers
also in unix.
2014-10-12 21:38:03 +02:00
Aurelien Jacobs
276ef1b92f
Add SP_MODE_READ_WRITE enum value.
2014-09-20 21:24:31 +02:00
Martin Ling
7890cef6cf
Revise debug macros to work in strict C99.
2014-08-24 14:06:21 +01:00
Martin Ling
9caa2e86aa
Specialise RETURN_VALUE macro into RETURN_{INT,STRING,POINTER}.
...
This avoids the need to pass the required format string on every
call and also eliminates the need for the non-standard typeof() call.
2014-08-24 13:31:20 +01:00
Uwe Hermann
5a8810e2b2
serialport.c: Fix an 'unused variable' compiler warning.
2014-07-31 23:09:24 +02:00
Aurelien Jacobs
970f279ae4
Introduce SP_API/SP_PRIV to mark visibility of functions.
2014-07-02 14:43:32 +02:00
Martin Ling
e4ce975a54
Fix build for platforms without enumeration & port metadata support.
2014-06-14 12:27:54 +01:00
Aurelien Jacobs
48a4076f69
Move list_ports() implementations to OS-specific files.
2014-06-14 01:28:49 +02:00
Aurelien Jacobs
65172beffe
Check bus:address and vid:pid validity.
2014-06-11 17:21:51 +02:00
Martin Ling
e33dcf90a0
Tidy up and split most OS-specific code to separate files.
2014-06-11 15:10:29 +01:00
Aurelien Jacobs
a93fb46888
Add new APIs to get some USB descriptor details for USB serial ports.
2014-06-10 23:51:11 +02:00
Aurelien Jacobs
98cac5d63e
Remove the udev dependency and parse the /sys hierarchy instead.
2014-06-10 22:17:07 +02:00
Aurelien Jacobs
073c86bd07
Simplify Mac OS implementation of sp_list_ports().
2014-06-10 22:17:07 +02:00
Aurelien Jacobs
f095f84164
Remove useless declaration.
2014-06-10 22:17:07 +02:00
Aurelien Jacobs
da2ede60e4
Remove duplicated include.
2014-06-10 22:16:46 +02:00
Aurelien Jacobs
8edf649caf
Add format string support to RETURN_ERROR() and RETURN_FAIL().
2014-06-02 12:08:54 +02:00
Martin Ling
6c4b27a8b8
Merge pull request #1 from silverbuddy/master
...
Win32 issues
2014-03-22 07:14:49 +00:00
silverbuddy
e48f0ece0f
Fix malloc size (Win32)
2014-03-21 21:49:22 +04:00
silverbuddy
904ac164bf
Fix compilation (Win32 UNICODE)
2014-03-21 21:43:19 +04:00
Uwe Hermann
524b0e1454
Add runtime version querying functions.
...
This fixes bug #282 .
2014-03-13 12:23:56 +01:00
Martin Ling
5cea279a85
linux: Speed fields may not be present in kernel termios structures.
2014-01-03 13:38:06 +01:00
Martin Ling
bd791fe121
Remove need to include linux_termios.h on non-Linux.
2014-01-03 12:16:41 +01:00
Martin Ling
6f1186aa82
Add API for waiting on port events.
2013-12-20 18:24:42 +00:00
Uwe Hermann
1a2a1544d7
win32: Add missing ClearCommError() error handling/reporting.
2013-12-17 22:39:15 +01:00
Martin Ling
537942c9ed
Windows: clear errors after port open.
2013-12-17 17:19:55 +00:00
Martin Ling
950faaa94a
Remove obsolete comment.
2013-12-08 14:41:53 +00:00
Martin Ling
9af8cff38f
Remove stray periods from debug messages.
2013-12-07 20:18:27 +00:00
Martin Ling
64d996216e
Windows nonblocking write: Dont't return if async I/O finishes immediately.
2013-12-07 20:16:38 +00:00
Martin Ling
1622ef60b0
Check return value of GetOverlappedResult().
2013-12-07 17:09:06 +00:00
Martin Ling
7c1eff54fd
Make RETURN_VALUE macro side effect safe.
2013-12-07 16:29:18 +00:00
Martin Ling
33fd8804b8
Fix building for Android.
2013-12-05 20:33:06 +00:00
Martin Ling
397d89de3a
Make libudev optional.
2013-12-05 20:21:39 +00:00
Uwe Hermann
6c8716e9da
TIOCINQ/TIOCOUTQ is not available everywhere.
...
E.g. on NetBSD TIOCINQ is not available, but FIONREAD seems to
do pretty much the same thing.
2013-12-01 18:04:24 +01:00
Martin Ling
2c827b2188
Handle EINTR from tcdrain() in sp_drain().
2013-11-27 14:35:36 +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