xf86-input-joystick-1.6.2_4 not working

Matthias Apitz guru at unixarea.de
Sun Feb 12 19:30:17 UTC 2017



Hello,

My son wants to play games/flightgear on his FreeBSD laptop and I have
installed him a joystick THRUSTMASTER T-FLIGHT STICK X. The used software
stack is:

FreeBSD CURRENT r292778-amd64
Xorg 7.7.2 ...
uhidd-0.2.1_3
xf86-input-joystick-1.6.2_4.
all compiled from ports.

The essential lines of the configuration in xorg.conf are:

Section "ServerLayout"
	Identifier     "X.org Configured"
	Screen      0  "Screen0" 0 0
	InputDevice    "Mouse0" "CorePointer"
	InputDevice    "Keyboard0" "CoreKeyboard"
	InputDevice    "Joystick0" "SendCoreEvents"
EndSection

Section "InputDevice"
	Identifier  "Mouse0"
	Driver      "mouse"
	Option	    "Protocol" "auto"
	Option	    "Device" "/dev/sysmouse"
	Option	    "ZAxisMapping" "4 5 6 7"
EndSection

Section "InputDevice"
	Identifier  "Joystick0"
	Driver      "joystick"
	Option "MatchIsJoystick"   "on"
	Option "Device"  "/dev/uhid0"
	Option "DebugLevel"        "7"
	Option "StartKeysEnabled"  "True"
	Option "StartMouseEnabled" "True"
	Option "MapButton1"        "button=1"
	Option "MapButton2"        "button=2"
	Option "MapButton3"        "button=3"
	Option "MapButton4"        "none"
	Option "MapAxis1"          "mode=relative    axis=+1x  deadzone=5000"
	Option "MapAxis2"          "mode=relative    axis=+1y  deadzone=5000"
	Option "MapAxis3"          "mode=relative    axis=+1zx deadzone=5000"
	Option "MapAxis4"          "mode=relative    axis=+1zy deadzone=5000"
	Option "MapAxis5"          "mode=accelerated axis=+1x  deadzone=5000"
	Option "MapAxis6"          "mode=accelerated axis=+1y  deadzone=5000"
	Option "MapAxis7"          "mode=none"
EndSection

...

The device /dev/uhid0 is there and gives data on move/buttons:

$ od -tx1 /dev/uhid0
0000000    00  f0  ff  80  3a  80  ff  00  00  00  00  01  02  00  00  00
0000020    00  00  00  00  f0  ff  4f  10  80  ff  00  00  00  00  01  02
0000040    00  00  00  00  00  00  00  f0  ff  42  2e  80  ff  00  00  00
...

But in Xorg.0.log it says about the device:


[  7698.519] (II) LoadModule: "joystick"
[  7698.520] (II) Loading /usr/local/lib/xorg/modules/input/joystick_drv.so
[  7698.520] (II) Module joystick: vendor="X.Org Foundation"
[  7698.520] 	compiled for 1.17.4, module version = 1.6.2
[  7698.520] 	Module class: X.Org XInput Driver
[  7698.520] 	ABI class: X.Org XInput driver, version 21.0

...

[  7698.925] (II) Using input driver 'joystick' for 'Joystick0'
[  7698.925] 	Option "MatchIsJoystick" "on"
[  7698.925] 	Option "Device" "/dev/uhid0"
[  7698.925] 	Option "DebugLevel" "7"
[  7698.925] 	Option "StartKeysEnabled" "True"
[  7698.925] 	Option "StartMouseEnabled" "True"
[  7698.925] 	Option "MapButton1" "button=1"
[  7698.925] 	Option "MapButton2" "button=2"
[  7698.925] 	Option "MapButton3" "button=3"
[  7698.925] 	Option "MapButton4" "none"
[  7698.925] 	Option "MapAxis1" "mode=relative    axis=+1x  deadzone=5000"
[  7698.925] 	Option "MapAxis2" "mode=relative    axis=+1y  deadzone=5000"
[  7698.925] 	Option "MapAxis3" "mode=relative    axis=+1zx deadzone=5000"
[  7698.925] 	Option "MapAxis4" "mode=relative    axis=+1zy deadzone=5000"
[  7698.925] 	Option "MapAxis5" "mode=accelerated axis=+1x  deadzone=5000"
[  7698.925] 	Option "MapAxis6" "mode=accelerated axis=+1y  deadzone=5000"
[  7698.925] 	Option "MapAxis7" "mode=none"
[  7698.925] 	Option "SendCoreEvents"
[  7698.925] 	Option "driver" "joystick"
[  7698.925] 	Option "identifier" "Joystick0"
[  7698.925] (**) Option "SendCoreEvents"
[  7698.925] (**) Joystick0: always reports core events
[  7698.926] (EE) PreInit returned 11 for "Joystick0"
[  7698.926] (II) UnloadModule: "joystick"

I re-compiled x11-drivers/xf86-input-joystick with additional logging 
statements in

jstk.c
jstk_key.c

and it turned out that this initial sequence is not passed with success resulting
in jstk.c the return value of 11 (BadAlloc): 


    ...
    xf86Msg(X_CONFIG, "debug: doing jstkKeyboardHotplug() \n");

    while(opts)
    {
        xf86Msg(X_CONFIG, "debug: %s %s \n", xf86OptionName(opts), xf86OptionValue(opts));
        iopts = input_option_new(iopts,
                                 xf86OptionName(opts),
                                 xf86OptionValue(opts));
        opts = xf86NextOption(opts);
    }

    /* duplicate attribute list */
    attrs = DuplicateInputAttributes(pInfo->attrs);

    rc = NewInputDeviceRequest(iopts, attrs, &dev);

    input_option_free_list(&iopts);

    FreeInputAttributes(attrs);

    xf86Msg(X_CONFIG, "debug: jstkKeyboardHotplug() end with rc = %d\n", rc);
    return (rc == Success) ? dev->public.devicePrivate : NULL;
}

The resulting additional "debug: ..." lines in Xorg.0.log are:

[  7698.925] (**) debug: doing jstkKeyboardHotplug() 
[  7698.925] (**) debug: MatchIsJoystick on 
[  7698.926] (**) debug: Device /dev/uhid0 
[  7698.926] (**) debug: DebugLevel 7 
[  7698.926] (**) debug: StartKeysEnabled True 
[  7698.926] (**) debug: StartMouseEnabled True 
[  7698.926] (**) debug: MapButton1 button=1 
[  7698.926] (**) debug: MapButton2 button=2 
[  7698.926] (**) debug: MapButton3 button=3 
[  7698.926] (**) debug: MapButton4 none 
[  7698.926] (**) debug: MapAxis1 mode=relative    axis=+1x  deadzone=5000 
[  7698.926] (**) debug: MapAxis2 mode=relative    axis=+1y  deadzone=5000 
[  7698.926] (**) debug: MapAxis3 mode=relative    axis=+1zx deadzone=5000 
[  7698.926] (**) debug: MapAxis4 mode=relative    axis=+1zy deadzone=5000 
[  7698.926] (**) debug: MapAxis5 mode=accelerated axis=+1x  deadzone=5000 
[  7698.926] (**) debug: MapAxis6 mode=accelerated axis=+1y  deadzone=5000 
[  7698.926] (**) debug: MapAxis7 mode=none 
[  7698.926] (**) debug: SendCoreEvents (null) 
[  7698.926] (**) debug: Driver joystick 
[  7698.926] (**) debug: identifier Joystick0 
[  7698.926] (**) debug: Name Joystick0 (keys) 
[  7698.926] (**) debug: _source _driver/joystick 
[  7698.926] (**) debug: jstkKeyboardHotplug() end with rc = 1
[  7698.926] (**) debug: jstkCorePreInit(): return BadAlloc


In general, the port of xf86-input-joystick-1.6.2_4 is not well adopted
to FreeBSD, at least not its man page, which says: ...

 The evdev(4) driver will suffice for those in most cases.

Do we have any evdev(4) driver in FreeBSD?

Anyway, how could I bring this to work?

Should I file a PR about this?

Thanks

	matthias
-- 
Matthias Apitz, ✉ guru at unixarea.de, ⌂ http://www.unixarea.de/  ☎ +49-176-38902045


More information about the freebsd-x11 mailing list