All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerald Folcher <geraldf2@free.fr>
To: linux-input@atrey.karlin.mff.cuni.cz
Subject: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c
Date: Mon, 16 Jul 2007 15:48:17 +0200	[thread overview]
Message-ID: <469B7721.9070705@free.fr> (raw)

Hello,

I write this as it may be interesting to the peoples involved in the 
force feedback drivers (or if you're just trying to get your 
Thrustmaster wheel's force-feedback to work), I'm sorry I'm not 
proposing a ready to apply patch because at this point I'm not competent 
enough to make something clean that won't break anything. If anybody is 
willing to make a proper patch out of this info it would be very welcome 
as far as I'm concerned, I could try it to confirm that it works with my 
wheel.

So, I got a "Thrustmaster Ferrari GT 2-in-1 Force Feedback" racing wheel 
type game controller. It's USB and is detected and work as a controller 
out of the box. But of course I quickly got interested in trying to get 
the Force Feedback part to also work.

At first, I tried to get it to work using the iforce kernel module, 
adding a vendor/id line in iforce-main.c and iforce-usb.c . But the most 
significant result I got was the module telling me that it timed out 
waiting for response from the device. So I concluded that my wheel was 
probably not talking "I-Force", but I'm still not sure I did not do 
something wrong...

Anyway, next I tried in the usbhid module and I finally got FF_CONSTANT 
type force-feedback working for my wheel, but only after some (very 
small) modifications. This is only proof-of-concept as, as-is, it will 
break Logitech compatibility.

Here's a shell session transcript to show the diffs (kernel 2.6.22) :
  bash-prompt$ cd drivers/hid/usbhid/
  bash-prompt$ diff hid-lgff.c.orig hid-lgff.c
  51a52
  >         { 0x044f, 0xb654, ff_joystick }, /* Thrustmaster FGT Force 
Feedback */
  77,80c78,80
  <               report->field[0]->value[0] = 0x51;
  <               report->field[0]->value[1] = 0x08;
  <               report->field[0]->value[2] = x;
  <               report->field[0]->value[3] = y;
  ---
  >               /* Works on the Thrustmaster but breaks Logitech */
  >               report->field[0]->value[0] = x;
  >               report->field[0]->value[1] = y;
  bash-prompt$ diff hid-ff.c.orig hid-ff.c
  55a56
  >       { 0x44f, 0xb654, hid_lgff_init }, /* Thrustmaster FGT Force 
Feedback */

That's it, with that my wheel can do FF_CONSTANT type force feedback. 
Note that it also loads the 'ff_memless' module, so I guess the wheel 
has no memory. It works well with the 'ffcfstress' and 'ffmvforce' test 
utilities, and here's the output of 'fftest':

Device /dev/input/event2 opened
Axes query:
Effects: Constant
Number of simultaneous effects: 16
Upload effects[0]: Invalid argument
Upload effects[2]: Invalid argument
Upload effects[3]: Invalid argument
Upload effects[4]: Invalid argument
Upload effects[5]: Invalid argument
Enter effect number, -1 to exit

With fftest, only entering '1' applies a left force, but I guess it's to 
be expected since the driver only do FF_CONSTANT (I guess it's the same 
on the Logitech's ?).

I also tested it in Wine with the Live For Speed (aka "LFS") S2 demo, 
and it seems to work quite well (tough I had to modify some small Wine 
code that prevented FF to work with this game, but that's another 
quick-and-dirty story). (OT: About Wine, if anybody can get Force 
Feedback working with the game Grand Prix Legends I would be very 
interested to know.)

I guess that a proper patch for the Thrustmaster wheel(s) would probably 
have better his place in hid-tmff.c (In fact I first gone that route but 
I had to change more code introducing more ugliness... the diff output 
from the hid-lgff.c version was much better for my "presentation" purpose).

That's all, I hope it will be of interest to someone :D


-- 
Gerald Folcher

             reply	other threads:[~2007-07-16 13:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-16 13:48 Gerald Folcher [this message]
2007-07-16 16:05 ` Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c Dmitry Torokhov
2007-07-16 17:14   ` Gerald Folcher
2007-07-16 17:21     ` Anssi Hannula
2007-07-16 18:37       ` Gerald Folcher
2007-07-16 21:00         ` Anssi Hannula
2007-07-16 20:50     ` Dmitry Torokhov
2007-07-16 21:03       ` Dmitry Torokhov
2007-07-16 21:21         ` Dmitry Torokhov
2007-07-17  9:14           ` Gerald Folcher
2007-07-17 13:50             ` Dmitry Torokhov
2007-07-30 13:13               ` Jiri Kosina
2007-08-22  2:30                 ` Gerald Folcher
2007-08-22  8:16                   ` Jiri Kosina
2007-08-22 10:30                     ` Gerald Folcher
2007-07-17 13:14     ` Gerald Folcher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=469B7721.9070705@free.fr \
    --to=geraldf2@free.fr \
    --cc=linux-input@atrey.karlin.mff.cuni.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.