DINPUT: Detect force feedback joysticks (FF #1, try 3)

Daniel Remenak dtremenak at gmail.com
Thu Jul 28 19:04:48 CDT 2005


Try 3 of the first in a series of patches to enable force feedback
through DirectInput on linux event devices.

Changelog:
Detect force-feedback-capable linux event device joysticks and return
DIDC_FORCEFEEDBACK when queried for capabilities.

This patch is exactly like try 2 except that this one actually works.

Changes from try 1:
1. Configure check has been changed from a custom compile check to an
AC_CHECK_MEMBERS.  I presume this is what Alexandre meant by "please
use the existing macros for checking structure fields;" if not, please
clarify.
2. An additional runtime check has been added to catch the case that
it is compiled on a kernel with full FF support but run on one without
it.  In this case, the number of simultaneous effects query will fail,
and the joystick will not be reported as FF.  The #ifdef is still
necessary to catch the opposite case.
3. Primary FF detection code has been moved from GetCapabilities to
Acquire.  Since the tests are getting more complex it's best to only
run them once, and store the results for use elsewhere.

To recap, this patch basically adds three things:
1. Configure checks for the availability of a new enough linux/input.h
to support force feedback.  This pretty much means any kernel 2.6 or
kernel 2.4.x with the ff patchset found at
http://sourceforge.net/projects/libff/.  Some of the structures were
changed without changing the version define, so this check is
necessary; although these structures are not yet used they will be in
later patches, and it's best not to report that the joystick is FF
unless it can actually handle FF effects.
2. The linuxinput dinput joystick driver tries to open the device in
read/write mode, and falls back to read-only (with no ff support) if
it fails.
3. The device is queried for the EV_FF capability bit and ffbits is
filled with the specific supported effect types.  If that all goes
well, DIDC_FORCEFEEDBACK is added to the device flags.

Autoheader and Autoconf will of course need to be run after this patch
is applied.

FF #2 will not work as is with the changes that have been made in this
patch; I will resend a second try of it also.

--Daniel Remenak
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ff-1c-detect.diff
Type: text/x-patch
Size: 4669 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20050728/ab57212d/ff-1c-detect.bin


More information about the wine-patches mailing list