From 55b70199349f064e72aeba2aaa9089ae21ff5504 Mon Sep 17 00:00:00 2001 From: Nick Patavalis Date: Wed, 17 Jan 2018 19:48:14 +0200 Subject: [PATCH] Changed when to enable custom baud by default Be very conservative when enabling custom baudrate support (USE_CUSTOM_BAUD) by default. Only enable (by default) on systems where we know it will cause no problems. For other systems the user can try to enable it explicitly (see Makefile). Currently enabled by default on: Linux, Kernel verison > 2.6.0, x86 and x86_64 architectures FreeBSD, OpenBSD, NetBSD, DragonFly BSD --- custbaud.h | 16 ++++++++++++++-- custbaud_bsd.c | 5 +++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/custbaud.h b/custbaud.h index 6a1591b..f8f1dda 100644 --- a/custbaud.h +++ b/custbaud.h @@ -30,6 +30,7 @@ #if defined (__linux__) +/* Enable by-default for kernels > 2.6.0 on x86 and x86_64 only */ #include #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) #if defined (__x86__) || defined (__x86_64__) || defined (USE_CUSTOM_BAUD) @@ -40,9 +41,20 @@ #endif /* of arch */ #endif /* of version */ -#elif defined (__FreeBSD__) || defined (__OpenBSD__) || \ - defined (__DragonFly__) || defined (__APPLE__) +#elif defined (__APPLE__) +/* ?? Maybe enable by-default for specific versions ?? */ +#define CUSTOM_BAUD_HEAD "custbaud_bsd.h" + +#elif defined (__NetBSD__) + +/* Do not enable by default */ +#define CUSTOM_BAUD_HEAD "custbaud_bsd.h" + +#elif defined (__FreeBSD__) || defined (__OpenBSD__) || \ + defined (__DragonFly__) + +/* I believe it doesn't hurt to enable by-default for these */ #ifndef USE_CUSTOM_BAUD #define USE_CUSTOM_BAUD #endif diff --git a/custbaud_bsd.c b/custbaud_bsd.c index 3fc920e..092f986 100644 --- a/custbaud_bsd.c +++ b/custbaud_bsd.c @@ -42,8 +42,9 @@ /* Note that this code might also work with other BSD variants, but I have only * tested with those listed below. Also tested __NetBSD__ but won't work. */ -#if (defined (__FreeBSD__) || defined (__OpenBSD__) || \ - defined (__DragonFly__) || defined (__APPLE__)) && \ +#if (defined (__FreeBSD__) || defined (__NetBSD__) || \ + defined (__OpenBSD__) || defined (__DragonFly__) || \ + defined (__APPLE__)) && \ defined (USE_CUSTOM_BAUD) #include "custbaud_bsd.h"