diff options
author | Thomas Touhey <thomas@touhey.fr> | 2019-04-29 10:12:36 +0200 |
---|---|---|
committer | Thomas Touhey <thomas@touhey.fr> | 2019-04-29 10:12:36 +0200 |
commit | dd560fcb60b245de123f6c5dbcda60b0b83fc124 (patch) | |
tree | 9d4ed7a1465399018e1c20d6fae05adc7112b3c3 /include/libtio/native.h | |
parent | 6ec77a7b972ef033ba3cd46561c4233aa9c82422 (diff) |
Added serial listing native functions.
Diffstat (limited to 'include/libtio/native.h')
-rw-r--r-- | include/libtio/native.h | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/include/libtio/native.h b/include/libtio/native.h index d6e832c..3a120eb 100644 --- a/include/libtio/native.h +++ b/include/libtio/native.h @@ -18,9 +18,7 @@ TIO_BEGIN_DECLS * Macros defined hereafter: * * - `LIBTIO_DISABLED_UNIX`: disable POSIX (unistd.h) support. - * - `LIBTIO_DISABLED_WINDOWS`: disable Windows API support. - * - `LIBTIO_DISABLED_DEV_SERIAL`: disable Linux's /dev/serial support. - * - `LIBTIO_DISABLED_CU_SERIAL`: disable BSD's /dev/cu.* support. */ + * - `LIBTIO_DISABLED_WINDOWS`: disable Windows API support. */ # if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L # else @@ -33,27 +31,25 @@ TIO_BEGIN_DECLS # define LIBTIO_DISABLED_WINDOWS # endif -# if defined(__linux__) -# else -# define LIBTIO_DISABLED_DEV_SERIAL 1 -# endif - -# if defined(__APPLE__) && defined(__MACH__) -# else -# define LIBTIO_DISABLED_CU_SERIAL 1 -# endif - /* --- * Native stream opening functions. * --- */ /* UNIX streams. */ -# if !defined(LIBTIO_DISABLED_UNIX) +# ifndef LIBTIO_DISABLED_UNIX TIO_EXTERN(int) tio_open_unix_fd OF((tio_stream_t **tio__streamp, int tio__fd, int tio__close)); +/* These might not work, but we can try them on UNIX variants as they + * require the unistd.h functions at compile time. */ + +TIO_EXTERN(int) tio_list_unix_serial_ports_using_dev_serial + OF((tio_iter_t **tio__iterp)); +TIO_EXTERN(int) tio_list_unix_serial_ports_using_cu_devices + OF((tio_iter_t **tio__iterp)); + # endif /* Open USB streams. */ @@ -86,6 +82,23 @@ TIO_EXTERN(int) tio_open_stdin # endif +/* Open Windows handles. */ + +# ifndef LIBTIO_DISABLED_WINDOWS +# include <windows.h> + +TIO_EXTERN(int) tio_open_windows_file_handle + OF((tio_stream_t **tio__streamp, HANDLE tio__handle, + int tio__cl)); +TIO_EXTERN(int) tio_open_windows_serial_handle + OF((tio_stream_t **tio__streamp, HANDLE tio__handle, + int tio__cl)); + +TIO_EXTERN(int) tio_list_windows_serial_ports + OF((tio_iter_t **tio__iterp)); + +# endif + TIO_END_DECLS TIO_END_NAMESPACE |