Skip to content

Commit b9c84fa

Browse files
committed
enumerate: try to fix the test
1 parent 32c8d4b commit b9c84fa

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/enumerate.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@ pub fn enumerate() -> io::Result<Enumerate> {
5757
///
5858
/// If opening the [`HotplugMonitor`] fails, this will degrade gracefully and only yield the
5959
/// currently plugged-in devices.
60+
///
61+
/// # Examples
62+
///
63+
/// ```no_run
64+
/// use evdevil::enumerate_hotplug;
65+
///
66+
/// for res in enumerate_hotplug()? {
67+
/// let (path, evdev) = res?;
68+
/// println!("{}: {}", path.display(), evdev.name()?);
69+
/// }
70+
/// # Ok::<_, std::io::Error>(())
71+
/// ```
6072
pub fn enumerate_hotplug() -> io::Result<EnumerateHotplug> {
6173
EnumerateHotplug::new()
6274
}
@@ -280,6 +292,11 @@ mod tests {
280292

281293
#[test]
282294
fn hotplug_enumerate() {
295+
if !fs::exists("/dev/uinput").unwrap() {
296+
eprintln!("`/dev/uinput` doesn't exist, probably running under QEMU");
297+
return;
298+
}
299+
283300
env_logger::builder()
284301
.filter_module(env!("CARGO_PKG_NAME"), log::LevelFilter::Debug)
285302
.init();

0 commit comments

Comments
 (0)