Commit Graph

399 Commits

Author SHA1 Message Date
Uwe Hermann 8c6de591a5 configure.ac: Minor whitespace cosmetics. 2015-04-18 21:54:42 +02:00
Uwe Hermann 1ff591d7b3 Doxyfile: Update to Doxygen 1.8.8 template.
(by running 'doxygen -u')
2015-04-18 21:54:42 +02:00
Uwe Hermann 5ca38cdfe0 configure.ac: Add #include guard to config.h. 2015-04-18 21:54:42 +02:00
Uwe Hermann 613c48f191 Fix a compiler warning when -Wshadow is used.
CC       serialport.lo
  In file included from ../serialport.c:25:0:
  ../serialport.c: In function 'get_config':
  ../libserialport_internal.h:227:25: warning: declaration of 'ret' shadows a previous local [-Wshadow]
   #define TRY(x) do { int ret = x; if (ret != SP_OK) RETURN_CODEVAL(ret); } while (0)
                           ^
  ../serialport.c:1566:3: note: in expansion of macro 'TRY'
     TRY(get_baudrate(port->fd, &config->baudrate));
     ^
  ../serialport.c:1543:6: warning: shadowed declaration is here [-Wshadow]
    int ret = get_flow(port->fd, data);
        ^

Also, add -Wshadow to the list of default compiler options.
2015-04-18 21:54:42 +02:00
Uwe Hermann b3e619c8b2 autogen.sh: Drop obsolete MinGW/MSYS items.
For Windows builds (which require MinGW-w64) we currently support:

 - cross-builds using MXE (mxe.cc) and possibly other cross-compile setups

 - native builds using MSYS2 (sf.net/projects/msys2/)

Neither of those require explicitly specifying ACLOCAL_DIR.
2015-04-07 02:35:03 +02:00
Uwe Hermann f11a67ed5f README: Refer to MSYS2 only.
The "old" MSYS related to the "old" and unsupported MinGW (from
mingw.org) may or may not work properly, so only refer to MSYS2 which
we currently recommend and which has been tested.
2015-04-07 01:32:40 +02:00
Uwe Hermann 144a598f19 Minor Doxygen improvements and fixes. 2015-04-07 01:32:40 +02:00
Uwe Hermann 3cb7aa98c2 configure.ac: Use $host_os instead of $target_os.
$build and $build_os refer to the machine on which the software is
built, $host and $host_os refer to the machine for which the software
is (cross-)built.

The variables $target and $target_os (despite the confusing names)
are only relevant in the context of building cross-compilers.
2015-04-07 00:49:27 +02:00
Uwe Hermann cd71af4b93 README: Add link to online API docs. 2015-04-03 22:18:56 +02:00
Uwe Hermann a24671ade9 README: Mention FreeBSD port enumeration support. 2015-04-03 22:17:57 +02:00
Uwe Hermann 1cda3e3dfc configure.ac: Add -Wmissing-prototypes. 2015-04-03 22:13:06 +02:00
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 e019e72ec0 Fix a compiler warning.
This fixes the following scan-build warning:

  serialport.c: In function 'sp_list_ports':
  serialport.c:354:1: warning: control reaches end of non-void function [-Wreturn-type]
2015-04-03 20:50:22 +02:00
Uwe Hermann b344a40bb2 Fix indentation of a switch(). 2015-04-03 17:51:47 +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
Uwe Hermann 5122d60849 Use libtool's -no-undefined option on all platforms. 2015-04-03 17:48:14 +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
Uwe Hermann 2b40f81454 libserialport_internal.h: Add #include guard. 2015-03-26 23:57:56 +01:00
Uwe Hermann cfa5af67fd Fix some typos. 2015-03-26 23:57:55 +01:00
Uwe Hermann 64155cba8a linux_termios.h: Add missing #include of "config.h". 2015-03-25 14:52:54 +01:00
Martin Ling 7c081505e5 Generate a config.h rather than passing defines on command line.
Fixes bug #553.
2015-03-24 23:15:32 +00:00
Uwe Hermann 7c1101dc08 Fix misleading snprintf() arguments. 2015-02-20 18:57:08 +01:00
Uffe Jakobsen ea17bfca3d If present, add usb_serial to description for better identification 2015-02-20 18:54:12 +01:00
Uffe Jakobsen 5497520891 Handle enumeration of native UART ports on FreeBSD 2015-02-16 23:25:14 +01:00
Uffe Jakobsen ccd512d51c Implement FreeBSD OS-specific serial port detection and query 2015-02-15 21:28:15 +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
Aurelien Jacobs b328a48b0f windows: Properly handle return value of SetupDiOpenDevRegKey().
This fixes bug #499.
2014-11-27 17:42:28 +01:00
Martin Ling 59182fbbbf linux: Check for BOTHER macro at configure time.
This fixes bug #363.
2014-11-01 18:36:09 +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
Bert Vermeulen d66bbceaa7 Fix typos. 2014-10-05 02:38:35 +02:00
Martin Ling 78940e6921 windows: Fix compile issues with multiply or not defined GUIDs.
This fixes bug #416.
2014-09-25 23:04:06 +02:00
Aurelien Jacobs 6c444ade55 windows: Indentation (cosmetics only). 2014-09-24 12:54:36 +02:00
Aurelien Jacobs 7aeb6736bd windows: Fix various memory leaks.
This fixes bug #419.
2014-09-24 12:52:21 +02:00
Aurelien Jacobs 276ef1b92f Add SP_MODE_READ_WRITE enum value. 2014-09-20 21:24:31 +02:00
Uwe Hermann eb82be98a7 README: Add URL to the libserialport website. 2014-09-07 19:31:23 +02:00
Uwe Hermann a46ee5b4d7 README: Mention that only MinGW-w64 works (but not MinGW). 2014-09-07 19:27:02 +02:00
Michael B. Trausch da8730199a windows: -no-undefined is required to make a DLL. 2014-09-07 19:18:22 +02:00
Michael B. Trausch 6692d8c13f windows: Add -lsetupapi when building for WIN32. 2014-09-07 19:18:19 +02:00
Michael B. Trausch d179da05c0 windows: Include proper GUID defining header to fix build.
The initguid.h header must appear early or it does not have
an effect, at least on cross-build from Linux.
2014-09-07 18:51:04 +02:00
Aurelien Jacobs 653cef3ab1 linux: remove readlinkat() dependency 2014-09-04 20:13:55 +02:00
Aurelien Jacobs 546e9ae5c5 linux_termios: fix return types to actually match returned values
This fixes the following warning :

linux_termios.c: In function 'get_termios_get_ioctl':
linux_termios.c:42:2: warning: overflow in implicit constant conversion [-Woverflow]
  return TCGETS2;
  ^

This fixes bug #396.
2014-09-04 20:13:55 +02:00
Uwe Hermann 23ef3bf125 Fix Mac OS X build (untested). 2014-08-27 14:56:19 +02:00
Uwe Hermann d38c7d2c70 Fix Windows build. 2014-08-27 14:53:19 +02:00
Martin Ling 0666ccc7ca linux: Fix warning by marking vid, pid variables unsigned. 2014-08-24 14:08:00 +01:00