Skip to content

Commit

Permalink
tool/src/main.rs: Allow non utf8 arguments within fan subcmd
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Czapla <[email protected]>
  • Loading branch information
SebastianCzapla committed Dec 13, 2024
1 parent 3617713 commit ba5a858
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ fn main() {
.subcommand(SubCommand::with_name("console"))
.subcommand(SubCommand::with_name("fan")
.arg(Arg::with_name("index")
.value_parser(clap::value_parser!(u8))
.allow_invalid_utf8(true)
.required(true)
)
.arg(Arg::with_name("duty")
Expand Down Expand Up @@ -456,7 +456,7 @@ fn main() {
},
},
Some(("fan", sub_m)) => {
let index = sub_m.value_of("index").unwrap().parse::<u8>().unwrap();
let index = sub_m.value_of_os("index").unwrap().to_string_lossy().parse::<u8>().unwrap();
let duty_opt = sub_m.value_of("duty").map(|x| x.parse::<u8>().unwrap());
match duty_opt {
Some(duty) => match unsafe { fan_set(&mut ec, index, duty) } {
Expand Down

0 comments on commit ba5a858

Please sign in to comment.