examples: update _pick_device.rs example
This commit is contained in:
parent
07095dbbbc
commit
773e8066c5
1 changed files with 3 additions and 1 deletions
|
@ -9,7 +9,9 @@ pub fn pick_device() -> evdev::Device {
|
||||||
if let Some(dev_file) = args.next() {
|
if let Some(dev_file) = args.next() {
|
||||||
evdev::Device::open(dev_file).unwrap()
|
evdev::Device::open(dev_file).unwrap()
|
||||||
} else {
|
} else {
|
||||||
let mut devices = evdev::enumerate().collect::<Vec<_>>();
|
let mut devices = evdev::enumerate()
|
||||||
|
.map(|t| t.1)
|
||||||
|
.collect::<Vec<_>>();
|
||||||
// readdir returns them in reverse order from their eventN names for some reason
|
// readdir returns them in reverse order from their eventN names for some reason
|
||||||
devices.reverse();
|
devices.reverse();
|
||||||
for (i, d) in devices.iter().enumerate() {
|
for (i, d) in devices.iter().enumerate() {
|
||||||
|
|
Loading…
Reference in a new issue