From dcbd04c831b0b70ea79a7b98c0fbfbd17559e912 Mon Sep 17 00:00:00 2001 From: Kevin <68612569+diyelectromusic@users.noreply.github.com> Date: Thu, 25 Aug 2022 18:58:25 +0100 Subject: [PATCH] Add call to set Serial options to prevent CR to CRLF conversion (#311) Co-authored-by: probonopd --- src/serialmididevice.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/serialmididevice.cpp b/src/serialmididevice.cpp index cdb5153e..5978ecc5 100644 --- a/src/serialmididevice.cpp +++ b/src/serialmididevice.cpp @@ -49,7 +49,12 @@ CSerialMIDIDevice::~CSerialMIDIDevice (void) boolean CSerialMIDIDevice::Initialize (void) { assert (m_pConfig); - return m_Serial.Initialize (m_pConfig->GetMIDIBaudRate ()); + boolean res = m_Serial.Initialize (m_pConfig->GetMIDIBaudRate ()); + unsigned ser_options = m_Serial.GetOptions(); + // Ensure CR->CRLF translation is disabled for MIDI links + ser_options &= ~(SERIAL_OPTION_ONLCR); + m_Serial.SetOptions(ser_options); + return res; } void CSerialMIDIDevice::Process (void)