plib upstream has not produced a release tarball since 2006, and in the release version the min/max/center values of USB uhid joysticks is hard coded as 0/255/127. This is clearly wrong for many joysticks on the market today. In 2008 someone submitted a patch to the PLIB developers and it was put into their sourceforge repository, but no release was created after that. Thus, the plib in the FreeBSD ports collection still has the hard-coded min/max/center. Further, the jsBSD.cxx file switch statement that detects various axis types doesn't recognize "Dial" type axes. Joysticks such as the Saitek X45 have such dials, which get ignored by plib. The result is that UHID devices that have min/max values other than 0/255 fail to perform correctly in games such as flightgear --- they will either not have the full range of values showing up, will not center properly, or will otherwise produce weird, uncalibrated input to the game. Fix: The attached patch completely fixes the problem for me. It is a combination of the 2008 patch that fixes the min/max/center issue, and an addition of HUG_DIAL to the recognized axis types. Patch attached with submission follows: How-To-Repeat: Install Flightgear. Plug a USB joystick device such as the Saitek X45 Flight Controller or the Saitek Pro Flight Rudder Pedals into a BSD machine, and run the "js_demo" program. For the X45, only 6 of the 7 axes will show up. Few of the axes will show their full range -1 to 1. This is because most of the axes don't have logical min/max of 0/255: Input rid=0 size=12 count=1 page=Generic_Desktop usage=X, logical range 52..264 Input rid=0 size=12 count=1 page=Generic_Desktop usage=Y, logical range 22..232 Input rid=0 size=8 count=1 page=Generic_Desktop usage=Slider, logical range 96..246 Input rid=0 size=8 count=1 page=Generic_Desktop usage=Rz, logical range 91..253 Input rid=0 size=8 count=1 page=Generic_Desktop usage=Dial, logical range 1..163 Input rid=0 size=8 count=1 page=Generic_Desktop usage=Rx, logical range 4..172 Input rid=0 size=4 count=1 page=Generic_Desktop usage=Hat_Switch, logical range 1..8, physical range 0..315, unit=0x14 exp=0 For the Pro Flight Rudder Pedals, the logical range is 0 to 511, and so 0-255 (left rudder) are mapped to -1 to +1, and 256-511 (right rudder)are treated as "saturated", always showing up as +1
It should be obvious, but I should have stated that the patch I attached to this report is intended for the "files" directory of ports/x11-toolkits/plib, and should be called patch-src-js-jsBSD.cxx when put there. It is not a patch to the *port*, but a patch to the code installed by the port. Dropping it into the files directory of the port fixes the reported issue.
There is no maintainer for this port.
A commit references this bug: Author: rene Date: Mon Jul 21 13:23:27 UTC 2014 New revision: 362435 URL: http://svnweb.freebsd.org/changeset/ports/362435 Log: - Fix min/max/center values of USB joysticks - Bump PORTREVISION PR: 189006 Submitted by: russo@bogodyn.org Changes: head/x11-toolkits/plib/Makefile head/x11-toolkits/plib/files/patch-src__js__jsBSD.cxx