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

281 Commits

Author SHA1 Message Date
ec4b55ae25 doc: Additional notes on sp_last_error_{code,message}. 2015-05-27 11:09:26 +02:00
46d8b0a039 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
2015-05-27 11:09:26 +02:00
e5c2630eee Add new sp_blocking_read_next() function. 2015-05-27 11:09:26 +02:00
0188a545c7 windows: Always check and set ReadTotalTimeoutMultiplier.
This is not currently touched, but will be by the upcoming
sp_blocking_read_next() function.
2015-05-27 11:09:25 +02:00
76222ee578 posix: Make sure blocking operations can't time out without trying. 2015-05-27 11:09:25 +02:00
c3cee38c3b posix: Consistent debug output when blocking operations time out. 2015-05-27 11:09:25 +02:00
772c586133 posix: Move FD_ZERO() and FD_SET() calls outside loops. 2015-05-27 11:09:25 +02:00
27911925c1 windows: Always check return value of GetOverlappedResult(). 2015-05-27 11:09:25 +02:00
bbe566fe1c windows: Restructure if/else blocks with unnecessary indentation. 2015-05-27 11:09:25 +02:00
8ebfaf8966 windows: restart_wait_if_needed(): Inline receive buffer check.
This removes all the debug spam arising from calling sp_input_waiting().
2015-05-27 11:09:25 +02:00
21ae5ce197 windows: restart_wait_if_needed(): Skip buffer check if no bytes read. 2015-05-27 11:09:25 +02:00
94a314a806 windows: Refactor duplicated code into a static function. 2015-05-27 11:09:25 +02:00
27a58c0521 windows: Avoid unnecessary calls to SetCommTimeouts().
This fixes bug #586.
2015-05-27 11:09:13 +02:00
9a0c4bbdbe windows: Strip CR/LF from end of system error messages.
This fixes bug #585.
2015-05-27 11:08:30 +02:00
480d750c59 doc: correct structure name in sp_get_port_handle() documentation. 2015-05-06 16:33:13 +01:00
ff6da776e8 libserialport.h.in: Fix/update some API docs. 2015-05-06 17:06:06 +02:00
6392641545 sp_list_ports(): Actually set list_ptr NULL as documented. 2015-05-06 17:06:06 +02:00
6aad5bdd47 Fix a potential segfault in sp_get_config_*(). 2015-05-06 17:06:06 +02:00
5f64c28551 Fix a potential segfault in sp_get_port_handle(). 2015-05-06 17:06:05 +02:00
eb50b1aca6 windows.c: Constify a few function parameters. 2015-04-19 19:50:56 +02:00
9eb9f07130 sp_get_port_usb_vid_pid(): Document that usb_vid/usb_pid can be NULL. 2015-04-19 19:18:05 +02:00
1b91c6eadb Rename timeout to timeout_ms for clarity in a few places. 2015-04-19 19:01:08 +02:00
025c264448 autotools: Don't set/override "user variables".
This fixes bug #577.
2015-04-19 19:01:08 +02:00
a630a469f6 Makefile.am: Simplify LDFLAGS handling a bit. 2015-04-19 19:01:08 +02:00
f14809393a Constify the sp_get_port_description() parameter. 2015-04-19 19:01:08 +02:00
ad036cc8ef Constify the sp_get_port_transport() parameter. 2015-04-19 18:28:10 +02:00
3dd4a2ae39 configure.ac: Drop no longer needed SP_PKGLIBS. 2015-04-19 18:21:19 +02:00
35578b063e 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.
2015-04-19 18:16:01 +02:00
e4f44cf5f2 libserialport.h.in: Drop unneeded <windows.h> #include.
This is not needed and would pollute the namespace of every
libserialport user on Windows.
2015-04-19 18:15:29 +02:00
13efecf888 libserialport.h.in: Add @since tags for new enums. 2015-04-19 18:14:48 +02:00
3f2f48fc01 Set package version to 0.1.1, use "@since 0.1.1" Doxygen tags.
The next release will not contain any backwards-incompatible
API or ABI changes, thus changing the package version to 0.1.1.
2015-04-19 18:13:53 +02:00
777347a6bd windows: Drop no longer needed -luuid.
Also, use SP_LIBS in Makefile.am.

This is build-tested using a native MinGW-w64 based toolchain
as well as a MinGW-w64 based cross-compile setup.
2015-04-18 21:54:42 +02:00
8c6de591a5 configure.ac: Minor whitespace cosmetics. 2015-04-18 21:54:42 +02:00
1ff591d7b3 Doxyfile: Update to Doxygen 1.8.8 template.
(by running 'doxygen -u')
2015-04-18 21:54:42 +02:00
5ca38cdfe0 configure.ac: Add #include guard to config.h. 2015-04-18 21:54:42 +02:00
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
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
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
144a598f19 Minor Doxygen improvements and fixes. 2015-04-07 01:32:40 +02:00
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
cd71af4b93 README: Add link to online API docs. 2015-04-03 22:18:56 +02:00
a24671ade9 README: Mention FreeBSD port enumeration support. 2015-04-03 22:17:57 +02:00
1cda3e3dfc configure.ac: Add -Wmissing-prototypes. 2015-04-03 22:13:06 +02:00
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
ac323d80e0 add_handle(): Fix a realloc() related issue. 2015-04-03 22:02:42 +02:00
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
b344a40bb2 Fix indentation of a switch(). 2015-04-03 17:51:47 +02:00
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
5122d60849 Use libtool's -no-undefined option on all platforms. 2015-04-03 17:48:14 +02:00
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