examples: update _pick_device.rs example

This commit is contained in:
Wayne Warren 2022-01-17 20:03:59 -07:00
parent 07095dbbbc
commit 773e8066c5

View file

@ -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() {