AW: xorg.conf matching uinput device

Arne.Adams at t-online.de Arne.Adams at t-online.de
Mon Dec 8 19:58:29 PST 2014


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

The server layout section of the xorg.conf was the same for all experiments:
Section "ServerLayout"
	Identifier     "X.org Configured"
	Screen      0  "Screen0" 0 0
	InputDevice    "Mouse0" "CorePointer"
	InputDevice    "Keyboard0" "CoreKeyboard"
        InputDevice    "Hitrax-KBD" "CoreKeyboard"
EndSection


(1) xorg.conf without InputClass section
Section "InputDevice"
    Identifier     "Hitrax-KBD"
    Option         "Device" "shkbd"
    Driver         "smithskbd"
EndSection

xorg.log:
[   948.106] (II) Using input driver 'evdev' for 'shkbd'
[   948.107] (**) shkbd: always reports core events
[   948.107] (**) evdev: shkbd: Device: "/dev/input/event4"
[   948.107] (--) evdev: shkbd: Vendor 0x1 Product 0x2

(2) using hard coded event path: my driver is loaded:
Section "InputClass"
    Identifier     "Hitrax-KBD"
    MatchDevicePath "/dev/input/event4"
    Driver         "smithskbd"
EndSection

xorg.log:
[  1129.168] (**) Option "Device" "/dev/input/event4"
[  1129.168] (II) Arne SmithsKbdPreInit shkbd: Using device /dev/input/event4.

I don't know how matching by vendor id is supported for loading a driver other than evdev.
I did try to reuse the existing MatchVendor keyword - that failed.

(3) trying to match via vendor id:
(a)
Section "InputClass"
    Identifier     "Hitrax-KBD"
    MatchVendor "0001"
    Driver         "smithskbd"
EndSection

xorg.log:
[   393.130] (II) Using input driver 'evdev' for 'shkbd'

(b)
Section "InputClass"
    Identifier     "Hitrax-KBD"
    MatchVendor "1"
    Driver         "smithskbd"
EndSection

xorg.log:
[   393.130] (II) Using input driver 'evdev' for 'shkbd'

(4)
udev rule for tag, match by tag:
(symlink.rules):ATTRS{name}=="shkbd", TAG="SHKBD"

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:
E: USEC_INITIALIZED=432116
E: XKBMODEL=SKIP


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