Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

We should have a hook that's called on "serial connection ended" #1426

Open
obra opened this issue May 23, 2024 · 1 comment
Open

We should have a hook that's called on "serial connection ended" #1426

obra opened this issue May 23, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@obra
Copy link
Member

obra commented May 23, 2024

It doesn't matter what kind of serial connection drop it is, but if the device detects the port being closed, it should be called.

then focus can listen for it and reset its own state.

@obra obra added the enhancement New feature or request label May 23, 2024
@tlyu
Copy link
Collaborator

tlyu commented May 24, 2024

I think we probably do want something like that kind of functionality. One thing to think about is that a lot of the higher-level parsing happens in the actual plugins that use Focus, which don't really have a central way of resetting their parse state.

One possibility is to introduce some kind of EOF indication, which would function like EOL currently does. It would terminate the current item's parse. This might produce some invalid inputs as a side effect, but probably harmless ones.

Flushing input is a bit tricky: CDC serial doesn't support it (uses the flush method to flush output instead), and if the event is switching to a different host connection, it might not be possible to flush the input from the other connection.

Having this hook activate on DTR drop for CDC serial might help with some situations where some program decides to do active probes of all available serial devices on the host.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants