From 12aedb1f7fa7146a4bcec2ffb5e0d7c456ada000 Mon Sep 17 00:00:00 2001 From: rsahwe Date: Thu, 24 Jul 2025 02:13:31 +0200 Subject: [PATCH 1/2] Update port.rs to do \r\n rust uses only \n regardless of platform and some serial monitors such as the qemu one need \r\n. This would fix this. --- src/port.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/port.rs b/src/port.rs index 8dff982..b4ce816 100644 --- a/src/port.rs +++ b/src/port.rs @@ -107,6 +107,10 @@ impl SerialPort { self.send_raw(b' '); self.send_raw(8); } + 0x0a => { + self.send_raw(0x0d); + self.send_raw(0x0a); + } data => { self.send_raw(data); } From f7bda32b7512cb972abcb0ba57ccd41c79127021 Mon Sep 17 00:00:00 2001 From: rsahwe Date: Thu, 24 Jul 2025 13:56:00 +0200 Subject: [PATCH 2/2] Update port.rs documentation for send replacements --- src/port.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/port.rs b/src/port.rs index b4ce816..f5dca40 100644 --- a/src/port.rs +++ b/src/port.rs @@ -100,6 +100,8 @@ impl SerialPort { } /// Sends a byte on the serial port. + /// 0x08 (backspace) and 0x7F (delete) get replaced with 0x08, 0x20, 0x08 and 0x0A (\n) gets replaced with \r\n. + /// If this replacement is unwanted use [SerialPort::send_raw] instead. pub fn send(&mut self, data: u8) { match data { 8 | 0x7F => { @@ -107,9 +109,9 @@ impl SerialPort { self.send_raw(b' '); self.send_raw(8); } - 0x0a => { - self.send_raw(0x0d); - self.send_raw(0x0a); + 0x0A => { + self.send_raw(0x0D); + self.send_raw(0x0A); } data => { self.send_raw(data);