tool: Update dependencies

clap is only updated to 3.2 instead of 4.0 because I didn't want to deal
with all the changes.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2022-11-11 09:04:40 -07:00
committed by Jeremy Soller
parent cd28de382d
commit 1019878e3c
3 changed files with 109 additions and 77 deletions

120
tool/Cargo.lock generated
View File

@ -2,15 +2,6 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]]
name = "atty"
version = "0.2.14"
@ -22,6 +13,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bitflags"
version = "1.3.2"
@ -30,23 +27,32 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "cc"
version = "1.0.73"
version = "1.0.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f"
[[package]]
name = "clap"
version = "2.34.0"
version = "3.2.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5"
dependencies = [
"ansi_term",
"atty",
"bitflags",
"clap_lex",
"indexmap",
"strsim",
"termcolor",
"textwrap",
"unicode-width",
"vec_map",
]
[[package]]
name = "clap_lex"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
dependencies = [
"os_str_bytes",
]
[[package]]
@ -55,6 +61,12 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hermit-abi"
version = "0.1.19"
@ -66,9 +78,9 @@ dependencies = [
[[package]]
name = "hidapi"
version = "1.3.4"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2ec6bf425a5c3af047bb2a029de540a7d74cefa4761f14be67d7884dcd497b0"
checksum = "9d26e1151deaab68f34fbfd16d491a2a0170cf98d69d3efa23873b567a4199e1"
dependencies = [
"cc",
"libc",
@ -76,28 +88,53 @@ dependencies = [
]
[[package]]
name = "libc"
version = "0.2.121"
name = "indexmap"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.137"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
[[package]]
name = "os_str_bytes"
version = "6.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e"
[[package]]
name = "pkg-config"
version = "0.3.25"
version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
[[package]]
name = "redox_hwio"
version = "0.1.5"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9489d9e1b95e30ca0c6c5e9f5af5960ef838e4045eecd71db748248a7216778d"
checksum = "8eb516ad341a84372b5b15a5a35cf136ba901a639c8536f521b108253d7fce74"
dependencies = [
"lazy_static",
]
[[package]]
name = "strsim"
version = "0.8.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "system76_ectool"
@ -111,25 +148,19 @@ dependencies = [
]
[[package]]
name = "textwrap"
version = "0.11.0"
name = "termcolor"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"unicode-width",
"winapi-util",
]
[[package]]
name = "unicode-width"
version = "0.1.9"
name = "textwrap"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
[[package]]
name = "winapi"
@ -147,6 +178,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"

View File

@ -16,10 +16,10 @@ name = "system76_ectool"
required-features = ["std", "hidapi", "clap"]
[dependencies]
clap = { version = "2", optional = true }
clap = { version = "3.2", optional = true }
libc = { version = "0.2", optional = true }
hidapi = { version = "1.2", default-features = false, features = ["linux-shared-hidraw"], optional = true }
redox_hwio = { version = "0.1.4", optional = true }
hidapi = { version = "1.4", default-features = false, features = ["linux-shared-hidraw"], optional = true }
redox_hwio = { version = "0.1.6", optional = true }
downcast-rs = { version = "1.2.0", default-features = false }
[features]

View File

@ -16,10 +16,9 @@ use ectool::{
};
use hidapi::HidApi;
use std::{
fmt::Display,
fs,
process,
str::{self, FromStr},
str,
time::Duration,
thread,
};
@ -277,13 +276,6 @@ unsafe fn keymap_set(ec: &mut Ec<Box<dyn Access>>, layer: u8, output: u8, input:
ec.keymap_set(layer, output, input, value)
}
fn validate_from_str<T: FromStr>(s: String) -> Result<(), String>
where T::Err: Display {
s.parse::<T>()
.and(Ok(()))
.map_err(|err| format!("{}", err))
}
fn parse_color(s: &str) -> Result<(u8, u8, u8), String> {
let r = u8::from_str_radix(&s[0..2], 16);
let g = u8::from_str_radix(&s[2..4], 16);
@ -305,11 +297,11 @@ fn main() {
.subcommand(SubCommand::with_name("console"))
.subcommand(SubCommand::with_name("fan")
.arg(Arg::with_name("index")
.validator(validate_from_str::<u8>)
.value_parser(clap::value_parser!(u8))
.required(true)
)
.arg(Arg::with_name("duty")
.validator(validate_from_str::<u8>)
.value_parser(clap::value_parser!(u8))
)
)
.subcommand(SubCommand::with_name("flash")
@ -325,48 +317,48 @@ fn main() {
.subcommand(SubCommand::with_name("info"))
.subcommand(SubCommand::with_name("keymap")
.arg(Arg::with_name("layer")
.validator(validate_from_str::<u8>)
.value_parser(clap::value_parser!(u8))
.required(true)
)
.arg(Arg::with_name("output")
.validator(validate_from_str::<u8>)
.value_parser(clap::value_parser!(u8))
.required(true)
)
.arg(Arg::with_name("input")
.validator(validate_from_str::<u8>)
.value_parser(clap::value_parser!(u8))
.required(true)
)
.arg(Arg::with_name("value"))
)
.subcommand(SubCommand::with_name("led_color")
.arg(Arg::with_name("index")
.validator(validate_from_str::<u8>)
.value_parser(clap::value_parser!(u8))
.required(true)
)
.arg(Arg::with_name("value")
.validator(|x| parse_color(&x).and(Ok(())))
.value_parser(parse_color)
)
)
.subcommand(SubCommand::with_name("led_value")
.arg(Arg::with_name("index")
.validator(validate_from_str::<u8>)
.value_parser(clap::value_parser!(u8))
.required(true)
)
.arg(Arg::with_name("value")
.validator(validate_from_str::<u8>)
.value_parser(clap::value_parser!(u8))
)
)
.subcommand(SubCommand::with_name("led_mode")
.arg(Arg::with_name("layer")
.validator(validate_from_str::<u8>)
.value_parser(clap::value_parser!(u8))
.required(true)
)
.arg(Arg::with_name("mode")
.validator(validate_from_str::<u8>)
.value_parser(clap::value_parser!(u8))
.requires("speed")
)
.arg(Arg::with_name("speed")
.validator(validate_from_str::<u8>)
.value_parser(clap::value_parser!(u8))
)
)
.subcommand(SubCommand::with_name("led_save"))
@ -431,14 +423,14 @@ fn main() {
};
match matches.subcommand() {
("console", Some(_sub_m)) => match unsafe { console(&mut ec) } {
Some(("console", _sub_m)) => match unsafe { console(&mut ec) } {
Ok(()) => (),
Err(err) => {
eprintln!("failed to read console: {:X?}", err);
process::exit(1);
},
},
("fan", Some(sub_m)) => {
Some(("fan", sub_m)) => {
let index = sub_m.value_of("index").unwrap().parse::<u8>().unwrap();
let duty_opt = sub_m.value_of("duty").map(|x| x.parse::<u8>().unwrap());
match duty_opt {
@ -458,7 +450,7 @@ fn main() {
},
}
},
("flash", Some(sub_m)) => {
Some(("flash", sub_m)) => {
let path = sub_m.value_of("path").unwrap();
match unsafe { flash(&mut ec, path, SpiTarget::Main) } {
Ok(()) => (),
@ -468,7 +460,7 @@ fn main() {
},
}
},
("flash_backup", Some(sub_m)) => {
Some(("flash_backup", sub_m)) => {
let path = sub_m.value_of("path").unwrap();
match unsafe { flash(&mut ec, path, SpiTarget::Backup) } {
Ok(()) => (),
@ -478,14 +470,14 @@ fn main() {
},
}
},
("info", Some(_sub_m)) => match unsafe { info(&mut ec) } {
Some(("info", _sub_m)) => match unsafe { info(&mut ec) } {
Ok(()) => (),
Err(err) => {
eprintln!("failed to read info: {:X?}", err);
process::exit(1);
},
},
("keymap", Some(sub_m)) => {
Some(("keymap", sub_m)) => {
let layer = sub_m.value_of("layer").unwrap().parse::<u8>().unwrap();
let output = sub_m.value_of("output").unwrap().parse::<u8>().unwrap();
let input = sub_m.value_of("input").unwrap().parse::<u8>().unwrap();
@ -512,7 +504,7 @@ fn main() {
},
}
},
("led_color", Some(sub_m)) => {
Some(("led_color", sub_m)) => {
let index = sub_m.value_of("index").unwrap().parse::<u8>().unwrap();
let value = sub_m.value_of("value");
if let Some(value) = value {
@ -534,7 +526,7 @@ fn main() {
}
}
},
("led_value", Some(sub_m)) => {
Some(("led_value", sub_m)) => {
let index = sub_m.value_of("index").unwrap().parse::<u8>().unwrap();
let value = sub_m.value_of("value").map(|x| x.parse::<u8>().unwrap());
if let Some(value) = value {
@ -558,7 +550,7 @@ fn main() {
}
}
},
("led_mode", Some(sub_m)) => {
Some(("led_mode", sub_m)) => {
let layer = sub_m.value_of("layer").unwrap().parse::<u8>().unwrap();
let mode = sub_m.value_of("mode").map(|x| x.parse::<u8>().unwrap());
let speed = sub_m.value_of("speed").map(|x| x.parse::<u8>().unwrap());
@ -583,21 +575,21 @@ fn main() {
}
}
},
("led_save", Some(_sub_m)) => match unsafe { ec.led_save() } {
Some(("led_save", _sub_m)) => match unsafe { ec.led_save() } {
Ok(()) => (),
Err(err) => {
eprintln!("failed to save LED settings: {:X?}", err);
process::exit(1);
},
},
("matrix", Some(_sub_m)) => match unsafe { matrix(&mut ec) } {
Some(("matrix", _sub_m)) => match unsafe { matrix(&mut ec) } {
Ok(()) => (),
Err(err) => {
eprintln!("failed to read matrix: {:X?}", err);
process::exit(1);
},
},
("print", Some(sub_m)) => for arg in sub_m.values_of("message").unwrap() {
Some(("print", sub_m)) => for arg in sub_m.values_of("message").unwrap() {
let mut arg = arg.to_owned();
arg.push('\n');
match unsafe { print(&mut ec, arg.as_bytes()) } {
@ -608,7 +600,7 @@ fn main() {
},
}
},
("set_no_input", Some(sub_m)) => {
Some(("set_no_input", sub_m)) => {
let no_input = sub_m.value_of("value").unwrap().parse::<bool>().unwrap();
match unsafe { ec.set_no_input(no_input) } {
Ok(()) => (),