Skip to content
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

Escape code not recognized across reads #160

Open
goertzenator opened this issue May 12, 2021 · 0 comments
Open

Escape code not recognized across reads #160

goertzenator opened this issue May 12, 2021 · 0 comments

Comments

@goertzenator
Copy link

When using the arrow keys in an application running on a 9600 baud serial port I get frequent garbage characters such as [A and [D which are of course broken escape codes.

This source code has the following comment:

-- Read at least one character of input, and more if immediately
-- available.  In particular the characters making up a control sequence
-- will all be available at once, so they can be processed together
-- (with Posix.lexKeys).

I don't think that is a workable assumption on a slow serial port.

I originally detected this issue in an oddball serial port and pseudo terminal configuration which gave me an easy way to inspect traffic:

pump1 got"\ESC[C"
pump1 got"\ESC[C"
pump1 got"\ESC[C"
pump1 got"\ESC"
pump1 got"[C"

In this example I pressed right arrow 4 times. It worked correctly 3 times and then I got [C on the screen. The correct data is getting through, but it is clearly not interpreting the escape code.

Escape codes should still be recognized even if they do not arrive all at once.

Possibly related to case #77.

goertzenator added a commit to goertzenator/haskeline that referenced this issue May 27, 2021
- fixes issue haskell#160 and maybe issue haskell#77.
- 20ms delay worked well for 9600bps serial port, 10ms did not.
goertzenator added a commit to goertzenator/haskeline that referenced this issue Aug 17, 2023
- fixes issue haskell#160 and maybe issue haskell#77.
- 20ms delay worked well for 9600bps serial port, 10ms did not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant