From 10709e2cdb0c68d1aee6eceb4dcf2531318e3126 Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Tue, 16 Sep 2025 19:12:01 +0000 Subject: [PATCH 01/15] Run cargo update --- Cargo.lock | 554 +++++++++++++++++++++++++++++------------------------ 1 file changed, 305 insertions(+), 249 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f642684..222b370 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,490 +1,546 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + [[package]] -name = "aho-corasick" -version = "0.6.8" +name = "addr2line" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ - "memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gimli", ] [[package]] -name = "ansi_term" -version = "0.11.0" +name = "adler2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] -name = "atty" -version = "0.2.11" +name = "aho-corasick" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr", ] [[package]] -name = "backtrace" -version = "0.3.9" +name = "ansi_term" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi", ] [[package]] -name = "backtrace-sys" -version = "0.1.24" +name = "atty" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", + "winapi", ] [[package]] -name = "bitflags" -version = "1.0.4" +name = "backtrace" +version = "0.3.75" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" +dependencies = [ + "addr2line", + "cfg-if 1.0.3", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets", +] [[package]] -name = "byteorder" -version = "1.2.6" +name = "bitflags" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] -name = "bytes" -version = "0.4.10" +name = "cc" +version = "1.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65193589c6404eb80b450d618eaf9a2cafaaafd57ecce47370519ef674a7bd44" dependencies = [ - "byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "find-msvc-tools", + "shlex", ] [[package]] -name = "cc" -version = "1.0.25" +name = "cfg-if" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" -version = "0.1.5" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "clap" -version = "2.32.0" +version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", ] [[package]] name = "env_logger" version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" dependencies = [ - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "humantime", + "log", + "regex", + "termcolor", ] [[package]] name = "error-chain" -version = "0.12.0" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" dependencies = [ - "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace", + "version_check", ] [[package]] -name = "gcc" -version = "0.3.55" +name = "find-msvc-tools" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fd99930f64d146689264c637b5af2f0233a933bef0d8570e2526bf9e083192d" + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glob" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "gpio-utils" -version = "0.2.0" +version = "0.3.0" dependencies = [ - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "sysfs_gpio 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "users 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "env_logger", + "error-chain", + "glob", + "lazy_static", + "log", + "nix 0.11.1", + "serde", + "serde_derive", + "sysfs_gpio", + "toml", + "users", ] [[package]] -name = "humantime" -version = "1.1.1" +name = "hermit-abi" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ - "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] -name = "iovec" -version = "0.1.2" +name = "humantime" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error", ] [[package]] name = "lazy_static" -version = "1.1.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.43" +version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" [[package]] name = "log" -version = "0.4.5" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" [[package]] name = "memchr" -version = "2.1.0" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "adler2", ] [[package]] name = "nix" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "becb657d662f1cd2ef38c7ad480ec6b8cf9e96b27adb543e594f9cf0f2e6065c" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "cc", + "cfg-if 0.1.10", + "libc", + "void", ] [[package]] name = "nix" -version = "0.11.0" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" +dependencies = [ + "bitflags", + "cc", + "cfg-if 0.1.10", + "libc", + "void", +] + +[[package]] +name = "object" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr", ] [[package]] name = "proc-macro2" -version = "0.4.20" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-ident", ] [[package]] name = "quick-error" -version = "1.2.2" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "0.6.8" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ - "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] -name = "redox_syscall" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "redox_termios" -version = "0.1.1" +name = "regex" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" dependencies = [ - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", ] [[package]] -name = "regex" -version = "1.0.5" +name = "regex-automata" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" dependencies = [ - "aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "memchr", + "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.2" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" [[package]] name = "rustc-demangle" -version = "0.1.9" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" [[package]] name = "serde" -version = "1.0.80" +version = "1.0.225" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6c24dee235d0da097043389623fb913daddf92c76e9f5a1db88607a0bcbd1d" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.225" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "659356f9a0cb1e529b24c01e43ad2bdf520ec4ceaf83047b83ddcc2251f96383" +dependencies = [ + "serde_derive", +] [[package]] name = "serde_derive" -version = "1.0.80" +version = "1.0.225" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea936adf78b1f766949a4977b91d2f5595825bd6ec079aa9543ad2685fc4516" dependencies = [ - "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.12 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "syn", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "strsim" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "0.15.12" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ - "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] name = "sysfs_gpio" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24961a55846623d8e4f6cec38718945116fed8d6970336a7110710a07aa9b5d1" dependencies = [ - "nix 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.14.1", ] [[package]] name = "termcolor" -version = "1.0.4" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ - "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util", ] [[package]] -name = "termion" -version = "1.5.1" +name = "textwrap" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] -name = "textwrap" -version = "0.10.0" +name = "toml" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" dependencies = [ - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde", ] [[package]] -name = "thread_local" -version = "0.3.6" +name = "unicode-ident" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" [[package]] -name = "toml" -version = "0.4.8" +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "users" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fed7d0912567d35f88010c23dbaf865e9da8b5227295e8dc0f2fdd109155ab7" dependencies = [ - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] -name = "ucd-util" -version = "0.1.1" +name = "vec_map" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] -name = "unicode-width" -version = "0.1.5" +name = "version_check" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] -name = "unicode-xid" -version = "0.1.0" +name = "void" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] -name = "users" -version = "0.8.0" +name = "winapi" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] -name = "utf8-ranges" -version = "1.0.1" +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] -name = "vec_map" -version = "0.8.1" +name = "winapi-util" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys", +] [[package]] -name = "version_check" -version = "0.1.5" +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "void" -version = "1.0.2" +name = "windows-link" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" [[package]] -name = "winapi" -version = "0.2.8" +name = "windows-sys" +version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e201184e40b2ede64bc2ea34968b28e33622acdbbf37104f0e4a33f7abe657aa" +dependencies = [ + "windows-link", +] [[package]] -name = "winapi" -version = "0.3.6" +name = "windows-targets" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" +name = "windows_aarch64_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] -name = "winapi-util" -version = "0.1.1" +name = "windows_aarch64_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] -name = "wincolor" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[metadata] -"checksum aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "68f56c7353e5a9547cbd76ed90f7bb5ffc3ba09d4ea9bd1d8c06c8b1142eeb5a" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" -"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" -"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" -"checksum byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "90492c5858dd7d2e78691cfb89f90d273a2800fc11d98f60786e5d87e2f83781" -"checksum bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0ce55bd354b095246fc34caf4e9e242f5297a7fd938b090cadfea6eee614aa62" -"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" -"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3" -"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" -"checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" -"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" -"checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" -"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e" -"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" -"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" -"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" -"checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f" -"checksum memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b3629fe9fdbff6daa6c33b90f7c08355c1aca05a3d01fa8063b822fcf185f3b" -"checksum nix 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b7fd5681d13fda646462cfbd4e5f2051279a89a544d50eb98c365b507246839f" -"checksum nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d37e713a259ff641624b6cb20e3b12b2952313ba36b6823c0f16e6cfd9e5de17" -"checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee" -"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" -"checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5" -"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" -"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2069749032ea3ec200ca51e4a31df41759190a88edca0d2d86ee8bedf7073341" -"checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d" -"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" -"checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef" -"checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c" -"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" -"checksum syn 0.15.12 (registry+https://github.com/rust-lang/crates.io-index)" = "34ab9797e47d24cb76b8dc4d24ff36807018c7cc549c4cba050b068be0c586b0" -"checksum sysfs_gpio 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3d68f2cae3c7d39f54ce8a858cc31ffb01974744ee65e5b4999b6037cd691e3f" -"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" -"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" -"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" -"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4a2ecc31b0351ea18b3fe11274b8db6e4d82bce861bbb22e6dbed40417902c65" -"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" -"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum users 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb3c80625ae5e77e1b402f8a0fa89afbd50622a6cae65128844720bd4e26b657" -"checksum utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd70f467df6810094968e2fce0ee1bd0e87157aceb026a8c083bcf5e25b9efe4" -"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" -"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" From 2d08bc23b8939d8404932c270a9a5511882f7579 Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Tue, 16 Sep 2025 19:12:48 +0000 Subject: [PATCH 02/15] Fix several clippy warnings --- src/commands/gpio_status.rs | 2 +- src/config.rs | 6 +++--- src/export.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/gpio_status.rs b/src/commands/gpio_status.rs index 04c2e39..b625bd4 100644 --- a/src/commands/gpio_status.rs +++ b/src/commands/gpio_status.rs @@ -23,7 +23,7 @@ pub fn main(config: &GpioConfig, opts: &GpioStatusOptions) { } }; print_pin_header(); - print_pin_row(&pin_config, true); + print_pin_row(pin_config, true); } None => { print_pin_header(); diff --git a/src/config.rs b/src/config.rs index 40d04b3..170449e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -114,10 +114,10 @@ impl FromStr for GpioConfig { type Err = Error; /// Load a GPIO configuration for the provided toml string fn from_str(config: &str) -> Result { - let cfg = toml::from_str(&config); + let cfg = toml::from_str(config); match cfg { Ok(cfg) => { - let val_config: GpioConfig = toml::from_str(&config).unwrap(); + let val_config: GpioConfig = toml::from_str(config).unwrap(); val_config.validate()?; Ok(cfg) } @@ -227,7 +227,7 @@ impl GpioConfig { /// Get the symlink root specified in the config (or the default) pub fn get_symlink_root(&self) -> &str { match self.config.symlink_root { - Some(ref root) => &root, + Some(ref root) => root, None => DEFAULT_SYMLINK_ROOT, } } diff --git a/src/export.rs b/src/export.rs index 9847b77..2aafe07 100644 --- a/src/export.rs +++ b/src/export.rs @@ -66,7 +66,7 @@ pub fn unexport(pin_config: &PinConfig, symlink_root: Option<&str>) -> Result<() /// /// 1. The GPIO pin itself is exported (via /sys/class/gpio/export) /// 2. For each GPIO name/alias, a symlink is created from -/// `/var/run/gpio/` -> `/sys/class/gpio`. +/// `/var/run/gpio/` -> `/sys/class/gpio`. /// /// If the GPIO is already exported, this function will continue /// without an error as the desired end state is achieved. From 6a940c7a6f24c08895430df373eebae0971a793d Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Tue, 16 Sep 2025 19:26:07 +0000 Subject: [PATCH 03/15] Update to edition 2024 --- Cargo.toml | 1 + src/commands/gpio_export.rs | 6 +++--- src/commands/gpio_exportall.rs | 6 +++--- src/commands/gpio_poll.rs | 4 ++-- src/commands/gpio_read.rs | 4 ++-- src/commands/gpio_status.rs | 6 +++--- src/commands/gpio_unexport.rs | 6 +++--- src/commands/gpio_unexportall.rs | 6 +++--- src/commands/gpio_write.rs | 4 ++-- src/export.rs | 4 ++-- 10 files changed, 24 insertions(+), 23 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fc92557..9117b02 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ license = "MIT/Apache-2.0" readme = "README.md" homepage = "https://github.com/rust-embedded/gpio-utils" keywords = ["gpio", "linux", "sysfs_gpio", "cli", "command-line"] +edition = "2024" description = """ Command-line utilities for interacting with GPIOs under Linux diff --git a/src/commands/gpio_export.rs b/src/commands/gpio_export.rs index c3c94d2..66430e3 100644 --- a/src/commands/gpio_export.rs +++ b/src/commands/gpio_export.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use config::GpioConfig; -use export; -use options::GpioExportOptions; +use crate::config::GpioConfig; +use crate::export; +use crate::options::GpioExportOptions; use std::process::exit; pub fn main(config: &GpioConfig, opts: &GpioExportOptions) { diff --git a/src/commands/gpio_exportall.rs b/src/commands/gpio_exportall.rs index c16fef3..846e81d 100644 --- a/src/commands/gpio_exportall.rs +++ b/src/commands/gpio_exportall.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use config::GpioConfig; -use export; -use options::GpioExportAllOptions; +use crate::config::GpioConfig; +use crate::export; +use crate::options::GpioExportAllOptions; use std::process::exit; pub fn main(config: &GpioConfig, opts: &GpioExportAllOptions) { diff --git a/src/commands/gpio_poll.rs b/src/commands/gpio_poll.rs index 84a7018..0f0efce 100644 --- a/src/commands/gpio_poll.rs +++ b/src/commands/gpio_poll.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use config::GpioConfig; -use options::GpioPollOptions; +use crate::config::GpioConfig; +use crate::options::GpioPollOptions; use std::process::exit; use sysfs_gpio::Edge; diff --git a/src/commands/gpio_read.rs b/src/commands/gpio_read.rs index 753f9d1..20db8bc 100644 --- a/src/commands/gpio_read.rs +++ b/src/commands/gpio_read.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use config::GpioConfig; -use options::GpioReadOptions; +use crate::config::GpioConfig; +use crate::options::GpioReadOptions; use std::process::exit; pub fn main(config: &GpioConfig, opts: &GpioReadOptions) { diff --git a/src/commands/gpio_status.rs b/src/commands/gpio_status.rs index b625bd4..1cabbed 100644 --- a/src/commands/gpio_status.rs +++ b/src/commands/gpio_status.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use config::GpioConfig; -use config::PinConfig; -use options::GpioStatusOptions; +use crate::config::GpioConfig; +use crate::config::PinConfig; +use crate::options::GpioStatusOptions; use std::process::exit; use sysfs_gpio::Direction; diff --git a/src/commands/gpio_unexport.rs b/src/commands/gpio_unexport.rs index 66089f3..f0325f3 100644 --- a/src/commands/gpio_unexport.rs +++ b/src/commands/gpio_unexport.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use config::GpioConfig; -use export; -use options::GpioUnexportOptions; +use crate::config::GpioConfig; +use crate::export; +use crate::options::GpioUnexportOptions; use std::process::exit; pub fn main(config: &GpioConfig, opts: &GpioUnexportOptions) { diff --git a/src/commands/gpio_unexportall.rs b/src/commands/gpio_unexportall.rs index 598b376..bb6aded 100644 --- a/src/commands/gpio_unexportall.rs +++ b/src/commands/gpio_unexportall.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use config::GpioConfig; -use export; -use options::GpioUnexportAllOptions; +use crate::config::GpioConfig; +use crate::export; +use crate::options::GpioUnexportAllOptions; use std::process::exit; pub fn main(config: &GpioConfig, opts: &GpioUnexportAllOptions) { diff --git a/src/commands/gpio_write.rs b/src/commands/gpio_write.rs index d157e0d..c97564a 100644 --- a/src/commands/gpio_write.rs +++ b/src/commands/gpio_write.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use config::GpioConfig; -use options::GpioWriteOptions; +use crate::config::GpioConfig; +use crate::options::GpioWriteOptions; use std::process::exit; use sysfs_gpio::Direction; diff --git a/src/export.rs b/src/export.rs index 2aafe07..788b918 100644 --- a/src/export.rs +++ b/src/export.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use config::PinConfig; -use error::*; +use crate::config::PinConfig; +use crate::error::*; use nix::unistd::{chown, Gid, Uid}; use std::fs; use std::io::ErrorKind; From 44979aec2f3afd5a79db125212e4487e37e66b0a Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Tue, 16 Sep 2025 19:54:15 +0000 Subject: [PATCH 04/15] Silence warning about cfg introduced by error_chain --- Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 9117b02..a342e07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,3 +32,7 @@ users = "0.8" [[bin]] name = "gpio" path = "src/main.rs" + +[lints.rust] +# The cfg `has_error_description_deprecated` is introduced by the error_chain crate. +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(has_error_description_deprecated)'] } From 2fab682ba4410f41a6426616c4592130ebac028b Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Tue, 16 Sep 2025 19:56:11 +0000 Subject: [PATCH 05/15] Update sysfs_gpio dependency to version 0.6.2 --- Cargo.lock | 29 ++++++++++++++++++++++------- Cargo.toml | 2 +- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 222b370..4064bef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,6 +46,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + [[package]] name = "backtrace" version = "0.3.75" @@ -205,6 +211,15 @@ version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -229,15 +244,15 @@ dependencies = [ [[package]] name = "nix" -version = "0.14.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" +checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" dependencies = [ "bitflags", "cc", - "cfg-if 0.1.10", + "cfg-if 1.0.3", "libc", - "void", + "memoffset", ] [[package]] @@ -362,11 +377,11 @@ dependencies = [ [[package]] name = "sysfs_gpio" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24961a55846623d8e4f6cec38718945116fed8d6970336a7110710a07aa9b5d1" +checksum = "e8808c55bc926565c62ef7838bcaa8add51585236803e2bdfa1472e3a3ab5e17" dependencies = [ - "nix 0.14.1", + "nix 0.23.2", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a342e07..9953481 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ Rust applications or any other applications. [dependencies] clap = "2.2" error-chain = "0.12" -sysfs_gpio = "0.5.2" +sysfs_gpio = "0.6.2" toml = "0.4" glob = "0.2" lazy_static = "1.1" From a76cd74add10aaa23fae98ef3351bed9c406bfa3 Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Tue, 16 Sep 2025 21:00:21 +0000 Subject: [PATCH 06/15] cargo fmt --- src/export.rs | 10 +-- src/main.rs | 230 +++++++++++++++++++++++++++++--------------------- 2 files changed, 136 insertions(+), 104 deletions(-) diff --git a/src/export.rs b/src/export.rs index 788b918..3d15236 100644 --- a/src/export.rs +++ b/src/export.rs @@ -8,7 +8,7 @@ use crate::config::PinConfig; use crate::error::*; -use nix::unistd::{chown, Gid, Uid}; +use nix::unistd::{Gid, Uid, chown}; use std::fs; use std::io::ErrorKind; use std::os::unix::fs as unix_fs; @@ -126,14 +126,10 @@ pub fn export(pin_config: &PinConfig, symlink_root: Option<&str>) -> Result<()> fs::create_dir_all(symroot)?; // set active low - pin_config - .get_pin() - .set_active_low(pin_config.active_low)?; + pin_config.get_pin().set_active_low(pin_config.active_low)?; // set the pin direction - pin_config - .get_pin() - .set_direction(pin_config.direction)?; + pin_config.get_pin().set_direction(pin_config.direction)?; // create symlink for each name for name in &pin_config.names { diff --git a/src/main.rs b/src/main.rs index 6e77562..1a29246 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,112 +23,148 @@ fn main() { .version(env!("CARGO_PKG_VERSION")) .about("Read, Write, and Configure GPIOs") .setting(AppSettings::SubcommandRequired) - // Global options - .arg(Arg::with_name("config") - .help("additional configuration to use") - .takes_value(true) - .short("c") - .long("config") - .multiple(true) - .required(false)) - + .arg( + Arg::with_name("config") + .help("additional configuration to use") + .takes_value(true) + .short("c") + .long("config") + .multiple(true) + .required(false), + ) // gpio read - .subcommand(SubCommand::with_name("read") - .about("Read the value of a GPIO Input") - .arg(Arg::with_name("pin") - .help("The pin name (or number)") - .index(1) - .required(true))) - + .subcommand( + SubCommand::with_name("read") + .about("Read the value of a GPIO Input") + .arg( + Arg::with_name("pin") + .help("The pin name (or number)") + .index(1) + .required(true), + ), + ) // gpio poll - .subcommand(SubCommand::with_name("poll") - .about("Wait for an event to happen on a GPIO Input") - .arg(Arg::with_name("pin") - .help("The pin name (or number)") - .index(1) - .required(true)) - .arg(Arg::with_name("timeout") - .help("Timeout (in ms) for the poll operation (-1 to wait forever, default)") - .takes_value(true) - .short("t") - .long("timeout") - .required(false)) - .arg(Arg::with_name("edge") - .help("The edge to poll on") - .takes_value(true) - .short("e") - .long("edge") - .required(false))) - + .subcommand( + SubCommand::with_name("poll") + .about("Wait for an event to happen on a GPIO Input") + .arg( + Arg::with_name("pin") + .help("The pin name (or number)") + .index(1) + .required(true), + ) + .arg( + Arg::with_name("timeout") + .help( + "Timeout (in ms) for the poll operation (-1 to wait forever, default)", + ) + .takes_value(true) + .short("t") + .long("timeout") + .required(false), + ) + .arg( + Arg::with_name("edge") + .help("The edge to poll on") + .takes_value(true) + .short("e") + .long("edge") + .required(false), + ), + ) // gpio write - .subcommand(SubCommand::with_name("write") - .about("Write the value of a GPIO Output") - .arg(Arg::with_name("pin") - .help("The pin name (or number)") - .index(1) - .required(true)) - .arg(Arg::with_name("value") - .help("Value to write to pin (0|1)") - .index(2) - .required(true))) - + .subcommand( + SubCommand::with_name("write") + .about("Write the value of a GPIO Output") + .arg( + Arg::with_name("pin") + .help("The pin name (or number)") + .index(1) + .required(true), + ) + .arg( + Arg::with_name("value") + .help("Value to write to pin (0|1)") + .index(2) + .required(true), + ), + ) // gpio export - .subcommand(SubCommand::with_name("export") - .about("Export a given GPIO") - .arg(Arg::with_name("pin") - .help("The pin name (or number)") - .index(1) - .required(true)) - .arg(Arg::with_name("symlink-root") - .help("root directory for export symlinks") - .takes_value(true) - .short("r") - .long("symlink-root") - .required(false))) - + .subcommand( + SubCommand::with_name("export") + .about("Export a given GPIO") + .arg( + Arg::with_name("pin") + .help("The pin name (or number)") + .index(1) + .required(true), + ) + .arg( + Arg::with_name("symlink-root") + .help("root directory for export symlinks") + .takes_value(true) + .short("r") + .long("symlink-root") + .required(false), + ), + ) // gpio export-all - .subcommand(SubCommand::with_name("export-all") - .about("Export all configured GPIOs") - .arg(Arg::with_name("symlink-root") - .help("root directory for export symlinks") - .takes_value(true) - .short("r") - .long("symlink-root") - .required(false))) - + .subcommand( + SubCommand::with_name("export-all") + .about("Export all configured GPIOs") + .arg( + Arg::with_name("symlink-root") + .help("root directory for export symlinks") + .takes_value(true) + .short("r") + .long("symlink-root") + .required(false), + ), + ) // gpio unexport - .subcommand(SubCommand::with_name("unexport") - .about("Unexport a given GPIO") - .arg(Arg::with_name("pin") - .help("The pin name (or number)") - .index(1) - .required(true)) - .arg(Arg::with_name("symlink-root") - .help("root directory for export symlinks") - .takes_value(true) - .short("r") - .long("symlink-root") - .required(false))) - + .subcommand( + SubCommand::with_name("unexport") + .about("Unexport a given GPIO") + .arg( + Arg::with_name("pin") + .help("The pin name (or number)") + .index(1) + .required(true), + ) + .arg( + Arg::with_name("symlink-root") + .help("root directory for export symlinks") + .takes_value(true) + .short("r") + .long("symlink-root") + .required(false), + ), + ) // gpio unexport-all - .subcommand(SubCommand::with_name("unexport-all") - .about("Unexport all configured, exported GPIOs") - .arg(Arg::with_name("symlink-root") - .help("root directory for export symlinks") - .takes_value(true) - .short("r") - .long("symlink-root") - .required(false))) - + .subcommand( + SubCommand::with_name("unexport-all") + .about("Unexport all configured, exported GPIOs") + .arg( + Arg::with_name("symlink-root") + .help("root directory for export symlinks") + .takes_value(true) + .short("r") + .long("symlink-root") + .required(false), + ), + ) // gpio status - .subcommand(SubCommand::with_name("status") - .about("Output status of a GPIO or all GPIOs if no pin is specified") - .arg(Arg::with_name("pin") - .help("The pin name (or number)") - .index(1) - .required(false))) - + .subcommand( + SubCommand::with_name("status") + .about("Output status of a GPIO or all GPIOs if no pin is specified") + .arg( + Arg::with_name("pin") + .help("The pin name (or number)") + .index(1) + .required(false), + ), + ) .get_matches(); // process global options From 1aaf90cfdfdb6baa6724c12a4539915b36595759 Mon Sep 17 00:00:00 2001 From: Christian Meusel Date: Tue, 16 Sep 2025 23:18:51 +0200 Subject: [PATCH 07/15] Clean up use clauses for dependencies Nowaday's Rust requires way less verbosity here and allows to specify the macros to import into scope explicitly. --- src/config.rs | 1 + src/error.rs | 1 + src/export.rs | 1 + src/lib.rs | 14 -------------- 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/config.rs b/src/config.rs index 170449e..6dc6b2d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -7,6 +7,7 @@ // except according to those terms. use glob::glob; +use serde_derive::Deserialize; use std::collections::{BTreeSet, HashMap}; use std::fmt; use std::fs::{self, File}; diff --git a/src/error.rs b/src/error.rs index 0ac667e..230ee9c 100644 --- a/src/error.rs +++ b/src/error.rs @@ -6,6 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use error_chain::error_chain; use nix::Error as NixError; use std::io::Error as IoError; use sysfs_gpio::Error as GpioError; diff --git a/src/export.rs b/src/export.rs index 3d15236..446b110 100644 --- a/src/export.rs +++ b/src/export.rs @@ -8,6 +8,7 @@ use crate::config::PinConfig; use crate::error::*; +use lazy_static::lazy_static; use nix::unistd::{Gid, Uid, chown}; use std::fs; use std::io::ErrorKind; diff --git a/src/lib.rs b/src/lib.rs index 90f0eed..39291cb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,20 +6,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[macro_use] -extern crate error_chain; -extern crate glob; -#[macro_use] -extern crate lazy_static; -extern crate log; -extern crate nix; -extern crate serde; -#[macro_use] -extern crate serde_derive; -extern crate sysfs_gpio; -extern crate toml; -extern crate users; - pub mod commands; pub mod config; pub mod error; From 6991e439fdbfb586b5346d7f69b0042e84c8b888 Mon Sep 17 00:00:00 2001 From: Christian Meusel Date: Tue, 16 Sep 2025 23:27:41 +0200 Subject: [PATCH 08/15] Replace unmaintained dep users with more active uzers --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- src/export.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4064bef..6132a62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -166,7 +166,7 @@ dependencies = [ "serde_derive", "sysfs_gpio", "toml", - "users", + "uzers", ] [[package]] @@ -424,10 +424,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] -name = "users" -version = "0.8.1" +name = "uzers" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fed7d0912567d35f88010c23dbaf865e9da8b5227295e8dc0f2fdd109155ab7" +checksum = "4df81ff504e7d82ad53e95ed1ad5b72103c11253f39238bcc0235b90768a97dd" dependencies = [ "libc", ] diff --git a/Cargo.toml b/Cargo.toml index 9953481..3bbcddc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ env_logger = "0.5" nix = "0.11" serde_derive = "1.0" serde = "1.0" -users = "0.8" +uzers = { version = "0.12.1", default-features = false, features = ["cache"] } [[bin]] name = "gpio" diff --git a/src/export.rs b/src/export.rs index 446b110..b5f9f90 100644 --- a/src/export.rs +++ b/src/export.rs @@ -17,7 +17,7 @@ use std::os::unix::fs::PermissionsExt; use std::path; use std::sync::Mutex; use sysfs_gpio; -use users::{Groups, Users, UsersCache}; +use uzers::{Groups, Users, UsersCache}; lazy_static! { static ref USERS_CACHE: Mutex = Mutex::new(UsersCache::new()); From 4df6a2c2b8579ad7232b17937ed59275512e4e5e Mon Sep 17 00:00:00 2001 From: Christian Meusel Date: Tue, 16 Sep 2025 23:41:53 +0200 Subject: [PATCH 09/15] Set MSRV to 1.75.0 as shipped by today's Yocto This inlcludes updating some formatting and pinning backtrace to the latest version supporting this Rust version. --- Cargo.lock | 7 ++++--- Cargo.toml | 6 +++++- src/export.rs | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6132a62..9afbbdc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 4 +version = 3 [[package]] name = "addr2line" @@ -54,9 +54,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "backtrace" -version = "0.3.75" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", "cfg-if 1.0.3", @@ -155,6 +155,7 @@ checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" name = "gpio-utils" version = "0.3.0" dependencies = [ + "backtrace", "clap", "env_logger", "error-chain", diff --git a/Cargo.toml b/Cargo.toml index 3bbcddc..59b045d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,8 @@ license = "MIT/Apache-2.0" readme = "README.md" homepage = "https://github.com/rust-embedded/gpio-utils" keywords = ["gpio", "linux", "sysfs_gpio", "cli", "command-line"] -edition = "2024" +edition = "2021" +rust-version = "1.75.0" description = """ Command-line utilities for interacting with GPIOs under Linux @@ -29,6 +30,9 @@ serde_derive = "1.0" serde = "1.0" uzers = { version = "0.12.1", default-features = false, features = ["cache"] } +# TODO Unpin this dependency after bumping our MSRV beyond 1.75.0. +backtrace = "=0.3.74" + [[bin]] name = "gpio" path = "src/main.rs" diff --git a/src/export.rs b/src/export.rs index b5f9f90..5ec994e 100644 --- a/src/export.rs +++ b/src/export.rs @@ -9,7 +9,7 @@ use crate::config::PinConfig; use crate::error::*; use lazy_static::lazy_static; -use nix::unistd::{Gid, Uid, chown}; +use nix::unistd::{chown, Gid, Uid}; use std::fs; use std::io::ErrorKind; use std::os::unix::fs as unix_fs; From 84b98f5bd908a62e6550934bebbd1a3132922e7e Mon Sep 17 00:00:00 2001 From: Christian Meusel Date: Mon, 22 Sep 2025 17:00:05 +0200 Subject: [PATCH 10/15] Bump clap and switch from builder to derive --- Cargo.lock | 261 ++++++++++++++++++++++++++++++-------- Cargo.toml | 2 +- src/main.rs | 353 +++++++++++++++++++--------------------------------- 3 files changed, 337 insertions(+), 279 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9afbbdc..24f2c66 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,12 +27,53 @@ dependencies = [ ] [[package]] -name = "ansi_term" -version = "0.12.1" +name = "anstream" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192" dependencies = [ - "winapi", + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +dependencies = [ + "windows-sys 0.60.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.60.2", ] [[package]] @@ -64,7 +105,7 @@ dependencies = [ "miniz_oxide", "object", "rustc-demangle", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -75,9 +116,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "cc" -version = "1.2.37" +version = "1.2.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65193589c6404eb80b450d618eaf9a2cafaaafd57ecce47370519ef674a7bd44" +checksum = "80f41ae168f955c12fb8960b057d70d0ca153fb83182b57d86380443527be7e9" dependencies = [ "find-msvc-tools", "shlex", @@ -97,19 +138,50 @@ checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "clap" -version = "2.34.0" +version = "4.5.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "e2134bb3ea021b78629caa971416385309e0131b351b25e01dc16fb54e1b5fae" dependencies = [ - "ansi_term", - "atty", - "bitflags", + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2ba64afa3c0a6df7fa517765e31314e983f51dda798ffba27b988194fb65dc9" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", "strsim", - "textwrap", - "unicode-width", - "vec_map", ] +[[package]] +name = "clap_derive" +version = "4.5.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "env_logger" version = "0.5.13" @@ -135,9 +207,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fd99930f64d146689264c637b5af2f0233a933bef0d8570e2526bf9e083192d" +checksum = "1ced73b1dacfc750a6db6c0a0c3a3853c8b41997e2e2c563dc90804ae6867959" [[package]] name = "gimli" @@ -170,6 +242,12 @@ dependencies = [ "uzers", ] +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -188,6 +266,12 @@ dependencies = [ "quick-error", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "lazy_static" version = "1.5.0" @@ -265,6 +349,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + [[package]] name = "proc-macro2" version = "1.0.101" @@ -326,27 +416,27 @@ checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" [[package]] name = "serde" -version = "1.0.225" +version = "1.0.226" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6c24dee235d0da097043389623fb913daddf92c76e9f5a1db88607a0bcbd1d" +checksum = "0dca6411025b24b60bfa7ec1fe1f8e710ac09782dca409ee8237ba74b51295fd" dependencies = [ "serde_core", ] [[package]] name = "serde_core" -version = "1.0.225" +version = "1.0.226" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "659356f9a0cb1e529b24c01e43ad2bdf520ec4ceaf83047b83ddcc2251f96383" +checksum = "ba2ba63999edb9dac981fb34b3e5c0d111a69b0924e253ed29d83f7c99e966a4" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.225" +version = "1.0.226" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea936adf78b1f766949a4977b91d2f5595825bd6ec079aa9543ad2685fc4516" +checksum = "8db53ae22f34573731bafa1db20f04027b2d25e02d8205921b569171699cdb33" dependencies = [ "proc-macro2", "quote", @@ -361,9 +451,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "strsim" -version = "0.8.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" @@ -394,15 +484,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - [[package]] name = "toml" version = "0.4.10" @@ -419,10 +500,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" [[package]] -name = "unicode-width" -version = "0.1.14" +name = "utf8parse" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uzers" @@ -433,12 +514,6 @@ dependencies = [ "libc", ] -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.5" @@ -473,7 +548,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys", + "windows-sys 0.61.0", ] [[package]] @@ -482,19 +557,34 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + [[package]] name = "windows-link" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.3", +] + [[package]] name = "windows-sys" version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e201184e40b2ede64bc2ea34968b28e33622acdbbf37104f0e4a33f7abe657aa" dependencies = [ - "windows-link", + "windows-link 0.2.0", ] [[package]] @@ -503,14 +593,31 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" +dependencies = [ + "windows-link 0.1.3", + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", ] [[package]] @@ -519,44 +626,92 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" diff --git a/Cargo.toml b/Cargo.toml index 59b045d..e92b9c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ Rust applications or any other applications. """ [dependencies] -clap = "2.2" +clap = { version = "4.5", features = ["derive"] } error-chain = "0.12" sysfs_gpio = "0.6.2" toml = "0.4" diff --git a/src/main.rs b/src/main.rs index 1a29246..714577a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,267 +5,170 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate clap; -extern crate env_logger; -extern crate gpio_utils; -extern crate log; -use clap::{App, AppSettings, Arg, SubCommand}; +use clap::{Parser, Subcommand}; use gpio_utils::commands::*; use gpio_utils::config::{self, GpioConfig}; use gpio_utils::options::*; -use std::process::exit; +use std::process; + +#[derive(Parser)] +#[command( + name = "GPIO Utils", + version, + about = "Read, Write, and Configure GPIOs" +)] +struct Cli { + /// additional configuration to use + #[arg(short, long)] + configs: Vec, + #[command(subcommand)] + command: Commands, +} + +#[derive(Subcommand)] +enum Commands { + /// Read the value of a GPIO Input + Read { + /// The pin name (or number) + pin: String, + }, + /// Wait for an event to happen on a GPIO Input + Poll { + /// The pin name (or number) + pin: String, + /// Timeout (in ms) for the poll operation (-1 to wait forever, default) + #[arg(short, long)] + timeout: Option, + /// The edge to poll on + #[arg(short, long)] + edge: Option, + }, + /// Write the value of a GPIO Output + Write { + /// The pin name (or number) + pin: String, + /// Value to write to pin (0|1) + value: u8, + }, + /// Export a given GPIO + Export { + /// The pin name (or number) + pin: String, + /// root directory for export symlinks + #[arg(short = 'r', long)] + symlink_root: Option, + }, + /// Export all configured GPIOs + ExportAll { + /// Export all configured GPIOs + #[arg(short = 'r', long)] + symlink_root: Option, + }, + /// Export all configured GPIOs + Unexport { + /// The pin name (or number) + pin: String, + /// root directory for export symlinks + #[arg(short = 'r', long)] + symlink_root: Option, + }, + /// Unexport all configured, exported GPIOs + UnexportAll { + /// root directory for export symlinks + #[arg(short = 'r', long)] + symlink_root: Option, + }, + /// Output status of a GPIO or all GPIOs if no pin is specified + Status { + /// The pin name (or number) + pin: Option, + }, +} fn main() { env_logger::init(); - let matches = App::new("GPIO Utils") - .version(env!("CARGO_PKG_VERSION")) - .about("Read, Write, and Configure GPIOs") - .setting(AppSettings::SubcommandRequired) - // Global options - .arg( - Arg::with_name("config") - .help("additional configuration to use") - .takes_value(true) - .short("c") - .long("config") - .multiple(true) - .required(false), - ) - // gpio read - .subcommand( - SubCommand::with_name("read") - .about("Read the value of a GPIO Input") - .arg( - Arg::with_name("pin") - .help("The pin name (or number)") - .index(1) - .required(true), - ), - ) - // gpio poll - .subcommand( - SubCommand::with_name("poll") - .about("Wait for an event to happen on a GPIO Input") - .arg( - Arg::with_name("pin") - .help("The pin name (or number)") - .index(1) - .required(true), - ) - .arg( - Arg::with_name("timeout") - .help( - "Timeout (in ms) for the poll operation (-1 to wait forever, default)", - ) - .takes_value(true) - .short("t") - .long("timeout") - .required(false), - ) - .arg( - Arg::with_name("edge") - .help("The edge to poll on") - .takes_value(true) - .short("e") - .long("edge") - .required(false), - ), - ) - // gpio write - .subcommand( - SubCommand::with_name("write") - .about("Write the value of a GPIO Output") - .arg( - Arg::with_name("pin") - .help("The pin name (or number)") - .index(1) - .required(true), - ) - .arg( - Arg::with_name("value") - .help("Value to write to pin (0|1)") - .index(2) - .required(true), - ), - ) - // gpio export - .subcommand( - SubCommand::with_name("export") - .about("Export a given GPIO") - .arg( - Arg::with_name("pin") - .help("The pin name (or number)") - .index(1) - .required(true), - ) - .arg( - Arg::with_name("symlink-root") - .help("root directory for export symlinks") - .takes_value(true) - .short("r") - .long("symlink-root") - .required(false), - ), - ) - // gpio export-all - .subcommand( - SubCommand::with_name("export-all") - .about("Export all configured GPIOs") - .arg( - Arg::with_name("symlink-root") - .help("root directory for export symlinks") - .takes_value(true) - .short("r") - .long("symlink-root") - .required(false), - ), - ) - // gpio unexport - .subcommand( - SubCommand::with_name("unexport") - .about("Unexport a given GPIO") - .arg( - Arg::with_name("pin") - .help("The pin name (or number)") - .index(1) - .required(true), - ) - .arg( - Arg::with_name("symlink-root") - .help("root directory for export symlinks") - .takes_value(true) - .short("r") - .long("symlink-root") - .required(false), - ), - ) - // gpio unexport-all - .subcommand( - SubCommand::with_name("unexport-all") - .about("Unexport all configured, exported GPIOs") - .arg( - Arg::with_name("symlink-root") - .help("root directory for export symlinks") - .takes_value(true) - .short("r") - .long("symlink-root") - .required(false), - ), - ) - // gpio status - .subcommand( - SubCommand::with_name("status") - .about("Output status of a GPIO or all GPIOs if no pin is specified") - .arg( - Arg::with_name("pin") - .help("The pin name (or number)") - .index(1) - .required(false), - ), - ) - .get_matches(); + let cli = Cli::parse(); - // process global options - let gpio_options = GpioOptions { - configs: matches.values_of_lossy("config").unwrap_or_default(), + let gpio_opts = GpioOptions { + configs: cli.configs.clone(), }; // parse the config - let cfg = match GpioConfig::load(&gpio_options.configs[..]) { + let cfg = match GpioConfig::load(&gpio_opts.configs[..]) { Ok(cfg) => cfg, Err(config::Error::NoConfigFound) => Default::default(), Err(e) => { println!("Error parsing config. Details follow..."); println!("{}", e); - std::process::exit(1); + process::exit(1); } }; - match matches.subcommand() { - ("read", Some(m)) => { - let read_options = GpioReadOptions { - gpio_opts: gpio_options, - pin: m.value_of("pin").unwrap(), + // TODO: Why are we passing the gpio_options and the config parsed from it to `gpio_read::main` + // and the other handlers? + match cli.command { + Commands::Read { pin } => { + let options = GpioReadOptions { + gpio_opts, + pin: &pin, }; - gpio_read::main(&cfg, &read_options); + gpio_read::main(&cfg, &options); } - ("poll", Some(m)) => { - let timeout = m.value_of("timeout").map(|timeout| { - timeout.parse::().unwrap_or_else(|_| { - println!("Unable to parse timeout value {:?} as integer", timeout); - exit(1); - }) - }); - let poll_options = GpioPollOptions { - gpio_opts: gpio_options, - edge: m.value_of("edge").unwrap_or("both"), - pin: m.value_of("pin").unwrap(), + Commands::Poll { pin, timeout, edge } => { + let options = GpioPollOptions { + gpio_opts, timeout, + edge: &edge.unwrap_or_else(|| String::from("both")), + pin: &pin, }; - gpio_poll::main(&cfg, &poll_options); + gpio_poll::main(&cfg, &options); } - ("write", Some(m)) => { - let write_options = GpioWriteOptions { - gpio_opts: gpio_options, - pin: m.value_of("pin").unwrap(), - value: match m.value_of("value").unwrap().parse::() { - Ok(value) => value, - Err(_) => { - println!( - "Provided value {:?} is not valid", - m.value_of("value").unwrap() - ); - exit(1); - } - }, + Commands::Write { pin, value } => { + let options = GpioWriteOptions { + gpio_opts, + pin: &pin, + value, }; - gpio_write::main(&cfg, &write_options); + gpio_write::main(&cfg, &options); } - ("export", Some(m)) => { - let export_options = GpioExportOptions { - gpio_opts: gpio_options, - pin: m.value_of("pin").unwrap(), - symlink_root: match m.value_of("symlink-root") { - Some(slr) => Some(slr), - None => None, - }, + Commands::Export { pin, symlink_root } => { + let options = GpioExportOptions { + gpio_opts, + pin: &pin, + symlink_root: symlink_root.as_deref(), }; - gpio_export::main(&cfg, &export_options); + gpio_export::main(&cfg, &options); } - ("export-all", Some(m)) => { - let exportall_options = GpioExportAllOptions { - gpio_opts: gpio_options, - symlink_root: match m.value_of("symlink-root") { - Some(slr) => Some(slr), - None => None, - }, + Commands::ExportAll { symlink_root } => { + let options = GpioExportAllOptions { + gpio_opts, + symlink_root: symlink_root.as_deref(), }; - gpio_exportall::main(&cfg, &exportall_options); + gpio_exportall::main(&cfg, &options); } - ("unexport", Some(m)) => { - let unexport_options = GpioUnexportOptions { - gpio_opts: gpio_options, - pin: m.value_of("pin").unwrap(), - symlink_root: m.value_of("symlink-root"), + Commands::Unexport { pin, symlink_root } => { + let options = GpioUnexportOptions { + gpio_opts, + pin: &pin, + symlink_root: symlink_root.as_deref(), }; - gpio_unexport::main(&cfg, &unexport_options); + gpio_unexport::main(&cfg, &options); } - ("unexport-all", Some(m)) => { - let unexportall_options = GpioUnexportAllOptions { - gpio_opts: gpio_options, - symlink_root: m.value_of("symlink-root"), + Commands::UnexportAll { symlink_root } => { + let options = GpioUnexportAllOptions { + gpio_opts, + symlink_root: symlink_root.as_deref(), }; - gpio_unexportall::main(&cfg, &unexportall_options); + gpio_unexportall::main(&cfg, &options); } - ("status", Some(m)) => { - let status_options = GpioStatusOptions { - gpio_opts: gpio_options, - pin: m.value_of("pin"), + Commands::Status { pin } => { + let options = GpioStatusOptions { + gpio_opts, + pin: pin.as_deref(), }; - gpio_status::main(&cfg, &status_options); + gpio_status::main(&cfg, &options); } - _ => {} } } From e8c58812d656150c06dd7555ade00786f595d670 Mon Sep 17 00:00:00 2001 From: Christian Meusel Date: Mon, 22 Sep 2025 18:02:04 +0200 Subject: [PATCH 11/15] Bump remaining dependencies This requires pinning some transitive dependencies whose MSRV got bumped beyond 1.75.0. --- Cargo.lock | 236 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 17 ++-- 2 files changed, 128 insertions(+), 125 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 24f2c66..9c57e96 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -62,7 +62,7 @@ version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" dependencies = [ - "windows-sys 0.60.2", + "windows-sys", ] [[package]] @@ -73,18 +73,7 @@ checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.60.2", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", + "windows-sys", ] [[package]] @@ -100,7 +89,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cfg-if 1.0.3", + "cfg-if", "libc", "miniz_oxide", "object", @@ -114,6 +103,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" + [[package]] name = "cc" version = "1.2.38" @@ -126,15 +121,15 @@ dependencies = [ [[package]] name = "cfg-if" -version = "0.1.10" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] -name = "cfg-if" -version = "1.0.3" +name = "cfg_aliases" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "clap" @@ -183,16 +178,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] -name = "env_logger" -version = "0.5.13" +name = "env_filter" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" dependencies = [ - "atty", - "humantime", "log", "regex", - "termcolor", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -219,9 +224,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glob" -version = "0.2.11" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "gpio-utils" @@ -234,11 +239,14 @@ dependencies = [ "glob", "lazy_static", "log", - "nix 0.11.1", + "nix 0.30.1", "serde", "serde_derive", + "serde_spanned", "sysfs_gpio", "toml", + "toml_datetime", + "toml_parser", "uzers", ] @@ -249,28 +257,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] -name = "hermit-abi" -version = "0.1.19" +name = "is_terminal_polyfill" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] -name = "humantime" -version = "1.3.0" +name = "jiff" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" dependencies = [ - "quick-error", + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde", ] [[package]] -name = "is_terminal_polyfill" -version = "1.70.1" +name = "jiff-static" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "lazy_static" @@ -316,28 +330,27 @@ dependencies = [ [[package]] name = "nix" -version = "0.11.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "becb657d662f1cd2ef38c7ad480ec6b8cf9e96b27adb543e594f9cf0f2e6065c" +checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cc", - "cfg-if 0.1.10", + "cfg-if", "libc", - "void", + "memoffset", ] [[package]] name = "nix" -version = "0.23.2" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" dependencies = [ - "bitflags", - "cc", - "cfg-if 1.0.3", + "bitflags 2.9.4", + "cfg-if", + "cfg_aliases", "libc", - "memoffset", ] [[package]] @@ -355,6 +368,21 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" +[[package]] +name = "portable-atomic" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "proc-macro2" version = "1.0.101" @@ -364,12 +392,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - [[package]] name = "quote" version = "1.0.40" @@ -443,6 +465,15 @@ dependencies = [ "syn", ] +[[package]] +name = "serde_spanned" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2789234a13a53fc4be1b51ea1bab45a3c338bdb884862a257d10e5a74ae009e6" +dependencies = [ + "serde_core", +] + [[package]] name = "shlex" version = "1.3.0" @@ -476,21 +507,34 @@ dependencies = [ ] [[package]] -name = "termcolor" -version = "1.4.1" +name = "toml" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +checksum = "ae2a4cf385da23d1d53bc15cdfa5c2109e93d8d362393c801e87da2f72f0e201" dependencies = [ - "winapi-util", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "winnow", ] [[package]] -name = "toml" -version = "0.4.10" +name = "toml_datetime" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" +checksum = "a197c0ec7d131bfc6f7e82c8442ba1595aeab35da7adbf05b6b73cd06a16b6be" dependencies = [ - "serde", + "serde_core", +] + +[[package]] +name = "toml_parser" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b551886f449aa90d4fe2bdaa9f4a2577ad2dde302c61ecf262d80b116db95c10" +dependencies = [ + "winnow", ] [[package]] @@ -520,55 +564,12 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys 0.61.0", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-link" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" -[[package]] -name = "windows-link" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" - [[package]] name = "windows-sys" version = "0.60.2" @@ -578,15 +579,6 @@ dependencies = [ "windows-targets 0.53.3", ] -[[package]] -name = "windows-sys" -version = "0.61.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e201184e40b2ede64bc2ea34968b28e33622acdbbf37104f0e4a33f7abe657aa" -dependencies = [ - "windows-link 0.2.0", -] - [[package]] name = "windows-targets" version = "0.52.6" @@ -609,7 +601,7 @@ version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ - "windows-link 0.1.3", + "windows-link", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", @@ -715,3 +707,9 @@ name = "windows_x86_64_msvc" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + +[[package]] +name = "winnow" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" diff --git a/Cargo.toml b/Cargo.toml index e92b9c4..a98ed5d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,21 +17,26 @@ Rust applications or any other applications. """ [dependencies] -clap = { version = "4.5", features = ["derive"] } +clap = { version = "4.5.48", features = ["derive"] } error-chain = "0.12" sysfs_gpio = "0.6.2" -toml = "0.4" -glob = "0.2" +toml = { version = "<=0.9.6", default-features = false, features = ["parse", "serde"] } +glob = "0.3.3" lazy_static = "1.1" log = "0.4" -env_logger = "0.5" -nix = "0.11" +env_logger = "0.11.8" +nix = { version = "0.30.1", features = ["fs", "user"] } serde_derive = "1.0" serde = "1.0" uzers = { version = "0.12.1", default-features = false, features = ["cache"] } -# TODO Unpin this dependency after bumping our MSRV beyond 1.75.0. +# TODO Cross check and unpin the transitive dependencies below after bumping +# our MSRV beyond 1.75.0. backtrace = "=0.3.74" +serde_spanned = "<=1.0.1" +toml_datetime = "<=0.7.1" +toml_parser = "<=1.0.2" + [[bin]] name = "gpio" From 2e4c28dabcae90f407e157375694873258b42ffd Mon Sep 17 00:00:00 2001 From: Christian Meusel Date: Mon, 22 Sep 2025 20:20:48 +0200 Subject: [PATCH 12/15] Replace error-chain witch thiserror --- Cargo.lock | 38 +++++++++++++++++++++----------------- Cargo.toml | 2 +- src/error.rs | 25 ++++++++++++++++--------- 3 files changed, 38 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9c57e96..ea113fa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -200,16 +200,6 @@ dependencies = [ "log", ] -[[package]] -name = "error-chain" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" -dependencies = [ - "backtrace", - "version_check", -] - [[package]] name = "find-msvc-tools" version = "0.1.2" @@ -235,7 +225,6 @@ dependencies = [ "backtrace", "clap", "env_logger", - "error-chain", "glob", "lazy_static", "log", @@ -244,6 +233,7 @@ dependencies = [ "serde_derive", "serde_spanned", "sysfs_gpio", + "thiserror", "toml", "toml_datetime", "toml_parser", @@ -506,6 +496,26 @@ dependencies = [ "nix 0.23.2", ] +[[package]] +name = "thiserror" +version = "2.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "toml" version = "0.9.6" @@ -558,12 +568,6 @@ dependencies = [ "libc", ] -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - [[package]] name = "windows-link" version = "0.1.3" diff --git a/Cargo.toml b/Cargo.toml index a98ed5d..d2bc5a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,6 @@ Rust applications or any other applications. [dependencies] clap = { version = "4.5.48", features = ["derive"] } -error-chain = "0.12" sysfs_gpio = "0.6.2" toml = { version = "<=0.9.6", default-features = false, features = ["parse", "serde"] } glob = "0.3.3" @@ -36,6 +35,7 @@ backtrace = "=0.3.74" serde_spanned = "<=1.0.1" toml_datetime = "<=0.7.1" toml_parser = "<=1.0.2" +thiserror = { version = "2.0.16", default-features = false } [[bin]] diff --git a/src/error.rs b/src/error.rs index 230ee9c..2823052 100644 --- a/src/error.rs +++ b/src/error.rs @@ -6,19 +6,26 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use error_chain::error_chain; use nix::Error as NixError; use std::io::Error as IoError; use sysfs_gpio::Error as GpioError; -error_chain! { - types { - Error, ErrorKind, ResultExt, Result; - } +#[derive(thiserror::Error, Debug)] +pub enum Error { + #[error(transparent)] + Gpio(#[from] GpioError), + #[error(transparent)] + Nix(#[from] NixError), + #[error(transparent)] + Io(#[from] IoError), + #[error("{0}")] + Msg(String), +} - foreign_links { - Gpio(GpioError); - Nix(NixError); - Io(IoError); +impl From for Error { + fn from(msg: String) -> Error { + Error::Msg(msg) } } + +pub type Result = std::result::Result; From 9ba613568101277a7896d16a74b8f4c9de6d876f Mon Sep 17 00:00:00 2001 From: Christian Meusel Date: Mon, 22 Sep 2025 20:39:57 +0200 Subject: [PATCH 13/15] Update MSRV in README too --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f998c98..fb24b54 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ reliability) and seeks to operate with a minimum of overhead. ## Minimum Supported Rust Version (MSRV) -This crate is guaranteed to compile on stable Rust 1.26.2 and up. It *might* +This crate is guaranteed to compile on stable Rust 1.75.0 and up. It *might* compile with older versions but that may change in any new patch release. ## Contributing From eec178e10eb2e1f88a368eb16898f05b29501493 Mon Sep 17 00:00:00 2001 From: Christian Meusel Date: Sun, 28 Sep 2025 22:54:16 +0200 Subject: [PATCH 14/15] Fix long name of config argument And let the value name more prominently hint at that a filename is expected here. --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 714577a..11c6499 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,7 +20,7 @@ use std::process; )] struct Cli { /// additional configuration to use - #[arg(short, long)] + #[arg(short, long = "config", value_name = "FILE")] configs: Vec, #[command(subcommand)] command: Commands, From 8eb1cd814725e57e006dd8dc8870e74858b1dde1 Mon Sep 17 00:00:00 2001 From: Christian Meusel Date: Sun, 28 Sep 2025 23:11:16 +0200 Subject: [PATCH 15/15] Add initial GitHub Actions CI builds --- .github/workflows/ci.yaml | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..639e5bd --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,59 @@ +name: CI + +on: + push: + branches: + - "*" + pull_request: + branches: + - "*" + +env: + CARGO_TERM_COLOR: always + +jobs: + build-latest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + components: clippy, rustfmt + - name: Build + run: cargo build + - name: Clippy + run: cargo clippy + - name: Formatting + run: cargo fmt -- --check + - name: Docs + run: cargo doc + - name: Tests + run: cargo test + + build-msrv: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: 1.75.0 + components: clippy, rustfmt + - name: Build + run: cargo build + - name: Clippy + run: cargo clippy + - name: Formatting + run: cargo fmt -- --check + - name: Docs + run: cargo doc + - name: Tests + run: cargo test + + links: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Links + id: lychee + uses: lycheeverse/lychee-action@v2