platformio/platformio-core

PIO device monitor adds \r before echoed \n automatically

Open

#5,097 opened on 2025年3月3日

GitHub で見る
 (1 comment) (0 reactions) (0 assignees)Python (791 forks)batch import
device managementhelp wanted

Repository metrics

Stars
 (7,329 stars)
PR merge metrics
 (平均マージ 109d 16h) (30d で 5 merged PRs)

説明

Hello!

Thank you all for your hard work on this project!

I was curious about whether a certain behavior was intended with regards to the serial monitor on PlatformIO. I have a STM32 attached via a USB-UART adapter to my Linux (Ubuntu 24.04) machine. When I run:

pio device monitor --port /dev/ttyUSB0 --baud 115200 --eol LF --raw

I'm expecting that only \n gets sent to the remote device when I press Enter, which I can confirm when I step through our code for the UART that receives and echoes back the same characters. However, in the terminal, it appears to print a \r automatically when an \n is transmitted from the STM32. I am quite sure that the STM32 does not transmit anything other than what it receives, so there's probably some issue with how I'm invoking the device monitor, or maybe there's a bug.

I have also tried:

pio device monitor --port /dev/ttyUSB0 --baud 115200 --eol LF --filter direct pio device monitor --port /dev/ttyUSB0 --baud 115200 --eol LF --filter default pio device monitor --port /dev/ttyUSB0 --baud 115200 --eol LF --filter nocontrol pio device monitor --port /dev/ttyUSB0 --baud 115200 --eol LF --filter printable

And even just:

pio device monitor --port /dev/ttyUSB0 --baud 115200 --eol LF

But none of them prevent a \r being added. To clarify, the behavior I'm looking for when I hit Enter to send an LF is as follows:

Typing this long string...
                          ^     <--- pressed Enter here
                          |     <--- cursor appears here

But what happens is this:

Typing this long string...
                          ^     <--- pressed Enter here
| <--- cursor appears here

How can I filter out the \r from being added before \n using the device monitor options? Will I have to specify a custom filter as seems to be described here? Or is this a possible bug?

コントリビューターガイド