[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#787464: marked as done (libplib1: jsJoystick::open() breaks system calibration on Linux)



Your message dated Mon, 24 Jul 2017 19:49:40 +0000
with message-id <E1dZjMK-000Dhh-0S@fasolo.debian.org>
and subject line Bug#787464: fixed in plib 1.8.5-8
has caused the Debian Bug report #787464,
regarding libplib1: jsJoystick::open() breaks system calibration on Linux
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
787464: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=787464
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: libplib1
Version: 1.8.5-7
Severity: important
Tags: upstream

[ Duplicating a bug I reported upstream, in the hope it could be fixed in
  Debian at least, as the upstream project appears to be dead unfortunately ]

[ FlightGear maintainers in Cc, as proper joystick calibration is likely to be
  important for many users of this simulator; in particular since this problem
  causes FlightGear (as well as most, if not all programs using libplibjs) to
  *break* joystick calibration performed with jscal or jscal-restore ]

Opening a joystick with plib on Linux breaks the in-kernel user settings for
that joystick (as set by jscal(1)). More specifically, the lower and upper
bounds of the dead band managed by the Linux joystick driver are both
overwritten by jsJoystick::open() with their arithmetic mean (after integer
truncation), effectively killing the dead band carefully configured by the
user. This has bitten a few users, for instance
<http://forum.flightgear.org/viewtopic.php?f=24&t=26084>.

To reproduce the problem, you can do:

  jscal -s <joystick calibration settings with dead band(s)> /dev/input/js0
  # (or 'jscal-restore /dev/input/js0')

  # Should print the same 'jscal -s ...' command line (current settings)
  jscal -p /dev/input/js0

  [run a program that opens /dev/input/js0 with plib, for instance
   js_demo from the plib examples, or FlightGear]

  # Print the new joystick settings, with the two parameters specifying
  # the lower and upper bounds of the kernel driver dead band overwritten
  # by the plib-using program
  jscal -p /dev/input/js0

The modification of kernel driver settings happens in lines 84-94 of
src/js/jsLinux.cxx and was introduced in revision 1982 of the Subversion repo
after <https://sourceforge.net/p/plib/mailman/message/13379198/>. IMHO, these
lines should be simply removed, as done in the proposed patch:

  - this is not useful (if the user wants no dead band managed by the kernel
    joystick driver, jscal(1) is the right tool for the job);

  - this breaks the joystick configuration for *all applications* that respect
    the system calibration instead of blindly overwriting it!

  - this is not in the spirit of the plib documentation
    (<http://plib.sourceforge.net/js/>, "JS is essentially just a wrapper to
    make the various underlying OS mechanisms look the same to application
    code");

  - this is not consistent with the implementation for other platforms (I
    looked at the Windows and MacOS X code, none of which seems to alter the
    system settings).

The person who introduced this change (yup, in 2004) argued that:

    “At least my thrustmaster topgun joystick/thrust combo works much better
    with this patch. Without, the kernel driver introduces an unrecoverable
    deadband plateau in the area of 50% thrust, which is pretty senseless to
    have on the thrust axis. Even on the other axis I prefer to have exactly
    one deadband parameter. Since plib has it's own ones, only take those
    ones.”

If that person is bothered by the in-kernel dead band management, the correct
solution is to use jscal(1) to remove that dead band, not to break all users
settings. This is done by giving the same value to the two constants setting
the lower and upper bounds of the dead band. For instance, the following
command:

  jscal -s 6,1,0,90,100,9256113,9760991,1,0,87,94,9256113,8947575,1,1,75,93,10956215,8388352,1,1,87,87,7354172,7254791,1,0,0,0,-2147483648,536854528,1,0,0,0,-2147483648,536854528 /dev/input/js0

defines the calibration settings for a joystick with 6 axes. The part
corresponding to the first axis is "1,0,90,100,9256113,9760991". In this part,
90 and 100 define a dead band of width 10 (in the units sent by the hardware).
Setting both to, for instance 95, will effectively remove this dead band while
keeping the same center. The last two coefficients must be adapted
accordingly; I can explain that, but I don't think this bug report is the
right place for such an explanation.

Correctly calibrating an analog joystick takes some time. For users' sanity,
applications must allow them to do that *once*, in a place that is used by all
applications. If each application requires its own calibration, that is very
annoying and time-consuming for users. And it is even worse if some
applications arbitrarily overwrite the system settings...

I will attach a patch suitable for a QA upload, IMHO, once I have the bug
number.

Regards

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.0.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages libplib1 depends on:
ii  freeglut3                 2.8.1-2
ii  libc6                     2.19-18
ii  libgcc1                   1:5.1.1-8
ii  libgl1-mesa-glx [libgl1]  10.5.5-1
ii  libice6                   2:1.0.9-1+b1
ii  libsm6                    2:1.2.2-1+b1
ii  libstdc++6                5.1.1-8
ii  libx11-6                  2:1.6.3-1
ii  libxext6                  2:1.3.3-1
ii  libxi6                    2:1.7.4-1+b2
ii  libxmu6                   2:1.1.2-1

libplib1 recommends no packages.

libplib1 suggests no packages.

-- no debconf information

--- End Message ---
--- Begin Message ---
Source: plib
Source-Version: 1.8.5-8

We believe that the bug you reported is fixed in the latest version of
plib, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 787464@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Tobias Frost <tobi@debian.org> (supplier of updated plib package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Mon, 24 Jul 2017 21:24:48 +0200
Source: plib
Binary: libplib1 libplib-dev
Architecture: source
Version: 1.8.5-8
Distribution: unstable
Urgency: medium
Maintainer: Debian QA Group <packages@qa.debian.org>
Changed-By: Tobias Frost <tobi@debian.org>
Description:
 libplib-dev - Portability Libraries: Development package
 libplib1   - Portability Libraries: Run-time package
Closes: 787464
Changes:
 plib (1.8.5-8) unstable; urgency=medium
 .
   * QA upload.
   * Created repository on alioth --> Point VCS-* fields in d/control toward it.
   * Bump compat level to 10
   * Refactor d/copyright using the maschine-readable d/copyright format.
   * Set d/source/format to 3.0 (quilt)
   * Refresh patch 04_CVE-2011-4620.diff
   * Rewrite d/rules to utilize short debhelper format and fix *.install to
     enable Multi-Arch installation.
   * Remove ancient Conflict/Replace from d/control
   * Enable hardening
   * Applying wrap-and-sort
   * Fix two spelling errors (new patch 06_spelling_errors.diff)
   * Fix "jsJoystick::open() breaks system calibration on Linux" with the patch
     from  the BTS. Thanks to Florent Rougon for providing it. (Closes: #787464)
   * Bump S-V to 4.0.0 -- no changes necessary.
Checksums-Sha1:
 599b3298d284c7c36e828b71d62485a6dbe13ced 1977 plib_1.8.5-8.dsc
 942cb1828f2599b4560ed3bf825127e3f87dd443 10640 plib_1.8.5-8.debian.tar.xz
 ba2cdf2c5095fd919655fa4cc0c41e87d7be7fff 8067 plib_1.8.5-8_source.buildinfo
Checksums-Sha256:
 340b3cdfbc5637c7c5ea80361ffbe9cfd7ee0a543f5bc498b9e96e72b9840ac6 1977 plib_1.8.5-8.dsc
 ebcf834a951733f8b56a0753d1ab28f7dc4c2908ab3e15ded203d9dd69723d76 10640 plib_1.8.5-8.debian.tar.xz
 f17fc399626f19343b54ab6f0612c7f1c1fc2e0ae82251c028f1572a76f5a47f 8067 plib_1.8.5-8_source.buildinfo
Files:
 776bd693c67b0a01ba45232635dbc756 1977 devel extra plib_1.8.5-8.dsc
 cc10305d5c255bebc5a21cd63bd37bb2 10640 devel extra plib_1.8.5-8.debian.tar.xz
 75bdfb94cf4370fce7a2c3c70677e974 8067 devel extra plib_1.8.5-8_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE/d0M/zhkJ3YwohhskWT6HRe9XTYFAll2ScEACgkQkWT6HRe9
XTaFaQ//S4rk11O5VaoEsvaHImPdyQZ1aovbo9ynDV2zlM5LiK4HrAQg9dMj4nXt
eT07ZgxOsau/qSCJOyXZ1bIdXzlW5hSF9b2g68ubSymy42zynNZ5iJvsfp8kVqeB
n3sm/fmqq8183nSbxkzODL38ja4PVGBaeXWMDInFUJlFkwqxz5UvjtnvQsPuE/Pf
u3k/74EnL0Rt0M2AO+SulcQYDdDzBbCMWV3F2z48FUXGy1fHYP9Y+hUCsOioqtg1
e0vK8SXGadaAxSkv2v1xYZdBxUi4qfy78P3UebsJDAHICr8Itv2z6aJ94RwhOyoC
XHrJWlpUUg0cPAYyXkvJT808ymh2w/ZG8PeG5oXlSUlXuWbyD4h4UXcwzVEf5Ce0
qmKMYAhNC0tNUIvjX937SzQgnOfWGrfLUYrT6EB/r3YGuG/cYW407lH+OuNosYuH
O+hmTH7o2K/60MxjKCVR0R+LVorkH6ThzJb4bcZFQ+omGOz+HPgMm6C7WS5lwK8X
3/WIT37R3IBn7TWw0HK8LvzEmtZ3TURFcs0WG7XgFrslfRxjdAadSGzqstB0DcfR
yolURkuVjNqi0S0Itvm3HnyfRRjGn1eGALA3vQrIg+1nFJ/j2a0fSqLwGe4mzJEL
faENY0lBuDxb0JBWUZVo3b6MkDjrAO56QsE4+HZ6/W6jp3J7ZwM=
=CbRo
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: