1
0
mirror of https://github.com/UzixLS/picocom.git synced 2025-07-19 07:21:18 +03:00

Better build support for custom baudrates

For some systems (OSes, versions, architectures) custom-baudrate
support is enabled by default.

For others, support may work, but must be enabled by defining
USE_CUSTOM_BAUD in the Makefile

You can also disable custom baudrate support altogether (even for
systems where it's enabled by default), by defining NO_CUSTOM_BAUD in
the Makefile
This commit is contained in:
Nick Patavalis
2018-01-16 03:46:09 +02:00
parent e41aeb84ac
commit 8ca2e5a10f
6 changed files with 95 additions and 21 deletions

18
term.c
View File

@ -52,6 +52,8 @@
#define CMSPAR 0
#endif
/* On these systems, use the TIOCM[BIS|BIC|GET] ioctls to manipulate
* the modem control lines (DTR / RTS) */
#if defined(__linux__) || \
defined(__FreeBSD__) || defined(__OpenBSD__) || \
defined(__NetBSD__) || defined(__DragonFly__) || \
@ -62,22 +64,10 @@
#include <sys/ioctl.h>
#endif
#include "custbaud.h"
#ifdef USE_CUSTOM_BAUD
#if defined (__linux__)
/* only works for linux, recent kernels */
#include "termios2.h"
#elif defined (__FreeBSD__) || defined (__OpenBSD__) || \
defined (__DragonFly__) || defined (__APPLE__)
/* only for some BSD and macOS (Tiger and above)
* Note that this code might also work other BSD variants, but I have only
* tested with those listed below. Also tested __NetBSD__ but won't work. */
#include "custbaud_bsd.h"
#else
#error "USE_CUSTOM_BAUD not supported in this system"
#include CUSTOM_BAUD_HEAD
#endif
#endif /* of USE_CUSTOM_BAUD */
/* Time to wait for UART to clear after a drain (in usec). */
#define DRAIN_DELAY 200000