File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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+ /// ```
6072pub 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 ( ) ;
You can’t perform that action at this time.
0 commit comments