mirror of
https://github.com/italicsjenga/mppt-modbus.git
synced 2024-12-23 00:31:31 +11:00
remove get serial ports
This commit is contained in:
parent
770ed39767
commit
5ed34fe01c
19
src/main.rs
19
src/main.rs
|
@ -8,7 +8,7 @@ use mppt_common::datatypes::*;
|
|||
use mppt_common::mppt_structs::{MpptData, MpptEeprom, MpptRam};
|
||||
use mppt_common::Info;
|
||||
use mppt_common::INFO_SCALE;
|
||||
use std::{path::Path, process::Command};
|
||||
use std::path::Path;
|
||||
|
||||
const DEVICE_ID: u8 = 0x01;
|
||||
const RAM_DATA_SIZE: u16 = 0x005B;
|
||||
|
@ -31,10 +31,6 @@ struct Args {
|
|||
#[clap(short, long, default_value = DEFAULT_SERIAL)]
|
||||
serial_port: String,
|
||||
|
||||
/// List serial ports on this system
|
||||
#[clap(long)]
|
||||
get_serial_ports: bool,
|
||||
|
||||
/// Preview changes without writing to EEPROM
|
||||
#[clap(long)]
|
||||
dry_run: bool,
|
||||
|
@ -64,19 +60,6 @@ enum Commands {
|
|||
|
||||
fn main() {
|
||||
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 {
|
||||
println!(
|
||||
|
|
Loading…
Reference in a new issue