X.org devd hotplug backend ignoring uhid devices, prevents using gamepads with X.org

Arto Pekkanen isoa at kapsi.fi
Fri Oct 2 02:09:33 UTC 2015


On 2.10.2015 2:02, Jan Beich wrote:
> Arto Pekkanen <isoa at kapsi.fi> writes:
> 
>> Section "InputClass"
>> 	Identifier "Game Controller"
>> 	Driver "joystick"
>> 	Option "MatchIsJoystick" "on"
> 
> MatchIsJoystick only works on devices that are assigned ATTR_JOYSTICK.
> config/devd currently only does so for joy(4) devices but not uhid(4) as
> the latter isn't specific to joysticks. The proper detection may require
> teaching it to speak usbhid(3) but for now see inlined patch at the end.
> 
> MatchIsJoystick is specified just like the following line. It isn't an
> option passed to a X11 driver.

Thank you very much for the reply!

Okay, I had a minor malfunction there. MatchIsJoystick should not be an option, true that.

I will patch xorg-server and rebuild & install, see if it helps.

Also, the patch you provided was really helpful for me to learn about where all the important bits of code reside. I've not looked at the devd backend code yet, but I suppose learning how it works would be for the better. Well, supposing I have enough talent to understand the code. We shall see.

>> 	MatchDevicePath "/dev/uhid*"
> 
> config/devd is a bit too pessimistic. Any device not in hw_types table
> seems to be ignored by default, so MatchDevicePath may not be applied.
> For one, config/udev only ignores non-ID_INPUT devices which translates
> for USB into intclass=0x03 in devd(8).

Hmm, so my conclusion was at least partially correct. Very well.

>> EndSection
> [...]
>> I would like to get my gamepad working as a genuine X11 input device,
>> preferably hot pluggable. There are plenty applications that support
>> the X11 input layer and can use gamepads and other widgets. One such
>> application that comes to mind is Wine.
> 
> FWIW, emulators/joytran maybe more useful for Wine unless all your games
> have the same keybindings.

Good for you to mention, I do know of emulators/joytran. I've used that in Linuxen to get emulators and similar software working properly. Some (actually, too many) programs have horribly buggy or lacking hid subsystems, and only keyboard input works properly.

But in my case there are certain (Windows) games that have very specific control schemes that practically require a game pad with two analog sticks. So I shall try if I can get the game pad to attach into X input layer.

> Index: x11-servers/xorg-server/files/patch-config_devd.c
> ===================================================================
> --- x11-servers/xorg-server/files/patch-config_devd.c	(revision 398150)
> +++ x11-servers/xorg-server/files/patch-config_devd.c	(working copy)
> @@ -1,6 +1,6 @@
>  --- config/devd.c.orig	2015-05-19 19:41:49 UTC
>  +++ config/devd.c
> -@@ -0,0 +1,531 @@
> +@@ -0,0 +1,533 @@
>  +/*
>  + * Copyright (c) 2012 Baptiste Daroussin
>  + * Copyright (c) 2013, 2014 Alex Kozlov
> @@ -80,9 +80,11 @@
>  +	{ "ums", ATTR_POINTER, "mouse" },
>  +	{ "psm", ATTR_POINTER, "mouse" },
>  +	{ "vboxguest", ATTR_POINTER, "vboxmouse" },
> -+	{ "joy", ATTR_JOYSTICK, NULL },
> -+	{ "atp", ATTR_TOUCHPAD, NULL },
> -+	{ "uep", ATTR_TOUCHSCREEN, NULL },
> ++	{ "joy", ATTR_JOYSTICK, "void" },
> ++	/* XXX joystick is more useful than void by default */ 
> ++	{ "uhid", ATTR_JOYSTICK, "joystick" },
> ++	{ "atp", ATTR_TOUCHPAD, "mouse" },
> ++	{ "uep", ATTR_TOUCHSCREEN, "egalax" },
>  +	{ NULL, -1, NULL },
>  +};
>  +
> 

Thank you very much for the patch, I will try this as soon as I wake up from sleep and get my brain functioning again.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-x11/attachments/20151002/5fa4873a/attachment.bin>


More information about the freebsd-x11 mailing list