|
|
|
@ -18,6 +18,13 @@ Grabs input device through a kernel syscall. This prevents other devices
|
|
|
|
(including kernel-internal ones such as rfkill) from receiving events
|
|
|
|
(including kernel-internal ones such as rfkill) from receiving events
|
|
|
|
from the device.
|
|
|
|
from the device.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
In case of overlap in options provided in command line and evenironment variables,
|
|
|
|
|
|
|
|
command line options take precedence.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Environment
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DPK_INPUT_DEVICE can be used to provide the path to the input device
|
|
|
|
|
|
|
|
|
|
|
|
# Usage
|
|
|
|
# Usage
|
|
|
|
|
|
|
|
|
|
|
|
dpk [/PATH/TO/INPUT/DEVICE]
|
|
|
|
dpk [/PATH/TO/INPUT/DEVICE]
|
|
|
|
@ -83,13 +90,16 @@ fn run(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Open the device on the path provided in the first cli argument
|
|
|
|
/// Open the device on the path provided in the first cli argument
|
|
|
|
/// or, if none present, allow user to choose one
|
|
|
|
/// or in DPK_INPUT_DEVICE environment variable
|
|
|
|
|
|
|
|
/// or, if neither present, allow user to choose one
|
|
|
|
fn pick_device() -> evdev::Device {
|
|
|
|
fn pick_device() -> evdev::Device {
|
|
|
|
let mut args = std::env::args_os();
|
|
|
|
let mut args = std::env::args_os();
|
|
|
|
args.next();
|
|
|
|
args.next();
|
|
|
|
|
|
|
|
|
|
|
|
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 if let Ok(dev_file) = std::env::var("DPK_INPUT_DEVICE") {
|
|
|
|
|
|
|
|
evdev::Device::open(dev_file).unwrap()
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
let mut devices = evdev::enumerate().collect::<Vec<_>>();
|
|
|
|
let mut devices = evdev::enumerate().collect::<Vec<_>>();
|
|
|
|
devices.reverse();
|
|
|
|
devices.reverse();
|
|
|
|
|