You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.3 KiB

  1. From 6fad89a36968fe1bf6aed63f44b7e2e375271e76 Mon Sep 17 00:00:00 2001
  2. From: Nick Patavalis <npat@efault.net>
  3. Date: Thu, 12 Apr 2018 15:16:04 +0300
  4. Subject: [PATCH] Compile with libc's without cispeed / cospeed
  5. Some libc implementations (e.g. musl) do not define the cispeed and
  6. cospeed struct termios fields. So we have to check the
  7. _HAVE_STRUCT_TERMIOS_C_ISPEED and _HAVE_STRUCT_TERMIOS_C_OSPEED
  8. macros. If not defined, we disable custom baudrate support.
  9. ---
  10. custbaud.h | 10 +++++++++-
  11. 1 file changed, 9 insertions(+), 1 deletion(-)
  12. --- a/custbaud.h
  13. +++ b/custbaud.h
  14. @@ -26,6 +26,8 @@
  15. #ifndef CUSTBAUD_H
  16. #define CUSTBAUD_H
  17. +#include <termios.h>
  18. +
  19. #ifndef NO_CUSTOM_BAUD
  20. #if defined (__linux__)
  21. @@ -33,7 +35,13 @@
  22. /* Enable by-default for kernels > 2.6.0 on x86 and x86_64 only */
  23. #include <linux/version.h>
  24. #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
  25. -#if defined (__i386__) || defined (__x86_64__) || defined (USE_CUSTOM_BAUD)
  26. +/* Some libc implementations (e.g. musl) do not define the cispeed and
  27. + cospeed struct termios fields. We do not support custom baudrates
  28. + on them. */
  29. +#if ( (defined (__i386__) || defined (__x86_64__)) \
  30. + && defined (_HAVE_STRUCT_TERMIOS_C_ISPEED) \
  31. + && defined (_HAVE_STRUCT_TERMIOS_C_OSPEED) ) \
  32. + || defined (USE_CUSTOM_BAUD)
  33. #ifndef USE_CUSTOM_BAUD
  34. #define USE_CUSTOM_BAUD
  35. #endif