Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Oct 2015 18:55:06 +0300
From:      Arto Pekkanen <isoa@kapsi.fi>
To:        freebsd-x11@freebsd.org
Subject:   Re: X.org devd hotplug backend ignoring uhid devices, prevents using gamepads with X.org
Message-ID:  <560D575A.4040208@kapsi.fi>
In-Reply-To: <560C3890.7020004@kapsi.fi>
References:  <560C3890.7020004@kapsi.fi>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--L8FBVJXfMktoikdrpMWkRcojpVrKr9Jd3
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

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

I have tried to force X.org to attach /dev/uhid0 as an X input device wit=
hout hotplug as per these instructions: https://lists.freebsd.org/piperma=
il/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 th=
at 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 'us=
bhidctl -al' command that when I press buttons and turn the sticks the re=
levant values change as they should. Thus, an application that supports t=
he usbhid protocol can use /dev/uhid0 without a doubt.

But like I stated before, configuring applications to use /dev/uhid0 dire=
ctly 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 syst=
em.

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

I have come to the conclusion that the support for directly defining inpu=
t 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, a=
s very clearly stated in the man page of joystick(4x). But because the de=
vd backend of X.org ignores all usbhid devices, there is NO WAY I can mak=
e 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 ker=
nel.=20
>=20
> 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
>=20
> The above was derived from the man page of joystick(4x). As I understoo=
d, 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 a=
s input device, after which X11 applications could use it
> - by default the joystick directional input would double as main pointe=
r input, but that can be disabled with spesific options in InputClass
>=20
> However, this simply doesn't work, because the X.org devd backend ignor=
es all uhid devices. When I connect my gamepad, logfile Xorg.0.log output=
s the following:
> [(timestamp)] (II) config/devd: ignoring device uhid0
>=20
> This means that my the InputClass definition is never matched, and joys=
tick(4x) is never attached to uhid0. Thus I can't get the gamepad to work=
 with X.org.
>=20
> I would like to get my gamepad working as a genuine X11 input device, p=
referably hot pluggable. There are plenty applications that support the X=
11 input layer and can use gamepads and other widgets. One such applicati=
on that comes to mind is Wine.=20
>=20
> And yes, I do know there is uhidd(8) installable via pkg, and I could u=
se it as a replacement for X.org input layer. uhidd(8) enables specific p=
er-device configuration, similarly to the X.org InputClass. And some appl=
ications (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 hi=
d devices in X.org context would be to use then via X11 input layer.
>=20
> Is there a way to force the X.org devd backend to not ignore uhid devic=
es and have them configured as per InputClass definitions? If not, are th=
ere any plans to incorporate a reliable uhid configuration function to th=
e devd backend?
>=20
> And finally, how would I get my gamepad to work as X.org input device?
>=20


--L8FBVJXfMktoikdrpMWkRcojpVrKr9Jd3
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (MingW32)

iF4EAREIAAYFAlYNV14ACgkQTBivhqtJa26f5wD/d2tnI97Te1yUEpLOAfWb/fHV
FoX8wmZjdgDqyundwigBAIWQcd2rc4m2Y0rUXqyiApL8iRy0bdNyuLyucQO2Q6A+
=Vs+E
-----END PGP SIGNATURE-----

--L8FBVJXfMktoikdrpMWkRcojpVrKr9Jd3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?560D575A.4040208>