linux-headers: bump 4.{4, 9, 10}.x series
[buildroot-gz.git] / package / libserial / 0002-Don-t-use-high-baudrates-when-not-available.patch
blobf2ad61ae7db7acfe7009cef6c9670ffafc1723ca
1 From 47ca0621ccd2100e4ba0d7f4e2a861d14f05f63c Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Tue, 17 Nov 2015 23:50:14 +0100
4 Subject: [PATCH] Don't use high baudrates when not available
6 On certain architectures (namely Sparc), the maximum baud rate exposed
7 by the kernel headers is B2000000. Therefore, the current libserial
8 code doesn't build for the Sparc and Sparc64 architectures due to
9 this.
11 In order to address this problem, this patch tests the value of
12 __MAX_BAUD. If it's higher than B2000000 then we assume we're on an
13 architecture that supports all baud rates up to B4000000. Otherwise,
14 we simply don't support the baud rates above B2000000.
16 Fixes build failures such as:
18 ./SerialPort.h:88:24: error: 'B2500000' was not declared in this scope
19 BAUD_2500000 = B2500000,
21 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
22 ---
23 src/SerialPort.h | 2 ++
24 src/SerialStreamBuf.h | 2 ++
25 2 files changed, 4 insertions(+)
27 diff --git a/src/SerialPort.h b/src/SerialPort.h
28 index 6c0baaa..0b1af4c 100644
29 --- a/src/SerialPort.h
30 +++ b/src/SerialPort.h
31 @@ -85,11 +85,13 @@ public:
32 BAUD_1152000 = B1152000,
33 BAUD_1500000 = B1500000,
34 BAUD_2000000 = B2000000,
35 +#if __MAX_BAUD > B2000000
36 BAUD_2500000 = B2500000,
37 BAUD_3000000 = B3000000,
38 BAUD_3500000 = B3500000,
39 BAUD_4000000 = B4000000,
40 #endif
41 +#endif /* __linux__ */
42 BAUD_DEFAULT = BAUD_57600
43 } ;
45 diff --git a/src/SerialStreamBuf.h b/src/SerialStreamBuf.h
46 index ccbb996..174f31c 100644
47 --- a/src/SerialStreamBuf.h
48 +++ b/src/SerialStreamBuf.h
49 @@ -85,11 +85,13 @@ extern "C++"
50 BAUD_1152000 = SerialPort::BAUD_1152000,
51 BAUD_1500000 = SerialPort::BAUD_1500000,
52 BAUD_2000000 = SerialPort::BAUD_2000000,
53 +#if __MAX_BAUD > B2000000
54 BAUD_2500000 = SerialPort::BAUD_2500000,
55 BAUD_3000000 = SerialPort::BAUD_3000000,
56 BAUD_3500000 = SerialPort::BAUD_3500000,
57 BAUD_4000000 = SerialPort::BAUD_4000000,
58 #endif
59 +#endif /* __linux__ */
60 BAUD_DEFAULT = SerialPort::BAUD_DEFAULT,
61 BAUD_INVALID = -1
62 } ;
63 --
64 2.6.3