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

Arto Pekkanen isoa at kapsi.fi
Thu Oct 1 16:12:53 UTC 2015


Okay, an update to my previous request, as it now seems that nobody has yet answered.

I have tried to force X.org to attach /dev/uhid0 as an X input device without hotplug as per these instructions: https://lists.freebsd.org/pipermail/freebsd-chat/2008-March/005466.html

So, I replaced the InputClass section with an InputDevice section:
-- file: /usr/local/etc/X11/xorg.conf.d/30-joystick.conf
Section "InputDevice"
	Identifier "Game Controller"
 	Driver "joystick"
 	Option "Device" "/dev/uhid0"
EndSection

However, the above section does nothing. In the Xorg.0.log I could see that the module 'joystick' failed with code 11. I could not figure out what "code 11" even means.

Problem cannot be with the game pad itself, because I _verified_ with 'usbhidctl -al' command that when I press buttons and turn the sticks the relevant values change as they should. Thus, an application that supports the usbhid protocol can use /dev/uhid0 without a doubt.

But like I stated before, configuring applications to use /dev/uhid0 directly is not an option for me. This is because Wine does NOT support the *BSDs usbhid protocol at all. Wine cannot detect any joysticks in the system.

The only thing that is verified to work is to have a game controller attached as an X input device. After that Wine can detect the device using the X Input Extension and use it. The link I referenced previously proved this to work with an older version of FreeBSD.

I have come to the conclusion that the support for directly defining input devices in X.org with InputDevice section has been obsoleted. The only way to get input devices working with X.org would be to use InputClass, as very clearly stated in the man page of joystick(4x). But because the devd backend of X.org ignores all usbhid devices, there is NO WAY I can make this work.

Could I contact the maintainer of the devd backend and ask them to add an option for devd not to ignore usbhid devices?

Or what else can I do to get an usbhid game pad to work with Wine?

On 30.9.2015 22:31, Arto Pekkanen wrote:
> I have an XBox 360 controller that is attached as /dev/uhid0 by the kernel. 
> 
> I have also declared a catch-all InputClass for hid devices in order to have X.org use gamepads automatically:
> -- file: /usr/local/etc/X11/xorg.conf.d/30-joystick.conf
> Section "InputClass"
> 	Identifier "Game Controller"
> 	Driver "joystick"
> 	Option "MatchIsJoystick" "on"
> 	MatchDevicePath "/dev/uhid*"
> EndSection
> 
> The above was derived from the man page of joystick(4x). As I understood, here's how it works:
> - when X.org get notified about a /dev/uhid* device, it would dispatch the device to joystick(4x) (package: x11-drivers/xf86-input-joystick)
> - joystick(4x) would then test if the device is a hid joystick or not
> - if the device was a joystick, joystick(4x) would attach it to X.org as input device, after which X11 applications could use it
> - by default the joystick directional input would double as main pointer input, but that can be disabled with spesific options in InputClass
> 
> However, this simply doesn't work, because the X.org devd backend ignores all uhid devices. When I connect my gamepad, logfile Xorg.0.log outputs the following:
> [(timestamp)] (II) config/devd: ignoring device uhid0
> 
> This means that my the InputClass definition is never matched, and joystick(4x) is never attached to uhid0. Thus I can't get the gamepad to work with X.org.
> 
> 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. 
> 
> And yes, I do know there is uhidd(8) installable via pkg, and I could use it as a replacement for X.org input layer. uhidd(8) enables specific per-device configuration, similarly to the X.org InputClass. And some applications (NOT all) can be forced to use the raw /dev/uhidX device. I know all that, and could do it. I just think that the correct way of using hid devices in X.org context would be to use then via X11 input layer.
> 
> Is there a way to force the X.org devd backend to not ignore uhid devices and have them configured as per InputClass definitions? If not, are there any plans to incorporate a reliable uhid configuration function to the devd backend?
> 
> And finally, how would I get my gamepad to work as X.org input device?
> 

-------------- 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/20151001/a29756ce/attachment.bin>


More information about the freebsd-x11 mailing list