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

tools: Migrate to Protobuf RPC sessions #104

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

str4d
Copy link
Contributor

@str4d str4d commented Sep 2, 2023

To-do:

  • Generate protobuf 0.20 bindings.
  • RpcSession:
    • Basic synchronous support.
    • Rewrite to be asynchronous and handle I/O in a separate task.
    • Protobuf version checking.
    • Handle command IDs correctly.
      • The session should be managing them, and not using 0 which is a broadcast ID.
    • Automatic session closing.

Working commands:

  • --bin storage -- mkdir
  • --bin storage -- remove
  • --bin storage -- size
  • --bin storage -- receive
  • --bin storage -- send
  • --bin storage -- list
  • --bin storage -- md5sum
  • --bin run-fap

Closes #76.

self.cli.consume_response()?;
// /// Format external storage.
// pub fn format_ext(&mut self) -> io::Result<()> {
// self.cli.send_and_wait_eol("storage format /ext")?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAICT there is no RPC equivalent to storage format.

thread::sleep(Duration::from_millis(200));
}
fn wait_for_idle(session: &mut RpcSession) -> io::Result<()> {
// TODO: need equivalent of "loader info" CLI command.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is probably an equivalent to this (to determine whether an app is still running), but I have not figured out what it is yet.

@str4d
Copy link
Contributor Author

str4d commented Sep 2, 2023

--bin storage -- list seems to be slower than the text CLI version. Not sure there's much we can do about that.

@JarvisCraft JarvisCraft self-requested a review September 3, 2023 00:31
@str4d
Copy link
Contributor Author

str4d commented Oct 5, 2023

Rebased on main.

str4d added 3 commits October 5, 2023 13:28
To regenerate these:
- Install `protoc` (or otherwise make it available in your `PATH`).
- Check out https://github.com/flipperdevices/flipperzero-protobuf in
  the `tools/` directory (or make a symlink there to it).
@str4d
Copy link
Contributor Author

str4d commented Oct 6, 2023

Force-pushed to clean up the protobuf generation and move the output files into a submodule, making room for other submodules under proto for organising the async impl.

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

Successfully merging this pull request may close these issues.

tools: Migrate from text-based CLI to Protobuf RPC
1 participant