xorg.conf matching uinput device

Peter Hutterer peter.hutterer at who-t.net
Mon Dec 8 20:59:37 PST 2014


On Tue, Dec 09, 2014 at 04:58:29AM +0100, Arne.Adams at t-online.de wrote:
> Hi Peter,
> thank you for the quick reply.
> 
> Unfortunately I have not found a way to match a driver other than evdev by vendor id.
> I tried the following configurations:
> 
> 
> To write the attributes of the uinput device these statements are used:
> 
>   struct uinput_user_dev uidev;
>   memset(&uidev, 0, sizeof (uidev));
>   snprintf(uidev.name, UINPUT_MAX_NAME_SIZE, "shkbd");
>   uidev.id.bustype = BUS_USB;
>   uidev.id.vendor = 0x1;
>   uidev.id.product = 0x2;
>   uidev.id.version = 1;
>   if (write(fd, &uidev, sizeof (uidev)) < 0)
>     // error exit

[...]

> udevadm info -q all -n /dev/input/event4
> P: /devices/virtual/input/input5/event4
> N: input/event4
> E: DEVNAME=/dev/input/event4
> E: DEVPATH=/devices/virtual/input/input5/event4
> E: ID_INPUT=1
> E: ID_INPUT_KEY=1
> E: MAJOR=13
> E: MINOR=68
> E: SUBSYSTEM=input
> E: TAGS=:SHKBD:

fwiw, this needs to be ID_INPUT.tags for MatchTags to work
http://cgit.freedesktop.org/xorg/xserver/tree/config/udev.c#n187

> E: USEC_INITIALIZED=432116
> E: XKBMODEL=SKIP

MatchVendor matches on ID_VENDOR, but that isn't set here. 
is PRODUCT set on the parent device? if so you can match on MatchUSBID
"0001:0002" (thats the vid/pid you can provide in the uinput device).

but the easiest approach given that you control the device name is
MatchProduct "shkbd" or whatever you put in uidev.name. So this should work:

Section "InputClass"
    Identifier     "Hitrax-KBD"
    MatchProduct   "shkbd"
    Driver         "smithskbd"
EndSection


Cheers,
   Peter

> 
> 
> Section "InputClass"
>     Identifier     "Hitrax-KBD"
>     MatchTag "SHKBD"
>     Driver         "smithskbd"
> EndSection
> 
> xorg.log:
> [   556.807] (II) Using input driver 'evdev' for 'shkbd'
> [   556.807] (**) shkbd: always reports core events
> [   556.807] (**) evdev: shkbd: Device: "/dev/input/event4"
> [   556.807] (--) evdev: shkbd: Vendor 0x1 Product 0x2
> 
> (5) using options specified for evdev: (no input class section)
> Section "InputDevice"
>     Identifier     "Hitrax-KBD"
>     Option         "Device" "/dev/input/event40"
>     Driver         "smithskbd"
>     Option         "Name" "shkbd"
> EndSection
> 
> xorg.log:
> [   764.486] (II) Using input driver 'evdev' for 'shkbd'
> 
> (6) same as above, however with the only known match rule that loads my driver:
> Section "InputClass"
>     Identifier     "Hitrax-KBD"
>     MatchDevicePath "/dev/input/event4"
>     Driver         "smithskbd"
> EndSection
> 
> xorg.log:
> [   903.805] (II) Using input driver 'smithskbd' for 'shkbd'
> 
> So from my experminents I found no way to load a user defined xorg driver for a uinput device, apart from matching by the (non-persistent) device path.
> 
> 
> Kind regards,
> Arne
> 
> 
> 
> 
> -----Original-Nachricht-----
> Betreff: Re: xorg.conf matching uinput device
> Datum: Mon, 08 Dec 2014 07:21:11 +0100
> Von: Peter Hutterer <peter.hutterer at who-t.net>
> An: "Arne.Adams at t-online.de" <Arne.Adams at t-online.de>
> 
> On Mon, Dec 08, 2014 at 05:38:52AM +0100, Arne.Adams at t-online.de wrote:
> > Hi,
> > I have written an xorg module for a proprietary ethernet based virtual keyboard.
> > I can load that driver only witch a matching rule on the actual input path (dev/input/event4)
> > I tried to match by tag (InputClass... MatchTag) with a udev assigned tag on /dev/input/event4), however that fails.
> 
> you can match on the device name, the pid/vid, etc. surely one of those will
> be sufficient to match?
> 
> if the tag matching doesn't work then that could be a bug, but I doubt it,
> we haven't touched that code in quite a while.
> 
> > A more flexible approach for matching an xorg module to a device would be something like "tentative module loading".
> > The user supplied device_control function (Bool (*device_control) (DeviceIntPtr device, int what)) would return a new constant, indicating "not my business".
> > In that case xorg server would load other devices (if present) for the given module.
> 
> no, what you have is likely a local misconfiguration, no need for the server
> to get more complicated here.
> 
> Cheers,
>    Peter
> _______________________________________________
> xorg at lists.x.org: X.Org support
> Archives: http://lists.freedesktop.org/archives/xorg
> Info: http://lists.x.org/mailman/listinfo/xorg
> Your subscription address: %(user_address)s
> 
> 


More information about the xorg mailing list