Skip to content

Commit dfff77f

Browse files
committed
Update nix and quicli dependencies
1 parent 1fa52ba commit dfff77f

13 files changed

+81
-70
lines changed

CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
1515
- Update Tokio to 1.x. #[55]((https://github.com/rust-embedded/gpio-cdev/pull/55).
1616
- Breaking change of `LineEventHandle::get_event()` which now expects `&mut self`.
1717
- MSRV is now 1.45.0
18+
- Updated `nix` to version `0.20`.
19+
- Updated `quicli` to version `0.4`.
1820

1921

2022
## v0.4.0 - 2020-08-01
@@ -27,17 +29,17 @@ Versioning](https://semver.org/spec/v2.0.0.html).
2729

2830
Refactored Errors:
2931
- Removed the `error-chain` dependency.
30-
- Errors are now implemented "manually" with `ErrorKind` and `IoctlKind` enums.
32+
- Errors are now implemented "manually" with `ErrorKind` and `IoctlKind` enums.
3133
- The encompassing `Error` type implements the `std::error::Error` trait.
3234

3335
## v0.2.0 - 2018-12-12
3436

3537
Adds the ability to create a collection of lines from a single chip and read or write those lines simultaneously with a single stystem call.
36-
38+
3739
- A new `Lines` object (plural) was added. It is a collection of individual `Line` objects on a single `Chip` which can be read or written simultaneously with a single system call.
3840
- A `Line` now just contains the reference to the Chip and the offset number. No system call is incurred when one is created.
3941
- Information about an individual line is now represented by a separate `LineInfo` struct which can be obtained from the function `Line::info()`. This incurs a system call to retrieve the information.
40-
- Creating a `Line` can't fail unless the caller specifies an offset that is out of range of the chip.
42+
- Creating a `Line` can't fail unless the caller specifies an offset that is out of range of the chip.
4143
- The `LineIterator` can not fail since it checks the offset range. So now its item is just a `Line`, and not `Result<Line>`.
4244
- There was no longer a need for `Line::refresh()` so it was removed.
4345
- Since a `Line` object is trivial to create, it is now OK to have `Lines` be a simple collection of `Line` structs.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ required-features = ["async-tokio"]
2222
[dependencies]
2323
bitflags = "1.0"
2424
libc = "0.2"
25-
nix = "0.14"
25+
nix = "0.20"
2626
tokio = { version = "1", features = ["io-std", "net"], optional = true }
2727
futures = { version = "0.3", optional = true }
2828

2929
[dev-dependencies]
30-
quicli = "0.2"
30+
quicli = "0.4"
31+
structopt = "0.3"
3132
anyhow = "1.0"
3233
tokio = { version = "1", features = ["io-std", "rt-multi-thread", "macros", "net"] }
3334

examples/async_tokio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
use futures::stream::StreamExt;
1010
use gpio_cdev::{AsyncLineEventHandle, Chip, EventRequestFlags, LineRequestFlags};
11-
use quicli::prelude::*;
11+
use structopt::StructOpt;
1212

1313
#[derive(Debug, StructOpt)]
1414
struct Cli {

examples/blinky.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use gpio_cdev::{Chip, LineRequestFlags};
1010
use quicli::prelude::*;
1111
use std::thread::sleep;
1212
use std::time::{Duration, Instant};
13+
use structopt::StructOpt;
1314

1415
#[derive(Debug, StructOpt)]
1516
struct Cli {
@@ -44,9 +45,10 @@ fn do_main(args: Cli) -> std::result::Result<(), gpio_cdev::Error> {
4445
Ok(())
4546
}
4647

47-
quicli::main!(|args: Cli| match do_main(args) {
48-
Ok(()) => {}
49-
Err(e) => {
50-
println!("Error: {:?}", e);
51-
}
52-
});
48+
fn main() -> CliResult {
49+
let args = Cli::from_args();
50+
do_main(args).or_else(|e| {
51+
error!("{:?}", e);
52+
Ok(())
53+
})
54+
}

examples/driveoutput.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use gpio_cdev::{Chip, LineRequestFlags};
1010
use quicli::prelude::*;
11+
use structopt::StructOpt;
1112

1213
#[derive(Debug, StructOpt)]
1314
struct Cli {
@@ -40,9 +41,10 @@ fn do_main(args: Cli) -> std::result::Result<(), gpio_cdev::Error> {
4041
Ok(())
4142
}
4243

43-
quicli::main!(|args: Cli| match do_main(args) {
44-
Ok(()) => {}
45-
Err(e) => {
46-
println!("Error: {:?}", e);
47-
}
48-
});
44+
fn main() -> CliResult {
45+
let args = Cli::from_args();
46+
do_main(args).or_else(|e| {
47+
error!("{:?}", e);
48+
Ok(())
49+
})
50+
}

examples/gpioevents.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use gpio_cdev::{Chip, EventRequestFlags, LineRequestFlags};
1010
use quicli::prelude::*;
11+
use structopt::StructOpt;
1112

1213
#[derive(Debug, StructOpt)]
1314
struct Cli {
@@ -32,9 +33,10 @@ fn do_main(args: Cli) -> std::result::Result<(), gpio_cdev::Error> {
3233
Ok(())
3334
}
3435

35-
quicli::main!(|args: Cli| match do_main(args) {
36-
Ok(()) => {}
37-
Err(e) => {
38-
println!("Error: {:?}", e);
39-
}
40-
});
36+
fn main() -> CliResult {
37+
let args = Cli::from_args();
38+
do_main(args).or_else(|e| {
39+
error!("{:?}", e);
40+
Ok(())
41+
})
42+
}

examples/lsgpio.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
//! Clone of functionality of linux/tools/gpio/lsgpio.c
1010
11-
extern crate gpio_cdev;
12-
1311
use gpio_cdev::*;
1412

1513
fn main() {

examples/monitor.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,11 @@
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
88

9-
extern crate gpio_cdev;
10-
extern crate nix;
11-
#[macro_use]
12-
extern crate quicli;
13-
extern crate anyhow;
14-
159
use gpio_cdev::*;
1610
use nix::poll::*;
1711
use quicli::prelude::*;
1812
use std::os::unix::io::AsRawFd;
13+
use structopt::StructOpt;
1914

2015
type PollEventFlags = nix::poll::PollFlags;
2116

@@ -82,11 +77,10 @@ fn do_main(args: Cli) -> anyhow::Result<()> {
8277
}
8378
}
8479

85-
main!(|args: Cli| {
86-
match do_main(args) {
87-
Ok(()) => {}
88-
Err(e) => {
89-
println!("Error: {:?}", e);
90-
}
91-
}
92-
});
80+
fn main() -> CliResult {
81+
let args = Cli::from_args();
82+
do_main(args).or_else(|e| {
83+
error!("{:?}", e);
84+
Ok(())
85+
})
86+
}

examples/multioutput.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use gpio_cdev::{Chip, LineRequestFlags};
1010
use quicli::prelude::*;
11+
use structopt::StructOpt;
1112

1213
#[derive(Debug, StructOpt)]
1314
struct Cli {
@@ -48,9 +49,10 @@ fn do_main(args: Cli) -> std::result::Result<(), gpio_cdev::Error> {
4849
Ok(())
4950
}
5051

51-
quicli::main!(|args: Cli| match do_main(args) {
52-
Ok(()) => {}
53-
Err(e) => {
54-
println!("Error: {:?}", e);
55-
}
56-
});
52+
fn main() -> CliResult {
53+
let args = Cli::from_args();
54+
do_main(args).or_else(|e| {
55+
error!("{:?}", e);
56+
Ok(())
57+
})
58+
}

examples/multiread.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use gpio_cdev::{Chip, LineRequestFlags};
1010
use quicli::prelude::*;
11+
use structopt::StructOpt;
1112

1213
#[derive(Debug, StructOpt)]
1314
struct Cli {
@@ -28,9 +29,10 @@ fn do_main(args: Cli) -> std::result::Result<(), gpio_cdev::Error> {
2829
Ok(())
2930
}
3031

31-
quicli::main!(|args: Cli| match do_main(args) {
32-
Ok(()) => {}
33-
Err(e) => {
34-
println!("Error: {:?}", e);
35-
}
36-
});
32+
fn main() -> CliResult {
33+
let args = Cli::from_args();
34+
do_main(args).or_else(|e| {
35+
error!("{:?}", e);
36+
Ok(())
37+
})
38+
}

examples/readall.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use gpio_cdev::{Chip, LineRequestFlags};
1010
use quicli::prelude::*;
11+
use structopt::StructOpt;
1112

1213
#[derive(Debug, StructOpt)]
1314
struct Cli {
@@ -26,9 +27,10 @@ fn do_main(args: Cli) -> std::result::Result<(), gpio_cdev::Error> {
2627
Ok(())
2728
}
2829

29-
quicli::main!(|args: Cli| match do_main(args) {
30-
Ok(()) => {}
31-
Err(e) => {
32-
println!("Error: {:?}", e);
33-
}
34-
});
30+
fn main() -> CliResult {
31+
let args = Cli::from_args();
32+
do_main(args).or_else(|e| {
33+
error!("{:?}", e);
34+
Ok(())
35+
})
36+
}

examples/readinput.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use gpio_cdev::{Chip, LineRequestFlags};
1010
use quicli::prelude::*;
11+
use structopt::StructOpt;
1112

1213
#[derive(Debug, StructOpt)]
1314
struct Cli {
@@ -27,9 +28,10 @@ fn do_main(args: Cli) -> std::result::Result<(), gpio_cdev::Error> {
2728
Ok(())
2829
}
2930

30-
quicli::main!(|args: Cli| match do_main(args) {
31-
Ok(()) => {}
32-
Err(e) => {
33-
println!("Error: {:?}", e);
34-
}
35-
});
31+
fn main() -> CliResult {
32+
let args = Cli::from_args();
33+
do_main(args).or_else(|e| {
34+
error!("{:?}", e);
35+
Ok(())
36+
})
37+
}

examples/tit_for_tat.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use gpio_cdev::{Chip, EventRequestFlags, EventType, LineRequestFlags};
1010
use quicli::prelude::*;
1111
use std::thread::sleep;
1212
use std::time::Duration;
13+
use structopt::StructOpt;
1314

1415
#[derive(Debug, StructOpt)]
1516
struct Cli {
@@ -54,9 +55,10 @@ fn do_main(args: Cli) -> std::result::Result<(), gpio_cdev::Error> {
5455
Ok(())
5556
}
5657

57-
quicli::main!(|args: Cli| match do_main(args) {
58-
Ok(()) => {}
59-
Err(e) => {
60-
println!("Error: {:?}", e);
61-
}
62-
});
58+
fn main() -> CliResult {
59+
let args = Cli::from_args();
60+
do_main(args).or_else(|e| {
61+
error!("{:?}", e);
62+
Ok(())
63+
})
64+
}

0 commit comments

Comments
 (0)