evdev
evdev copied to clipboard
Device::into_event_stream() drops device on error
If you call Device::into_event_stream() and it fails, the device is dropped and has no way to recover it. If you would like to use any information off of the Device struct in your error handling, you have to clone the relevant information before even calling Device::into_event_stream. The solution to this would be to have an IntoEventStreamError which includes the underlying io::Error as well as the Device, allowing users to query information off of the device in event of an error.
The solution is to create a custom error type which contains the underlying device. Unfortunately, AsyncFd::new has the same issue, so this would be reliant on Tokio doing the same thing. I will create an issue upstream as well.
https://github.com/tokio-rs/tokio/issues/6344