8000 pconsole: support a "hibernation" mode by bradjc · Pull Request #3557 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

pconsole: support a "hibernation" mode #3557

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

Merged
merged 4 commits into from
Jul 25, 2023
Merged

pconsole: support a "hibernation" mode #3557

merged 4 commits into from
Jul 25, 2023

Conversation

bradjc
Copy link
Contributor
@bradjc bradjc commented Jul 21, 2023

Pull Request Overview

This pull request updates the process console to include a "hibernation" mode where the process console is still listening but doesn't respond to any commands or show the prompt. This allows the process console to get out of the way of an app that is using the console (particularly interactive apps).

This adds two pconsole commands:

  • console-start
  • console-stop

to implement this.

Boards can choose which mode to default to by calling either pconsole.start() or pconsole.start_hibernated().

Additionally:

  • Format the process console doc (in its own commit!)
  • Add the commands to the doc
  • Remove rx_in_progress which was set but never read

Testing Strategy

Using the pconsole with an interactive app.

TODO or Help Wanted

n/a

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

bradjc added 4 commits July 21, 2023 12:23
This prevents it from parsing commands and showing the prompt, which is
useful for using a console-based app with the pconsole included in the
kernel.
Copy link
Contributor
@brghena brghena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea here.

How does this work in practice with an interactive application? Does the pconsole win all user text input unless it's hibernating?

@bradjc
Copy link
Contributor Author
bradjc commented Jul 21, 2023

How does this work in practice with an interactive application? Does the pconsole win all user text input unless it's hibernating?

In practice from a user's point of view, if pconsole is active it works exactly as it does today. If pconsole is hibernating it works exactly as if the pconsole was not started or not included on the board.

@bradjc
Copy link
Contributor Author
bradjc commented Jul 21, 2023

Example, with breaks I added manually

tock$ start kv_interactive
Process kv_interactive resumed.

/// BOTH RUNNING

tock$ KV: unknown command
start
tock$ KV: unknown command
list
 PID    ShortID    Name                Quanta  Syscalls  Restarts  Grants  State
 0      Unique     kv_interactive           0       432         0   1/15   Yielded
KV: unknown command
 1      Unique     kv_system            98550        26         0   1/15   Running
 2      Unique     kv_system            98548        26         0   1/15   Running
tock$ set a 34
Valid commands are: help status list stop start fault boot terminate process kernel reset panic console-start console-stop
tock$ Setting a=34
Error setting key -11
get b 894
Valid commands are: help status list stop start fault boot terminate process kernel reset panic console-start console-stop
tock$ Getting b
Could not get key: -11
console-stop
Disabling the process console.
KV: unknown command
Run console-start to reactivate.

/// PCONSOLE STOPPED

list
KV: unknown command
get a 123
Getting a
Could not get key: -11
set b 456
Setting b=456
Error setting key -11
help
KV: unknown command
list
KV: unknown command
start
KV: unknown command
stop
KV: unknown command
console-start

/// BOTH RUNNING

tock$ KV: unknown command
list
 PID    ShortID    Name                Quanta  Syscalls  Restarts  Grants  State
 0      Unique     kv_interactive           0       888         0   1/15   Yielded
KV: unknown command
 1      Unique     kv_system           100400        26         0   1/15   Running
 2      Unique     kv_system           100399        26         0   1/15   Running
tock$

@alevy
Copy link
Member
alevy commented Jul 25, 2023

This looks good to me. I think there is maybe a slightly more elegant version that (a) uses control sequences (which might require special support from tockloader, I'm not sure) and (b) hides input from apps and app output from the console when pconsole is active.

But this is better than what we have and I like it!

@bradjc bradjc added this pull request to the merge queue Jul 25, 2023
Merged via the queue into master with commit 9995f25 Jul 25, 2023
@bradjc bradjc deleted the pconsole-stop-start branch July 25, 2023 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0