libevdev list of event devices

Peter Hutterer peter.hutterer at who-t.net
Mon Apr 1 09:08:09 UTC 2019


On Mon, Apr 01, 2019 at 08:46:48AM +0200, Martin Kepplinger wrote:
> Am 01.04.2019 08:32 schrieb Jake Magee:
> > Hello,
> > I was wondering if the functionality already exist in libevdev to report
> > a
> > list of the current event devices?  I've looked through the API
> > documentation but couldn't find anything.  I'm interested in finding
> > event
> > devices on execution and polling for additions / removals while running.
> > 
> > Thanks,
> > Jake Magee
> 
> 
> Hi Jake,
> 
> AFAIK it doesn't. have a look at evemu's find_event_devices() function. It
> doesn't use libevdev but generically does what you want, right?
> 
> I actually doubt that this is supposed to be part of libevdev, but others
> might know better :)

yep, martin is correct here, libevdev only takes an already-opened file
descriptor. The rest is for you to figure out.

Simple explanation: the primary use-cases that sparked libevdev was the xorg
drivers and need for wayland. In both cases the enumeration is handled
elsewhere, so adding it to libinput didn't bring any benefit. Especially
because none of them want all event devices, there's always some
pre-filtering going on.

libinput has a find_device() in tools/shared.c which takes a udev tag as
input. You can copy that as well if it fits you better than the evemu one
(also: MIT vs GPL in evemu).

Cheers,
   Peter


More information about the Input-tools mailing list