Skip to content

Commit 7ac44ef

Browse files
committed
added options for listen protocol
Signed-off-by: addrian-77 <lunguadrian30@gmail.com>
1 parent f12c859 commit 7ac44ef

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

tockloader-cli/src/cli.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ fn get_channel_args() -> Vec<clap::Arg> {
6666
let serial_args_ids = get_serial_args_ids().into_iter();
6767

6868
vec![
69+
arg!(--protocol <PROTOCOL> "Choose between legacy and pconsole protocol")
70+
.default_value("legacy")
71+
.hide_default_value(true)
72+
.value_parser(["legacy", "pconsole"])
73+
.hide_possible_values(true),
6974
arg!(--serial "Use the serial bootloader to flash")
7075
.action(clap::ArgAction::SetTrue)
7176
.conflicts_with_all(probe_args_ids.clone().collect::<Vec<_>>()),

tockloader-cli/src/main.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,22 @@ async fn main() -> Result<()> {
133133
match matches.subcommand() {
134134
Some(("listen", sub_matches)) => {
135135
cli::validate(&mut cmd, sub_matches);
136-
tock_process_console::run()
137-
.await
138-
.context("Failed to run console.")?;
136+
let protocol = sub_matches
137+
.get_one::<String>("protocol")
138+
.map(String::as_str)
139+
.unwrap_or("legacy");
140+
match protocol {
141+
"legacy" => {
142+
// start process for legacy mode
143+
tock_process_console::run()
144+
.await
145+
.context("Failed to run console.")?;
146+
}
147+
"pconsole" => {
148+
// TODO
149+
}
150+
_ => {}
151+
}
139152
}
140153
Some(("list", sub_matches)) => {
141154
cli::validate(&mut cmd, sub_matches);

0 commit comments

Comments
 (0)