-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ways to disable backspace char escaping? #19
Comments
Thanks for reporting! It looks like this escape is there since the very first version of this library: https://docs.rs/crate/uart_16550/0.1.0/source/src/lib.rs . I didn't write the original code so I'm not sure why the escaping was added, perhaps you remember @lachlansneff? Given that the API operates on raw |
I just ran into a similar problem while trying to use the serial port to send binary data. It appears that the reason for the special case for 0x08 and 0x7F is to allow terminals to correctly display backspace and delete characters. In particular, the cursor must be moved to the previous character (0x08), then that character has to be erased (in this case by printing a space over it using 0x20) and then, since printing the space character advanced the cursor again, it must again be moved to the previous character using 0x08 again. In order to maintain backwards compatibility, I think it would be useful to have an accompanying |
Closing this in favor of #21. |
Thanks for looking into this @olivercalder. Sounds like the escaping might be desired in some cases. Maybe we should rename |
Thanks for merging the changes from PR #21, @phil-opp. Yes, I agree that it would be good to have explicit functions for sending raw data and data intended to be displayed by a terminal. I also completely agree with what you say regarding the For naming, I don't have strong opinions, but I'll offer a few suggestions. Another contributor used the name Personally, I think I prefer emphasizing the intended use case rather than what the function is doing -- that is, |
In one of my own projects, I had a case where binary data is transmitted through UART. But later I discovered that the code in this crate silently escapes the backspace character
\x08
to\x08\x20\x08
, which causes data corruption in my code:Maybe this behavior should be clearly described in the documentation, and another method which disables escaping should be added?
The text was updated successfully, but these errors were encountered: