From owner-freebsd-x11@freebsd.org Sun Feb 12 19:30:17 2017 Return-Path: Delivered-To: freebsd-x11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A6EACDC6C0 for ; Sun, 12 Feb 2017 19:30:17 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 230E81716 for ; Sun, 12 Feb 2017 19:30:17 +0000 (UTC) (envelope-from guru@unixarea.de) Received: by mailman.ysv.freebsd.org (Postfix) id 1F452CDC6BF; Sun, 12 Feb 2017 19:30:17 +0000 (UTC) Delivered-To: x11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EE67CDC6BE for ; Sun, 12 Feb 2017 19:30:17 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms-10.1blu.de (ms-10.1blu.de [178.254.4.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC24E1715 for ; Sun, 12 Feb 2017 19:30:16 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from [2.247.242.74] (helo=localhost.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.86_2) (envelope-from ) id 1cczqY-00005E-Rr; Sun, 12 Feb 2017 20:30:07 +0100 Received: from localhost.my.domain (c720-r292778-amd64 [127.0.0.1]) by localhost.unixarea.de (8.15.2/8.14.9) with ESMTPS id v1CJU3dE002108 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 12 Feb 2017 20:30:03 +0100 (CET) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by localhost.my.domain (8.15.2/8.14.9/Submit) id v1CJU28u002107; Sun, 12 Feb 2017 20:30:02 +0100 (CET) (envelope-from guru@unixarea.de) X-Authentication-Warning: localhost.my.domain: guru set sender to guru@unixarea.de using -f Date: Sun, 12 Feb 2017 20:30:02 +0100 From: Matthias Apitz To: x11@FreeBSD.org Subject: xf86-input-joystick-1.6.2_4 not working Message-ID: <20170212193002.GA2079@c720-r292778-amd64> Reply-To: Matthias Apitz MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Operating-System: FreeBSD 11.0-CURRENT r292778 (amd64) User-Agent: Mutt/1.5.24 (2015-08-30) X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 2.247.242.74 X-BeenThere: freebsd-x11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: X11 on FreeBSD -- maintaining and support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2017 19:30:17 -0000 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@unixarea.de, ⌂ http://www.unixarea.de/ ☎ +49-176-38902045