All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] libserial: fix build on sparc
@ 2019-01-15 19:38 Fabrice Fontaine
  2019-01-16 15:02 ` Peter Korsgaard
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2019-01-15 19:38 UTC (permalink / raw)
  To: buildroot

On certain architectures (namely Sparc), the maximum baud rate exposed
by the kernel headers is B2000000. Therefore, the current libserial
code doesn't build for the Sparc and Sparc64 architectures due to
this.

In order to address this problem, this patch tests the value of
__MAX_BAUD. If it's higher than B2000000 then we assume we're on an
architecture that supports all baud rates up to B4000000. Otherwise,
we simply don't support the baud rates above B2000000.

Fixes build failures such as:

SerialPort.cpp: In member function 'int LibSerial::SerialPort::Implementation::GetBitRate(const LibSerial::BaudRate&) const':
SerialPort.cpp:1226:14: error: 'BAUD_2000000' is not a member of 'LibSerial::BaudRate'
         case BaudRate::BAUD_2000000:

Fixes:
 - http://autobuild.buildroot.org/results/63ba95b6786464fa8e75af64593010df84530079

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...cpp-don-t-use-high-baudrates-when-not-ava.patch | 53 ++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 package/libserial/0002-SerialPort.cpp-don-t-use-high-baudrates-when-not-ava.patch

diff --git a/package/libserial/0002-SerialPort.cpp-don-t-use-high-baudrates-when-not-ava.patch b/package/libserial/0002-SerialPort.cpp-don-t-use-high-baudrates-when-not-ava.patch
new file mode 100644
index 0000000000..4f97f598c4
--- /dev/null
+++ b/package/libserial/0002-SerialPort.cpp-don-t-use-high-baudrates-when-not-ava.patch
@@ -0,0 +1,53 @@
+From fc0f031563146b91d255c752a61624f6dd3c14d4 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Tue, 15 Jan 2019 08:33:27 +0100
+Subject: [PATCH] SerialPort.cpp: don't use high baudrates when not available
+
+On certain architectures (namely Sparc), the maximum baud rate exposed
+by the kernel headers is B2000000. Therefore, the current libserial
+code doesn't build for the Sparc and Sparc64 architectures due to
+this.
+
+In order to address this problem, this patch tests the value of
+__MAX_BAUD. If it's higher than B2000000 then we assume we're on an
+architecture that supports all baud rates up to B4000000. Otherwise,
+we simply don't support the baud rates above B2000000.
+
+Fixes build failures such as:
+
+SerialPort.cpp: In member function 'int LibSerial::SerialPort::Implementation::GetBitRate(const LibSerial::BaudRate&) const':
+SerialPort.cpp:1226:14: error: 'BAUD_2000000' is not a member of 'LibSerial::BaudRate'
+         case BaudRate::BAUD_2000000:
+
+Fixes:
+ - http://autobuild.buildroot.org/results/63ba95b6786464fa8e75af64593010df84530079
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Upstream status: https://github.com/crayzeewulf/libserial/pull/127]
+---
+ src/SerialPort.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/SerialPort.cpp b/src/SerialPort.cpp
+index e3240eb..18daac0 100644
+--- a/src/SerialPort.cpp
++++ b/src/SerialPort.cpp
+@@ -1223,6 +1223,7 @@ namespace LibSerial
+             baud_rate_as_int = 1500000 ;
+             break ;
+ 
++#if __MAX_BAUD > B2000000
+         case BaudRate::BAUD_2000000:
+             baud_rate_as_int = 2000000 ;
+             break ;
+@@ -1242,6 +1243,7 @@ namespace LibSerial
+         case BaudRate::BAUD_4000000:
+             baud_rate_as_int = 4000000 ;
+             break ;
++#endif /* __MAX_BAUD */
+         default:
+             // If an incorrect baud rate was specified, throw an exception.
+             throw std::runtime_error(ERR_MSG_INVALID_BAUD_RATE) ;
+-- 
+2.14.1
+
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Buildroot] [PATCH 1/1] libserial: fix build on sparc
  2019-01-15 19:38 [Buildroot] [PATCH 1/1] libserial: fix build on sparc Fabrice Fontaine
@ 2019-01-16 15:02 ` Peter Korsgaard
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Korsgaard @ 2019-01-16 15:02 UTC (permalink / raw)
  To: buildroot

>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:

 > On certain architectures (namely Sparc), the maximum baud rate exposed
 > by the kernel headers is B2000000. Therefore, the current libserial
 > code doesn't build for the Sparc and Sparc64 architectures due to
 > this.

 > In order to address this problem, this patch tests the value of
 > __MAX_BAUD. If it's higher than B2000000 then we assume we're on an
 > architecture that supports all baud rates up to B4000000. Otherwise,
 > we simply don't support the baud rates above B2000000.

 > Fixes build failures such as:

 > SerialPort.cpp: In member function 'int LibSerial::SerialPort::Implementation::GetBitRate(const LibSerial::BaudRate&) const':
 > SerialPort.cpp:1226:14: error: 'BAUD_2000000' is not a member of 'LibSerial::BaudRate'
 >          case BaudRate::BAUD_2000000:

 > Fixes:
 >  - http://autobuild.buildroot.org/results/63ba95b6786464fa8e75af64593010df84530079

 > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

Committed, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-16 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-15 19:38 [Buildroot] [PATCH 1/1] libserial: fix build on sparc Fabrice Fontaine
2019-01-16 15:02 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.