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.

44 lines
1.4 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. diff --git a/custbaud.h b/custbaud.h
  13. index 48151a4..ae4ae8d 100644
  14. --- a/custbaud.h
  15. +++ b/custbaud.h
  16. @@ -26,6 +26,8 @@
  17. #ifndef CUSTBAUD_H
  18. #define CUSTBAUD_H
  19. +#include <termios.h>
  20. +
  21. #ifndef NO_CUSTOM_BAUD
  22. #if defined (__linux__)
  23. @@ -33,7 +35,13 @@
  24. /* Enable by-default for kernels > 2.6.0 on x86 and x86_64 only */
  25. #include <linux/version.h>
  26. #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
  27. -#if defined (__i386__) || defined (__x86_64__) || defined (USE_CUSTOM_BAUD)
  28. +/* Some libc implementations (e.g. musl) do not define the cispeed and
  29. + cospeed struct termios fields. We do not support custom baudrates
  30. + on them. */
  31. +#if ( (defined (__i386__) || defined (__x86_64__)) \
  32. + && defined (_HAVE_STRUCT_TERMIOS_C_ISPEED) \
  33. + && defined (_HAVE_STRUCT_TERMIOS_C_OSPEED) ) \
  34. + || defined (USE_CUSTOM_BAUD)
  35. #ifndef USE_CUSTOM_BAUD
  36. #define USE_CUSTOM_BAUD
  37. #endif
  38. --
  39. 2.19.1