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 takes too long #788

Open
532910 opened this issue Apr 13, 2024 · 15 comments
Open

escape takes too long #788

532910 opened this issue Apr 13, 2024 · 15 comments
Labels
bug Something isn't working firmware pcengines_apu2

Comments

@532910
Copy link

532910 commented Apr 13, 2024

Component

Dasharo firmware

Device

PC Engines APU6

Dasharo version

v0.9.0

Dasharo Tools Suite version

No response

Brief summary

escape takes too long

How reproducible

every time

How to reproduce

press escape

Expected behavior

escape must take the same time as enter or up/down arrows

Actual behavior

escape takes several seconds

Screenshots

No response

Additional context

No response

Solutions you've tried

No response

@532910 532910 added the bug Something isn't working label Apr 13, 2024
@miczyg1
Copy link
Contributor

miczyg1 commented Apr 15, 2024

@532910 unfortunately this cannot be "fixed" and it is not an issue. The delay in ESC is necessary to correctly recognize terminal escape sequences. Each escape sequence starts with an ESC code (0x1b) optionally followed by control characters (depending on the pressed key). E.g. arrow up is ESC [ A and escape key is simply ESC. Because of these optional control characters, the serial console driver waits for up to 2 seconds for these optional characters to arrive. If they do no arrive, it means an ESC key was pressed.

@miczyg1 miczyg1 closed this as completed Apr 15, 2024
@532910
Copy link
Author

532910 commented Apr 15, 2024

This is very annoying behavior! Before I understand that delay exist, I thought it just doesn't work at all.
I believe the delay should be reduced significantly. As for arrow up you will receive [A almost instantly, so 500ms or even less should be more than enough. It might be worth making this configurable in Console Options.

One more enhancement I see there is to add one more button for back action.

Please reopen.

@miczyg1 miczyg1 reopened this Apr 15, 2024
@532910
Copy link
Author

532910 commented Apr 15, 2024

115200 is less than 0.1 millisecond per byte, so I believe the delay could be safely set to 50ms that will be completely invisible for human

@macpijan
Copy link
Contributor

macpijan commented Jun 28, 2024

the serial console driver waits for up to 2 second

Any idea if it comes from some specification, or simply that how it was set in this code?

@mkopec
Copy link
Member

mkopec commented Jul 1, 2024

@miczyg1
Copy link
Contributor

miczyg1 commented Jul 1, 2024

No idea if it comes from specification, but typical AMI firmwares also have this 2s timeout for escape sequences. Seems pretty standard

@clhodapp
Copy link

clhodapp commented Nov 3, 2024

Dasharo ought to be better than AMI!

@Firminator
Copy link

Firminator commented Nov 4, 2024

Offtopic:
Interesting comment in there regarding the 2s timeout:

2 seconds are allowed for an ESC sequence to be completed. If the ESC sequence is not completed in 2 seconds, then the raw key strokes of the partial ESC sequence are converted into EFI Keys.

There is one special input sequence that will force the system to reset.
This is ESC R ESC r

I wonder if this is a replacement for CTRL+ALT+DEL.

@miczyg1
Copy link
Contributor

miczyg1 commented Nov 5, 2024

Offtopic: Interesting comment in there regarding the 2s timeout:

2 seconds are allowed for an ESC sequence to be completed. If the ESC sequence is not completed in 2 seconds, then the raw key strokes of the partial ESC sequence are converted into EFI Keys.
There is one special input sequence that will force the system to reset.
This is ESC R ESC r

I wonder if this is a replacement for CTRL+ALT+DEL.

Not a replacement but probably some equivalent for serial console.

@miczyg1
Copy link
Contributor

miczyg1 commented Nov 5, 2024

Dasharo ought to be better than AMI!

Maybe in a few more decades, when we reach the same level of experience, growth, partnerships, etc.

Also, better in what aspects? Each solution has pros and cons.

@clhodapp
Copy link

clhodapp commented Nov 8, 2024

The comment was a bit exaggerated as a joke but:

What I mean is that Dasharo might have the chance to be smoother and provide a better experience than AMI, so long as there isn't a technical reason that the delay needs to be a full 2 seconds. Even just halving it to one second might make it feel better to navigate the menus.

@macpijan
Copy link
Contributor

macpijan commented Nov 8, 2024

@mkopec Do you think you can lower this timeout to e.g. 0.5s or 1s on a branch, and link to CI-produced binaries, so users in this thread eager to test can check it out? Of course, such a binary would not be tested on our side, and there is a risk of needing external recovery.

@mkopec
Copy link
Member

mkopec commented Nov 8, 2024

Sure, I'll try to make a PR today

I also wonder if the delay should be inversely proportional to baudrate, maybe we just need to wait 1-2 symbols instead of a fixed timeout

@mkopec
Copy link
Member

mkopec commented Nov 8, 2024

Apparently tmux uses 500ms by default and zsh uses 400ms: https://www.johnhawthorn.com/2012/09/vi-escape-delays/

Some people set the delay to 0 and seem to have everything working correctly, but I wouldn't want to do that over serial probably. Let's go with 500ms for now

@mkopec
Copy link
Member

mkopec commented Nov 8, 2024

Made a PR: Dasharo/coreboot#585

The build artifacts are available on https://github.com/Dasharo/coreboot/actions/runs/11742370832

Untested, so testers welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working firmware pcengines_apu2
Projects
None yet
Development

No branches or pull requests

7 participants