Fix newline handling
Haiku sends '\n' when you press the enter key, but the terminal standard mandates that we use "\r\n" instead. This can be made into a setting later.
This commit is contained in:
@@ -71,7 +71,7 @@ void SerialApp::MessageReceived(BMessage* message)
|
|||||||
&length);
|
&length);
|
||||||
if(fLogFile->Write(bytes, length) != length)
|
if(fLogFile->Write(bytes, length) != length)
|
||||||
{
|
{
|
||||||
puts("### WRITE ERROR");
|
// TODO error handling
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,6 +83,11 @@ void SerialApp::MessageReceived(BMessage* message)
|
|||||||
ssize_t size;
|
ssize_t size;
|
||||||
|
|
||||||
message->FindData("data", B_RAW_TYPE, (const void**)&bytes, &size);
|
message->FindData("data", B_RAW_TYPE, (const void**)&bytes, &size);
|
||||||
|
|
||||||
|
if (bytes[0] == '\n') {
|
||||||
|
size = 2;
|
||||||
|
bytes = "\r\n";
|
||||||
|
}
|
||||||
fSerialPort.Write(bytes, size);
|
fSerialPort.Write(bytes, size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user