hc
2023-02-14 0cc9b7c44253c93447ddf73e206fbdbb3d9f16b1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 1e7a7a625ca20633062406ce525b19d168c356af Mon Sep 17 00:00:00 2001
From: Peter Seiderer <ps.report@gmx.net>
Date: Mon, 20 Mar 2017 20:51:20 +0100
Subject: [PATCH] wiringPi/wiringSerial: fix compile for missing baud defines
 
For sparc-buildroot-linux-uclibc/sysroot/usr/include/asm/termbits.h
containing:
 
  /* These have totally bogus values and nobody uses them
     so far. Later on we'd have to use say 0x10000x and
     adjust CBAUD constant and drivers accordingly.
  #define B2500000  0x00001010
  #define B3000000  0x00001011
  #define B3500000  0x00001012
  #define B4000000  0x00001013  */
 
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
 wiringPi/wiringSerial.c | 8 ++++++++
 1 file changed, 8 insertions(+)
 
diff --git a/wiringPi/wiringSerial.c b/wiringPi/wiringSerial.c
index e1587ad..4ac8d1e 100644
--- a/wiringPi/wiringSerial.c
+++ b/wiringPi/wiringSerial.c
@@ -75,10 +75,18 @@ int serialOpen (const char *device, const int baud)
     case 1152000:    myBaud = B1152000 ; break ;
     case 1500000:    myBaud = B1500000 ; break ;
     case 2000000:    myBaud = B2000000 ; break ;
+#if defined(B2500000)
     case 2500000:    myBaud = B2500000 ; break ;
+#endif
+#if defined(B3000000)
     case 3000000:    myBaud = B3000000 ; break ;
+#endif
+#if defined(B3500000)
     case 3500000:    myBaud = B3500000 ; break ;
+#endif
+#if defined(B4000000)
     case 4000000:    myBaud = B4000000 ; break ;
+#endif
 
     default:
       return -2 ;
-- 
2.11.0