remove get serial ports

This commit is contained in:
Alex Janka 2023-02-05 10:04:59 +11:00
parent 770ed39767
commit 5ed34fe01c

View file

@ -8,7 +8,7 @@ use mppt_common::datatypes::*;
use mppt_common::mppt_structs::{MpptData, MpptEeprom, MpptRam}; use mppt_common::mppt_structs::{MpptData, MpptEeprom, MpptRam};
use mppt_common::Info; use mppt_common::Info;
use mppt_common::INFO_SCALE; use mppt_common::INFO_SCALE;
use std::{path::Path, process::Command}; use std::path::Path;
const DEVICE_ID: u8 = 0x01; const DEVICE_ID: u8 = 0x01;
const RAM_DATA_SIZE: u16 = 0x005B; const RAM_DATA_SIZE: u16 = 0x005B;
@ -31,10 +31,6 @@ struct Args {
#[clap(short, long, default_value = DEFAULT_SERIAL)] #[clap(short, long, default_value = DEFAULT_SERIAL)]
serial_port: String, serial_port: String,
/// List serial ports on this system
#[clap(long)]
get_serial_ports: bool,
/// Preview changes without writing to EEPROM /// Preview changes without writing to EEPROM
#[clap(long)] #[clap(long)]
dry_run: bool, dry_run: bool,
@ -64,19 +60,6 @@ enum Commands {
fn main() { fn main() {
let args = Args::parse(); let args = Args::parse();
if args.get_serial_ports {
let output = Command::new("sh")
.arg("-c")
.arg("ls /dev/tty*")
.output()
.expect("failed to execute process");
let s = match std::str::from_utf8(&output.stdout) {
Ok(v) => v,
Err(e) => panic!("Failed reading internal command output: {}", e),
};
println!("{}", s);
return;
}
if !Path::new(&args.serial_port).exists() && !args.fake { if !Path::new(&args.serial_port).exists() && !args.fake {
println!( println!(