pub trait LibinputInterface {
    fn open_restricted(&mut self, path: &Path, flags: i32) -> Result<RawFd, i32>;
    fn close_restricted(&mut self, fd: RawFd);
}
Expand description

libinput does not open file descriptors to devices directly, instead open_restricted and close_restricted are called for each path that must be opened.

Implementations are of course permitted to just use open and close respectively, but doing so would require root permissions to open devices. This interface provides an api agnostic way to use ConsoleKit or similar endpoints to open devices without direct priviledge escalation.

Required Methods

Open the device at the given path with the flags provided and return the fd.

Paramater
  • path - The device path to open
  • flags Flags as defined by open(2)
Returns

The file descriptor, or a negative errno on failure.

Close the file descriptor.

Parameter

fd - The file descriptor to close

Implementors