* Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c @ 2007-07-16 13:48 Gerald Folcher 2007-07-16 16:05 ` Dmitry Torokhov 0 siblings, 1 reply; 16+ messages in thread From: Gerald Folcher @ 2007-07-16 13:48 UTC (permalink / raw) To: linux-input 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 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c 2007-07-16 13:48 Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c Gerald Folcher @ 2007-07-16 16:05 ` Dmitry Torokhov 2007-07-16 17:14 ` Gerald Folcher 0 siblings, 1 reply; 16+ messages in thread From: Dmitry Torokhov @ 2007-07-16 16:05 UTC (permalink / raw) To: Gerald Folcher; +Cc: linux-input [-- Attachment #1: Type: text/plain, Size: 456 bytes --] Hi Gerard, On 7/16/07, Gerald Folcher <geraldf2@free.fr> wrote: > > 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). > I wonder if the attached is all that is needed for your wheel to work... -- Dmitry [-- Attachment #2: hid-add-thrustmaster-fgt-wheel.patch --] [-- Type: application/octet-stream, Size: 768 bytes --] Input: HID - add support for Thrustmaster FGT Rumble Force wheel Add Thrustmaster FGT Rumble force steering wheel to the list of devices dupported by thrustmaster force-feedback module. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> --- drivers/hid/usbhid/hid-ff.c | 1 + 1 file changed, 1 insertion(+) Index: linux/drivers/hid/usbhid/hid-ff.c =================================================================== --- linux.orig/drivers/hid/usbhid/hid-ff.c +++ linux/drivers/hid/usbhid/hid-ff.c @@ -67,6 +67,7 @@ static struct hid_ff_initializer inits[] #ifdef CONFIG_THRUSTMASTER_FF { 0x44f, 0xb300, hid_tmff_init }, { 0x44f, 0xb304, hid_tmff_init }, + { 0x44f, 0xb654, hid_tmff_init }, #endif #ifdef CONFIG_ZEROPLUS_FF { 0xc12, 0x0005, hid_zpff_init }, ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c 2007-07-16 16:05 ` Dmitry Torokhov @ 2007-07-16 17:14 ` Gerald Folcher 2007-07-16 17:21 ` Anssi Hannula ` (2 more replies) 0 siblings, 3 replies; 16+ messages in thread From: Gerald Folcher @ 2007-07-16 17:14 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: linux-input Dmitry Torokhov wrote: > I wonder if the attached is all that is needed for your wheel to work... No, but I think I understand where is the confusion: It won't work because my wheel is the "Force Feedback" model, not the "Rumble Force" model which is cheaper but looks exactly the same. With your patch applied as is, my wheel will neither do rumble effects nor constant force effects, the force feedback test utilities 'ffcfstress' and 'ffmvforce' will spit an error message on startup and exit. And 'fftest' will think my wheel can do Rumble but trying such effects will effectively trigger hazardous constant forces on my wheel. But your patch would maybe work for the actual Rumble wheel if you change the id to 0x651, which is the id of the Rumble version according to the MS-Windows registry on a machine where I installed the Thrustmaster drivers (the registry is full of id's of the wheels supported by the driver). While the id of my wheel (Force Feedback) is: 0x654 (and according to the aforementioned MS-Windows registry there is also an id 0x652 for a Thrustmaster wheel with the same name). Thanks for trying ;) -- Gerald Folcher ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c 2007-07-16 17:14 ` Gerald Folcher @ 2007-07-16 17:21 ` Anssi Hannula 2007-07-16 18:37 ` Gerald Folcher 2007-07-16 20:50 ` Dmitry Torokhov 2007-07-17 13:14 ` Gerald Folcher 2 siblings, 1 reply; 16+ messages in thread From: Anssi Hannula @ 2007-07-16 17:21 UTC (permalink / raw) To: Gerald Folcher; +Cc: Dmitry Torokhov, linux-input Gerald Folcher wrote: > Dmitry Torokhov wrote: > >> I wonder if the attached is all that is needed for your wheel to >> work... > > No, but I think I understand where is the confusion: > It won't work because my wheel is the "Force Feedback" model, not the > "Rumble Force" model which is cheaper but looks exactly the same. With > your patch applied as is, my wheel will neither do rumble effects nor > constant force effects, the force feedback test utilities 'ffcfstress' and > 'ffmvforce' will spit an error message on startup and exit. And > 'fftest' will think my wheel can do Rumble but trying such effects will > effectively trigger hazardous constant forces on my wheel. > > But your patch would maybe work for the actual Rumble wheel if you > change the id to 0x651, which is the id of the Rumble version according to > the MS-Windows registry on a machine where I installed the Thrustmaster > drivers (the registry is full of id's of the wheels supported by the > driver). > > While the id of my wheel (Force Feedback) is: 0x654 (and according to > the aforementioned MS-Windows registry there is also an id 0x652 for a > Thrustmaster wheel with the same name). Could you perhaps provide the kernel log output when you plug your device in with CONFIG_HID_DEBUG enabled in kernel configuration? Thanks, -- Anssi Hannula ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c 2007-07-16 17:21 ` Anssi Hannula @ 2007-07-16 18:37 ` Gerald Folcher 2007-07-16 21:00 ` Anssi Hannula 0 siblings, 1 reply; 16+ messages in thread From: Gerald Folcher @ 2007-07-16 18:37 UTC (permalink / raw) To: Anssi Hannula; +Cc: Dmitry Torokhov, linux-input [-- Attachment #1: Type: text/plain, Size: 407 bytes --] Anssi Hannula wrote: > Could you perhaps provide the kernel log output when you plug your device > in with CONFIG_HID_DEBUG enabled in kernel configuration? Ok, after setting CONFIG_HID_DEBUG=y here's what got appended in the '/var/log/kern.log' file when I plugged the device (see attachment). (Btw it's from the kernel with my little modification if that would make any difference) -- Gerald Folcher [-- Attachment #2: ThrustmasterFGTFF_plug_kernlog.txt --] [-- Type: text/plain, Size: 28477 bytes --] Jul 16 20:19:41 starship kernel: usb 4-1: new full speed USB device using uhci_hcd and address 2 Jul 16 20:19:41 starship kernel: usb 4-1: configuration #1 chosen from 1 choice Jul 16 20:19:41 starship kernel: drivers/hid/usbhid/hid-core.c: report descriptor (size 144, read 144) = 05 01 09 04 a1 01 09 01 a1 00 85 81 06 00 ff 15 00 27 ff ff 00 00 09 01 09 02 75 10 95 02 b1 a2 85 82 09 03 09 04 25 7f 75 08 95 02 b1 02 85 01 05 09 19 01 29 0a 25 01 75 01 95 0a 81 02 75 08 95 01 81 01 05 01 09 39 25 07 35 00 46 3b 01 65 14 75 04 81 42 09 30 46 ff 03 16 00 fe 26 ff 01 65 00 75 0a 95 01 81 02 09 31 46 ff 00 15 00 26 ff 00 75 08 81 02 09 35 81 02 c0 85 40 09 bb 15 00 26 ff 00 35 00 46 ff 00 75 08 95 04 91 02 c0 Jul 16 20:19:41 starship kernel: drivers/hid/hid-core.c: report (size 1) (numbered) Jul 16 20:19:41 starship kernel: drivers/hid/hid-core.c: report 1 (size 0) = Jul 16 20:19:41 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:19:41 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:19:41 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:19:41 starship kernel: hid-debug: input Button.0004 = 0 Jul 16 20:19:41 starship kernel: hid-debug: input Button.0005 = 0 Jul 16 20:19:41 starship kernel: hid-debug: input Button.0006 = 0 Jul 16 20:19:41 starship kernel: hid-debug: input Button.0007 = 0 Jul 16 20:19:41 starship kernel: hid-debug: input Button.0008 = 0 Jul 16 20:19:41 starship kernel: hid-debug: input Button.0009 = 0 Jul 16 20:19:41 starship kernel: hid-debug: input Button.000a = 0 Jul 16 20:19:41 starship kernel: hid-debug: input GenericDesktop.HatSwitch = 0 Jul 16 20:19:41 starship kernel: hid-debug: input GenericDesktop.X = 0 Jul 16 20:19:41 starship kernel: hid-debug: input GenericDesktop.Y = 0 Jul 16 20:19:41 starship kernel: hid-debug: input GenericDesktop.Rz = 0 Jul 16 20:19:41 starship kernel: INPUT(1)[INPUT] Jul 16 20:19:41 starship kernel: Field(0) Jul 16 20:19:41 starship kernel: Physical(GenericDesktop.Pointer) Jul 16 20:19:41 starship kernel: Usage(10) Jul 16 20:19:41 starship kernel: Button.0001 Jul 16 20:19:41 starship kernel: Button.0002 Jul 16 20:19:41 starship kernel: Button.0003 Jul 16 20:19:41 starship kernel: Button.0004 Jul 16 20:19:41 starship kernel: Button.0005 Jul 16 20:19:41 starship kernel: Button.0006 Jul 16 20:19:41 starship kernel: Button.0007 Jul 16 20:19:41 starship kernel: Button.0008 Jul 16 20:19:41 starship kernel: Button.0009 Jul 16 20:19:41 starship kernel: Button.000a Jul 16 20:19:41 starship kernel: Logical Minimum(0) Jul 16 20:19:41 starship kernel: Logical Maximum(1) Jul 16 20:19:41 starship kernel: Report Size(1) Jul 16 20:19:41 starship kernel: Report Count(10) Jul 16 20:19:41 starship kernel: Report Offset(0) Jul 16 20:19:41 starship kernel: Flags( Variable Absolute ) Jul 16 20:19:41 starship kernel: Field(1) Jul 16 20:19:41 starship kernel: Physical(GenericDesktop.Pointer) Jul 16 20:19:41 starship kernel: Usage(1) Jul 16 20:19:41 starship kernel: GenericDesktop.HatSwitch Jul 16 20:19:41 starship kernel: Logical Minimum(0) Jul 16 20:19:41 starship kernel: Logical Maximum(7) Jul 16 20:19:41 starship kernel: Physical Minimum(0) Jul 16 20:19:41 starship kernel: Physical Maximum(315) Jul 16 20:19:41 starship kernel: Unit(English Rotation : Degrees) Jul 16 20:19:41 starship kernel: Report Size(4) Jul 16 20:19:41 starship kernel: Report Count(1) Jul 16 20:19:41 starship kernel: Report Offset(18) Jul 16 20:19:41 starship kernel: Flags( Variable Absolute NullState ) Jul 16 20:19:41 starship kernel: Field(2) Jul 16 20:19:41 starship kernel: Physical(GenericDesktop.Pointer) Jul 16 20:19:41 starship kernel: Usage(1) Jul 16 20:19:41 starship kernel: GenericDesktop.X Jul 16 20:19:41 starship kernel: Logical Minimum(-512) Jul 16 20:19:41 starship kernel: Logical Maximum(511) Jul 16 20:19:41 starship kernel: Physical Minimum(0) Jul 16 20:19:41 starship kernel: Physical Maximum(1023) Jul 16 20:19:41 starship kernel: Report Size(10) Jul 16 20:19:41 starship kernel: Report Count(1) Jul 16 20:19:41 starship kernel: Report Offset(22) Jul 16 20:19:41 starship kernel: Flags( Variable Absolute ) Jul 16 20:19:41 starship kernel: Field(3) Jul 16 20:19:41 starship kernel: Physical(GenericDesktop.Pointer) Jul 16 20:19:41 starship kernel: Usage(1) Jul 16 20:19:41 starship kernel: GenericDesktop.Y Jul 16 20:19:41 starship kernel: Logical Minimum(0) Jul 16 20:19:41 starship kernel: Logical Maximum(255) Jul 16 20:19:41 starship kernel: Physical Minimum(0) Jul 16 20:19:41 starship kernel: Physical Maximum(255) Jul 16 20:19:41 starship kernel: Report Size(8) Jul 16 20:19:41 starship kernel: Report Count(1) Jul 16 20:19:41 starship kernel: Report Offset(32) Jul 16 20:19:41 starship kernel: Flags( Variable Absolute ) Jul 16 20:19:41 starship kernel: Field(4) Jul 16 20:19:41 starship kernel: Physical(GenericDesktop.Pointer) Jul 16 20:19:41 starship kernel: Usage(1) Jul 16 20:19:41 starship kernel: GenericDesktop.Rz Jul 16 20:19:41 starship kernel: Logical Minimum(0) Jul 16 20:19:41 starship kernel: Logical Maximum(255) Jul 16 20:19:41 starship kernel: Physical Minimum(0) Jul 16 20:19:41 starship kernel: Physical Maximum(255) Jul 16 20:19:41 starship kernel: Report Size(8) Jul 16 20:19:41 starship kernel: Report Count(1) Jul 16 20:19:41 starship kernel: Report Offset(40) Jul 16 20:19:41 starship kernel: Flags( Variable Absolute ) Jul 16 20:19:41 starship kernel: OUTPUT(64)[OUTPUT] Jul 16 20:19:41 starship kernel: Field(0) Jul 16 20:19:41 starship kernel: Usage(4) Jul 16 20:19:41 starship kernel: GenericDesktop.00bb Jul 16 20:19:41 starship last message repeated 3 times Jul 16 20:19:41 starship kernel: Logical Minimum(0) Jul 16 20:19:41 starship kernel: Logical Maximum(255) Jul 16 20:19:41 starship kernel: Physical Minimum(0) Jul 16 20:19:41 starship kernel: Physical Maximum(255) Jul 16 20:19:41 starship kernel: Report Size(8) Jul 16 20:19:41 starship kernel: Report Count(4) Jul 16 20:19:41 starship kernel: Report Offset(0) Jul 16 20:19:41 starship kernel: Flags( Variable Absolute ) Jul 16 20:19:41 starship kernel: FEATURE(129)[FEATURE] Jul 16 20:19:41 starship kernel: Field(0) Jul 16 20:19:41 starship kernel: Physical(GenericDesktop.Pointer) Jul 16 20:19:41 starship kernel: Usage(2) Jul 16 20:19:41 starship kernel: ff00.0001 Jul 16 20:19:41 starship kernel: ff00.0002 Jul 16 20:19:41 starship kernel: Logical Minimum(0) Jul 16 20:19:41 starship kernel: Logical Maximum(65535) Jul 16 20:19:41 starship kernel: Report Size(16) Jul 16 20:19:41 starship kernel: Report Count(2) Jul 16 20:19:41 starship kernel: Report Offset(0) Jul 16 20:19:41 starship kernel: Flags( Variable Absolute NoPrefferedState Volatile ) Jul 16 20:19:41 starship kernel: FEATURE(130)[FEATURE] Jul 16 20:19:41 starship kernel: Field(0) Jul 16 20:19:41 starship kernel: Physical(GenericDesktop.Pointer) Jul 16 20:19:41 starship kernel: Usage(2) Jul 16 20:19:41 starship kernel: ff00.0003 Jul 16 20:19:41 starship kernel: ff00.0004 Jul 16 20:19:41 starship kernel: Logical Minimum(0) Jul 16 20:19:41 starship kernel: Logical Maximum(127) Jul 16 20:19:41 starship kernel: Report Size(8) Jul 16 20:19:41 starship kernel: Report Count(2) Jul 16 20:19:41 starship kernel: Report Offset(0) Jul 16 20:19:41 starship kernel: Flags( Variable Absolute ) Jul 16 20:19:41 starship kernel: Mapping: Button.0001 ---> Key.Trigger Jul 16 20:19:41 starship kernel: Mapping: Button.0002 ---> Key.ThumbBtn Jul 16 20:19:41 starship kernel: Mapping: Button.0003 ---> Key.ThumbBtn2 Jul 16 20:19:41 starship kernel: Mapping: Button.0004 ---> Key.TopBtn Jul 16 20:19:41 starship kernel: Mapping: Button.0005 ---> Key.TopBtn2 Jul 16 20:19:41 starship kernel: Mapping: Button.0006 ---> Key.PinkieBtn Jul 16 20:19:41 starship kernel: Mapping: Button.0007 ---> Key.BaseBtn Jul 16 20:19:41 starship kernel: Mapping: Button.0008 ---> Key.BaseBtn2 Jul 16 20:19:41 starship kernel: Mapping: Button.0009 ---> Key.BaseBtn3 Jul 16 20:19:41 starship kernel: Mapping: Button.000a ---> Key.BaseBtn4 Jul 16 20:19:41 starship kernel: Mapping: GenericDesktop.HatSwitch ---> Absolute.Hat0X Jul 16 20:19:41 starship kernel: Mapping: GenericDesktop.X ---> Absolute.X Jul 16 20:19:41 starship kernel: Mapping: GenericDesktop.Y ---> Absolute.Y Jul 16 20:19:41 starship kernel: Mapping: GenericDesktop.Rz ---> Absolute.Rz Jul 16 20:19:41 starship kernel: Mapping: GenericDesktop.00bb ---> Absolute.Misc Jul 16 20:19:41 starship kernel: Mapping: GenericDesktop.00bb ---> Absolute.? Jul 16 20:19:41 starship last message repeated 2 times Jul 16 20:19:41 starship kernel: input: Thrustmaster Thrustmasterforce feedback wheel as /class/input/input6 Jul 16 20:19:41 starship kernel: Force feedback for Logitech force feedback devices by Johann Deneux <johann.deneux@it.uu.se> Jul 16 20:19:41 starship kernel: input: USB HID v1.10 Joystick [Thrustmaster Thrustmasterforce feedback wheel] on usb-0000:00:13.1-1 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff 00 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 fe 01 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -2 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = 1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff 00 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 fe 00 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -2 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 fe 00 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -2 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff 01 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = 1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff 00 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff 00 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff 00 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff 00 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 fe 00 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -2 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff ff 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff 00 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 fe ff 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -2 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 fe ff 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -2 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 fe ff 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -2 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 fe ff 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -2 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 fe ff 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -2 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 fe ff 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -2 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 fe fe 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -2 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = -2 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 fe ff 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -2 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 fe ff 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -2 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 fe ff 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -2 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:11 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff ff 00 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Y = -1 Jul 16 20:20:11 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff ff 00 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Y = -1 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff 00 00 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Y = 0 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff ff 00 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Y = -1 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff 00 00 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Y = 0 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 00 ff 00 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.X = 0 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Y = -1 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff 00 00 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Y = 0 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 ff 00 00 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.X = -1 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Y = 0 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report (size 4) (unnumbered) Jul 16 20:20:12 starship kernel: drivers/hid/hid-core.c: report 0 (size 4) = 00 00 ff 00 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0001 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0002 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input Button.0003 = 0 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.X = 0 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Y = -1 Jul 16 20:20:12 starship kernel: hid-debug: input GenericDesktop.Wheel = 0 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c 2007-07-16 18:37 ` Gerald Folcher @ 2007-07-16 21:00 ` Anssi Hannula 0 siblings, 0 replies; 16+ messages in thread From: Anssi Hannula @ 2007-07-16 21:00 UTC (permalink / raw) To: Gerald Folcher; +Cc: Dmitry Torokhov, linux-input [-- Attachment #1: Type: text/plain, Size: 386 bytes --] Gerald Folcher wrote: > Anssi Hannula wrote: > >> Could you perhaps provide the kernel log output when you plug your >> device in with CONFIG_HID_DEBUG enabled in kernel configuration? > > Ok, after setting CONFIG_HID_DEBUG=y here's what got appended in the > '/var/log/kern.log' file when I plugged the device (see attachment). Try the attached patch. -- Anssi Hannula [-- Attachment #2: hid-tmff-constant.diff --] [-- Type: application/octet-stream, Size: 6298 bytes --] From: Anssi Hannula <anssi.hannula@gmail.com> Input: HID - add support for Thrustmaster FGT Rumble Force wheel Add support for devices that have FF_CONSTANT instead of FF_RUMBLE into hid-tmff.c, and add Thrustmaster Ferrari GT 2-in-1 Force Feedback into the list of such devices. Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com> --- Kconfig | 7 +++-- hid-ff.c | 1 hid-tmff.c | 74 +++++++++++++++++++++++++++++++++++++++++++------------------ 3 files changed, 58 insertions(+), 24 deletions(-) diff --git a/drivers/hid/usbhid/Kconfig b/drivers/hid/usbhid/Kconfig index 1b4b572..ca41c30 100644 --- a/drivers/hid/usbhid/Kconfig +++ b/drivers/hid/usbhid/Kconfig @@ -79,12 +79,13 @@ config PANTHERLORD_FF to enable force feedback support for it. config THRUSTMASTER_FF - bool "ThrustMaster FireStorm Dual Power 2 support (EXPERIMENTAL)" + bool "ThrustMaster devices support (EXPERIMENTAL)" depends on HID_FF && EXPERIMENTAL select INPUT_FF_MEMLESS if USB_HID help - Say Y here if you have a THRUSTMASTER FireStore Dual Power 2, - and want to enable force feedback support for it. + Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or + Thrustmaster Ferrari GT 2-in-1 Force Feedback and want to enable force + feedback support for it. Note: if you say N here, this device will still be supported, but without force feedback. diff --git a/drivers/hid/usbhid/hid-ff.c b/drivers/hid/usbhid/hid-ff.c index 23431fb..df2b1e0 100644 --- a/drivers/hid/usbhid/hid-ff.c +++ b/drivers/hid/usbhid/hid-ff.c @@ -67,6 +67,7 @@ static struct hid_ff_initializer inits[] = { #ifdef CONFIG_THRUSTMASTER_FF { 0x44f, 0xb300, hid_tmff_init }, { 0x44f, 0xb304, hid_tmff_init }, + { 0x44f, 0xb654, hid_tmff_init }, /* Thrustmaster Ferrari GT 2-in-1 Force Feedback */ #endif #ifdef CONFIG_ZEROPLUS_FF { 0xc12, 0x0005, hid_zpff_init }, diff --git a/drivers/hid/usbhid/hid-tmff.c b/drivers/hid/usbhid/hid-tmff.c index 555bb48..c1fdd30 100644 --- a/drivers/hid/usbhid/hid-tmff.c +++ b/drivers/hid/usbhid/hid-tmff.c @@ -36,12 +36,22 @@ #include "usbhid.h" /* Usages for thrustmaster devices I know about */ -#define THRUSTMASTER_USAGE_RUMBLE_LR (HID_UP_GENDESK | 0xbb) +#define THRUSTMASTER_USAGE_FF (HID_UP_GENDESK | 0xbb) +/* Used for both rumble and constant force */ +struct dev_type { + u16 idVendor; + u16 idProduct; + int ff; +}; + +static struct dev_type devices[] = { + { 0x044f, 0xb654, FF_CONSTANT }, +}; struct tmff_device { struct hid_report *report; - struct hid_field *rumble; + struct hid_field *field; }; /* Changes values from 0 to 0xffff into values from minimum to maximum */ @@ -61,16 +71,29 @@ static int hid_tmff_play(struct input_dev *dev, void *data, struct ff_effect *ef { struct hid_device *hid = input_get_drvdata(dev); struct tmff_device *tmff = data; - int left, right; /* Rumbling */ - - left = hid_tmff_scale(effect->u.rumble.weak_magnitude, - tmff->rumble->logical_minimum, tmff->rumble->logical_maximum); - right = hid_tmff_scale(effect->u.rumble.strong_magnitude, - tmff->rumble->logical_minimum, tmff->rumble->logical_maximum); + int left, right, x, y; + + switch (effect->type) { + case FF_CONSTANT: + /* constant effects are put in ramp struct for memless devices */ + x = effect->u.ramp.start_level + 0x7f; /* 0x7f is center */ + y = effect->u.ramp.end_level + 0x7f; + tmff->field->value[0] = min(max(x, 0), 0xff); + tmff->field->value[1] = min(max(y, 0), 0xff); + break; + + case FF_RUMBLE: + left = hid_tmff_scale(effect->u.rumble.weak_magnitude, + tmff->field->logical_minimum, tmff->field->logical_maximum); + right = hid_tmff_scale(effect->u.rumble.strong_magnitude, + tmff->field->logical_minimum, tmff->field->logical_maximum); + tmff->field->value[0] = left; + tmff->field->value[1] = right; + break; + } - tmff->rumble->value[0] = left; - tmff->rumble->value[1] = right; - dbg_hid("(left,right)=(%08x, %08x)\n", left, right); + dbg_hid("(value[0],value[1])=(%08x, %08x)\n", tmff->field->value[0], + tmff->field->value[1]); usbhid_submit_report(hid, tmff->report, USB_DIR_OUT); return 0; @@ -82,7 +105,16 @@ int hid_tmff_init(struct hid_device *hid) struct list_head *pos; struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list); struct input_dev *input_dev = hidinput->input; - int error; + int error, i; + int ff_bit = FF_RUMBLE; + + for (i = 0; i < ARRAY_SIZE(devices); i++) { + if (input_dev->id.vendor == devices[i].idVendor && + input_dev->id.product == devices[i].idProduct) { + ff_bit = devices[i].ff; + break; + } + } tmff = kzalloc(sizeof(struct tmff_device), GFP_KERNEL); if (!tmff) @@ -100,31 +132,31 @@ int hid_tmff_init(struct hid_device *hid) continue; switch (field->usage[0].hid) { - case THRUSTMASTER_USAGE_RUMBLE_LR: + case THRUSTMASTER_USAGE_FF: if (field->report_count < 2) { - warn("ignoring THRUSTMASTER_USAGE_RUMBLE_LR with report_count < 2"); + warn("ignoring THRUSTMASTER_USAGE_FF with report_count < 2"); continue; } if (field->logical_maximum == field->logical_minimum) { - warn("ignoring THRUSTMASTER_USAGE_RUMBLE_LR with logical_maximum == logical_minimum"); + warn("ignoring THRUSTMASTER_USAGE_FF with logical_maximum == logical_minimum"); continue; } if (tmff->report && tmff->report != report) { - warn("ignoring THRUSTMASTER_USAGE_RUMBLE_LR in other report"); + warn("ignoring THRUSTMASTER_USAGE_FF in other report"); continue; } - if (tmff->rumble && tmff->rumble != field) { - warn("ignoring duplicate THRUSTMASTER_USAGE_RUMBLE_LR"); + if (tmff->field && tmff->field != field) { + warn("ignoring duplicate THRUSTMASTER_USAGE_FF"); continue; } tmff->report = report; - tmff->rumble = field; + tmff->field = field; - set_bit(FF_RUMBLE, input_dev->ffbit); + set_bit(ff_bit, input_dev->ffbit); break; default: @@ -140,7 +172,7 @@ int hid_tmff_init(struct hid_device *hid) return error; } - info("Force feedback for ThrustMaster rumble pad devices by Zinx Verituse <zinx@epicsol.org>"); + info("Force feedback for ThrustMaster devices by Zinx Verituse <zinx@epicsol.org>"); return 0; } ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c 2007-07-16 17:14 ` Gerald Folcher 2007-07-16 17:21 ` Anssi Hannula @ 2007-07-16 20:50 ` Dmitry Torokhov 2007-07-16 21:03 ` Dmitry Torokhov 2007-07-17 13:14 ` Gerald Folcher 2 siblings, 1 reply; 16+ messages in thread From: Dmitry Torokhov @ 2007-07-16 20:50 UTC (permalink / raw) To: Gerald Folcher; +Cc: linux-input [-- Attachment #1: Type: text/plain, Size: 1240 bytes --] On 7/16/07, Gerald Folcher <geraldf2@free.fr> wrote: > Dmitry Torokhov wrote: > > I wonder if the attached is all that is needed for your wheel to work... > > No, but I think I understand where is the confusion: > It won't work because my wheel is the "Force Feedback" model, not the > "Rumble Force" model which is cheaper but looks exactly the same. With > your patch applied as is, my wheel will neither do rumble effects nor > constant force effects, the force feedback test utilities 'ffcfstress' > and 'ffmvforce' will spit an error message on startup and exit. And > 'fftest' will think my wheel can do Rumble but trying such effects will > effectively trigger hazardous constant forces on my wheel. > > But your patch would maybe work for the actual Rumble wheel if you > change the id to 0x651, which is the id of the Rumble version according > to the MS-Windows registry on a machine where I installed the > Thrustmaster drivers (the registry is full of id's of the wheels > supported by the driver). > > While the id of my wheel (Force Feedback) is: 0x654 (and according to > the aforementioned MS-Windows registry there is also an id 0x652 for a > Thrustmaster wheel with the same name). > OK, how about this then? -- Dmitry [-- Attachment #2: hid-add-thrustmaster-fgt-wheel.patch --] [-- Type: application/octet-stream, Size: 6463 bytes --] Input: HID - add support for Thrustmaster FGT Force Feedback wheel Rework thrustmaster force-feedback module to support devices having different types of force feedback effects. Add signatures of Thrustmaster FGT Rumble Force and Thrustmaster FGT Force Feedback wheels to the list of devices dupported by tthe module. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> --- drivers/hid/usbhid/hid-ff.c | 2 drivers/hid/usbhid/hid-tmff.c | 136 +++++++++++++++++++++++++++++------------- 2 files changed, 99 insertions(+), 39 deletions(-) Index: linux/drivers/hid/usbhid/hid-ff.c =================================================================== --- linux.orig/drivers/hid/usbhid/hid-ff.c +++ linux/drivers/hid/usbhid/hid-ff.c @@ -67,6 +67,8 @@ static struct hid_ff_initializer inits[] #ifdef CONFIG_THRUSTMASTER_FF { 0x44f, 0xb300, hid_tmff_init }, { 0x44f, 0xb304, hid_tmff_init }, + { 0x44f, 0xb651, hid_tmff_init }, /* FGT Rumble Force Wheel */ + { 0x44f, 0xb654, hid_tmff_init }, /* FGT Force Feedback Wheel */ #endif #ifdef CONFIG_ZEROPLUS_FF { 0xc12, 0x0005, hid_zpff_init }, Index: linux/drivers/hid/usbhid/hid-tmff.c =================================================================== --- linux.orig/drivers/hid/usbhid/hid-tmff.c +++ linux/drivers/hid/usbhid/hid-tmff.c @@ -36,16 +36,39 @@ #include "usbhid.h" /* Usages for thrustmaster devices I know about */ -#define THRUSTMASTER_USAGE_RUMBLE_LR (HID_UP_GENDESK | 0xbb) +#define THRUSTMASTER_USAGE_FORCEFEEDBACK (HID_UP_GENDESK | 0xbb) +struct dev_type { + u16 idVendor; + u16 idProduct; + const signed short *ff; +}; + +static const signed short ff_rumble[] = { + FF_RUMBLE, + -1 +}; + +static const signed short ff_joystick[] = { + FF_CONSTANT, + -1 +}; + +static const struct dev_type devices[] = { + { 0x44f, 0xb300, ff_rumble }, + { 0x44f, 0xb304, ff_rumble }, + { 0x44f, 0xb651, ff_rumble }, /* FGT Rumble Force Wheel */ + { 0x44f, 0xb654, ff_joystick }, /* FGT Force Feedback Wheel */ +}; struct tmff_device { struct hid_report *report; - struct hid_field *rumble; + struct hid_field *ff_field; }; /* Changes values from 0 to 0xffff into values from minimum to maximum */ -static inline int hid_tmff_scale(unsigned int in, int minimum, int maximum) +static inline int hid_tmff_scale_u16(unsigned int in, + int minimum, int maximum) { int ret; @@ -57,22 +80,57 @@ static inline int hid_tmff_scale(unsigne return ret; } +/* Changes values from -0x80 to 0x7f into values from minimum to maximum */ +static inline int hid_tmff_scale_s8(int in, + int minimum, int maximum) +{ + int ret; + + ret = (((in + 0x80) * (maximum - minimum)) / 0xff) + minimum; + if (ret < minimum) + return minimum; + if (ret > maximum) + return maximum; + return ret; +} + static int hid_tmff_play(struct input_dev *dev, void *data, struct ff_effect *effect) { struct hid_device *hid = input_get_drvdata(dev); struct tmff_device *tmff = data; + struct hid_field *ff_field = tmff->ff_field; + int x, y; int left, right; /* Rumbling */ - left = hid_tmff_scale(effect->u.rumble.weak_magnitude, - tmff->rumble->logical_minimum, tmff->rumble->logical_maximum); - right = hid_tmff_scale(effect->u.rumble.strong_magnitude, - tmff->rumble->logical_minimum, tmff->rumble->logical_maximum); - - tmff->rumble->value[0] = left; - tmff->rumble->value[1] = right; - dbg_hid("(left,right)=(%08x, %08x)\n", left, right); - usbhid_submit_report(hid, tmff->report, USB_DIR_OUT); - + switch (effect->type) { + case FF_CONSTANT: + x = hid_tmff_scale_s8(effect->u.ramp.start_level, + ff_field->logical_minimum, + ff_field->logical_maximum); + y = hid_tmff_scale_s8(effect->u.ramp.end_level, + ff_field->logical_minimum, + ff_field->logical_maximum); + + dbg_hid("(x, y)=(%04x, %04x)\n", x, y); + ff_field->value[0] = x; + ff_field->value[1] = y; + usbhid_submit_report(hid, tmff->report, USB_DIR_OUT); + break; + + case FF_RUMBLE: + left = hid_tmff_scale_u16(effect->u.rumble.weak_magnitude, + ff_field->logical_minimum, + ff_field->logical_maximum); + right = hid_tmff_scale_u16(effect->u.rumble.strong_magnitude, + ff_field->logical_minimum, + ff_field->logical_maximum); + + dbg_hid("(left,right)=(%08x, %08x)\n", left, right); + ff_field->value[0] = left; + ff_field->value[1] = right; + usbhid_submit_report(hid, tmff->report, USB_DIR_OUT); + break; + } return 0; } @@ -89,7 +147,7 @@ int hid_tmff_init(struct hid_device *hid return -ENOMEM; /* Find the report to use */ - __list_for_each(pos, &hid->report_enum[HID_OUTPUT_REPORT].report_list) { + list_for_each(pos, &hid->report_enum[HID_OUTPUT_REPORT].report_list) { struct hid_report *report = (struct hid_report *)pos; int fieldnum; @@ -100,36 +158,36 @@ int hid_tmff_init(struct hid_device *hid continue; switch (field->usage[0].hid) { - case THRUSTMASTER_USAGE_RUMBLE_LR: - if (field->report_count < 2) { - warn("ignoring THRUSTMASTER_USAGE_RUMBLE_LR with report_count < 2"); - continue; - } - - if (field->logical_maximum == field->logical_minimum) { - warn("ignoring THRUSTMASTER_USAGE_RUMBLE_LR with logical_maximum == logical_minimum"); - continue; - } - - if (tmff->report && tmff->report != report) { - warn("ignoring THRUSTMASTER_USAGE_RUMBLE_LR in other report"); - continue; - } - - if (tmff->rumble && tmff->rumble != field) { - warn("ignoring duplicate THRUSTMASTER_USAGE_RUMBLE_LR"); - continue; - } + case THRUSTMASTER_USAGE_FORCEFEEDBACK: + if (field->report_count < 2) { + warn("ignoring FF field with report_count < 2"); + continue; + } + + if (field->logical_maximum == field->logical_minimum) { + warn("ignoring FF field with logical_maximum == logical_minimum"); + continue; + } + + if (tmff->report && tmff->report != report) { + warn("ignoring FF field in other report"); + continue; + } - tmff->report = report; - tmff->rumble = field; + if (tmff->ff_field && tmff->ff_field != field) { + warn("ignoring duplicate FF field"); + continue; + } + + tmff->report = report; + tmff->ff_field = field; set_bit(FF_RUMBLE, input_dev->ffbit); break; - default: - warn("ignoring unknown output usage %08x", field->usage[0].hid); - continue; + default: + warn("ignoring unknown output usage %08x", field->usage[0].hid); + continue; } } } ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c 2007-07-16 20:50 ` Dmitry Torokhov @ 2007-07-16 21:03 ` Dmitry Torokhov 2007-07-16 21:21 ` Dmitry Torokhov 0 siblings, 1 reply; 16+ messages in thread From: Dmitry Torokhov @ 2007-07-16 21:03 UTC (permalink / raw) To: Gerald Folcher; +Cc: linux-input, Anssi Hannula On 7/16/07, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > > OK, how about this then? > Ignore it, it missing couple of bits; Anssi's is more complete I think. -- Dmitry ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c 2007-07-16 21:03 ` Dmitry Torokhov @ 2007-07-16 21:21 ` Dmitry Torokhov 2007-07-17 9:14 ` Gerald Folcher 0 siblings, 1 reply; 16+ messages in thread From: Dmitry Torokhov @ 2007-07-16 21:21 UTC (permalink / raw) To: Gerald Folcher; +Cc: linux-input, Anssi Hannula [-- Attachment #1: Type: text/plain, Size: 309 bytes --] On 7/16/07, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > On 7/16/07, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > > > > OK, how about this then? > > > > Ignore it, it missing couple of bits; Anssi's is more complete I think. > Not quite what I wanted either, what about this one? -- Dmitry [-- Attachment #2: hid-add-thrustmaster-fgt-wheel.patch --] [-- Type: application/octet-stream, Size: 8614 bytes --] Input: HID - add support for Thrustmaster FGT Force Feedback wheel Rework thrustmaster force-feedback module to support devices having different types of force feedback effects. Add signatures of Thrustmaster FGT Rumble Force and Thrustmaster FGT Force Feedback wheels to the list of devices dupported by tthe module. Parts of the patch were lifted off a simalar patch by Anssi Hannula <anssi.hannula@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru> --- drivers/hid/usbhid/Kconfig | 5 - drivers/hid/usbhid/hid-ff.c | 2 drivers/hid/usbhid/hid-tmff.c | 161 +++++++++++++++++++++++++++++++----------- 3 files changed, 124 insertions(+), 44 deletions(-) Index: linux/drivers/hid/usbhid/hid-ff.c =================================================================== --- linux.orig/drivers/hid/usbhid/hid-ff.c +++ linux/drivers/hid/usbhid/hid-ff.c @@ -67,6 +67,8 @@ static struct hid_ff_initializer inits[] #ifdef CONFIG_THRUSTMASTER_FF { 0x44f, 0xb300, hid_tmff_init }, { 0x44f, 0xb304, hid_tmff_init }, + { 0x44f, 0xb651, hid_tmff_init }, /* FGT Rumble Force Wheel */ + { 0x44f, 0xb654, hid_tmff_init }, /* FGT Force Feedback Wheel */ #endif #ifdef CONFIG_ZEROPLUS_FF { 0xc12, 0x0005, hid_zpff_init }, Index: linux/drivers/hid/usbhid/hid-tmff.c =================================================================== --- linux.orig/drivers/hid/usbhid/hid-tmff.c +++ linux/drivers/hid/usbhid/hid-tmff.c @@ -36,16 +36,39 @@ #include "usbhid.h" /* Usages for thrustmaster devices I know about */ -#define THRUSTMASTER_USAGE_RUMBLE_LR (HID_UP_GENDESK | 0xbb) +#define THRUSTMASTER_USAGE_FF (HID_UP_GENDESK | 0xbb) +struct dev_type { + u16 idVendor; + u16 idProduct; + const signed short *ff; +}; + +static const signed short ff_rumble[] = { + FF_RUMBLE, + -1 +}; + +static const signed short ff_joystick[] = { + FF_CONSTANT, + -1 +}; + +static const struct dev_type devices[] = { + { 0x44f, 0xb300, ff_rumble }, + { 0x44f, 0xb304, ff_rumble }, + { 0x44f, 0xb651, ff_rumble }, /* FGT Rumble Force Wheel */ + { 0x44f, 0xb654, ff_joystick }, /* FGT Force Feedback Wheel */ +}; struct tmff_device { struct hid_report *report; - struct hid_field *rumble; + struct hid_field *ff_field; }; /* Changes values from 0 to 0xffff into values from minimum to maximum */ -static inline int hid_tmff_scale(unsigned int in, int minimum, int maximum) +static inline int hid_tmff_scale_u16(unsigned int in, + int minimum, int maximum) { int ret; @@ -57,22 +80,57 @@ static inline int hid_tmff_scale(unsigne return ret; } +/* Changes values from -0x80 to 0x7f into values from minimum to maximum */ +static inline int hid_tmff_scale_s8(int in, + int minimum, int maximum) +{ + int ret; + + ret = (((in + 0x80) * (maximum - minimum)) / 0xff) + minimum; + if (ret < minimum) + return minimum; + if (ret > maximum) + return maximum; + return ret; +} + static int hid_tmff_play(struct input_dev *dev, void *data, struct ff_effect *effect) { struct hid_device *hid = input_get_drvdata(dev); struct tmff_device *tmff = data; + struct hid_field *ff_field = tmff->ff_field; + int x, y; int left, right; /* Rumbling */ - left = hid_tmff_scale(effect->u.rumble.weak_magnitude, - tmff->rumble->logical_minimum, tmff->rumble->logical_maximum); - right = hid_tmff_scale(effect->u.rumble.strong_magnitude, - tmff->rumble->logical_minimum, tmff->rumble->logical_maximum); - - tmff->rumble->value[0] = left; - tmff->rumble->value[1] = right; - dbg_hid("(left,right)=(%08x, %08x)\n", left, right); - usbhid_submit_report(hid, tmff->report, USB_DIR_OUT); - + switch (effect->type) { + case FF_CONSTANT: + x = hid_tmff_scale_s8(effect->u.ramp.start_level, + ff_field->logical_minimum, + ff_field->logical_maximum); + y = hid_tmff_scale_s8(effect->u.ramp.end_level, + ff_field->logical_minimum, + ff_field->logical_maximum); + + dbg_hid("(x, y)=(%04x, %04x)\n", x, y); + ff_field->value[0] = x; + ff_field->value[1] = y; + usbhid_submit_report(hid, tmff->report, USB_DIR_OUT); + break; + + case FF_RUMBLE: + left = hid_tmff_scale_u16(effect->u.rumble.weak_magnitude, + ff_field->logical_minimum, + ff_field->logical_maximum); + right = hid_tmff_scale_u16(effect->u.rumble.strong_magnitude, + ff_field->logical_minimum, + ff_field->logical_maximum); + + dbg_hid("(left,right)=(%08x, %08x)\n", left, right); + ff_field->value[0] = left; + ff_field->value[1] = right; + usbhid_submit_report(hid, tmff->report, USB_DIR_OUT); + break; + } return 0; } @@ -82,14 +140,16 @@ int hid_tmff_init(struct hid_device *hid struct list_head *pos; struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list); struct input_dev *input_dev = hidinput->input; + const signed short *ff_bits = ff_joystick; int error; + int i; tmff = kzalloc(sizeof(struct tmff_device), GFP_KERNEL); if (!tmff) return -ENOMEM; /* Find the report to use */ - __list_for_each(pos, &hid->report_enum[HID_OUTPUT_REPORT].report_list) { + list_for_each(pos, &hid->report_enum[HID_OUTPUT_REPORT].report_list) { struct hid_report *report = (struct hid_report *)pos; int fieldnum; @@ -100,48 +160,65 @@ int hid_tmff_init(struct hid_device *hid continue; switch (field->usage[0].hid) { - case THRUSTMASTER_USAGE_RUMBLE_LR: - if (field->report_count < 2) { - warn("ignoring THRUSTMASTER_USAGE_RUMBLE_LR with report_count < 2"); - continue; - } + case THRUSTMASTER_USAGE_FF: + if (field->report_count < 2) { + warn("ignoring FF field with report_count < 2"); + continue; + } - if (field->logical_maximum == field->logical_minimum) { - warn("ignoring THRUSTMASTER_USAGE_RUMBLE_LR with logical_maximum == logical_minimum"); - continue; - } + if (field->logical_maximum == field->logical_minimum) { + warn("ignoring FF field with logical_maximum == logical_minimum"); + continue; + } - if (tmff->report && tmff->report != report) { - warn("ignoring THRUSTMASTER_USAGE_RUMBLE_LR in other report"); - continue; - } + if (tmff->report && tmff->report != report) { + warn("ignoring FF field in other report"); + continue; + } - if (tmff->rumble && tmff->rumble != field) { - warn("ignoring duplicate THRUSTMASTER_USAGE_RUMBLE_LR"); - continue; + if (tmff->ff_field && tmff->ff_field != field) { + warn("ignoring duplicate FF field"); + continue; + } + + tmff->report = report; + tmff->ff_field = field; + + for (i = 0; i < ARRAY_SIZE(devices); i++) { + if (input_dev->id.vendor == devices[i].idVendor && + input_dev->id.product == devices[i].idProduct) { + ff_bits = devices[i].ff; + break; } + } - tmff->report = report; - tmff->rumble = field; + for (i = 0; ff_bits[i] >= 0; i++) + set_bit(ff_bits[i], input_dev->ffbit); - set_bit(FF_RUMBLE, input_dev->ffbit); - break; + break; - default: - warn("ignoring unknown output usage %08x", field->usage[0].hid); - continue; + default: + warn("ignoring unknown output usage %08x", field->usage[0].hid); + continue; } } } - error = input_ff_create_memless(input_dev, tmff, hid_tmff_play); - if (error) { - kfree(tmff); - return error; + if (!tmff->report) { + err("cant find FF field in output reports\n"); + error = -ENODEV; + goto fail; } - info("Force feedback for ThrustMaster rumble pad devices by Zinx Verituse <zinx@epicsol.org>"); + error = input_ff_create_memless(input_dev, tmff, hid_tmff_play); + if (error) + goto fail; + info("Force feedback for ThrustMaster devices by Zinx Verituse <zinx@epicsol.org>"); return 0; + + fail: + kfree(tmff); + return error; } Index: linux/drivers/hid/usbhid/Kconfig =================================================================== --- linux.orig/drivers/hid/usbhid/Kconfig +++ linux/drivers/hid/usbhid/Kconfig @@ -79,11 +79,12 @@ config PANTHERLORD_FF to enable force feedback support for it. config THRUSTMASTER_FF - bool "ThrustMaster FireStorm Dual Power 2 support (EXPERIMENTAL)" + bool "ThrustMaster devices support (EXPERIMENTAL)" depends on HID_FF && EXPERIMENTAL select INPUT_FF_MEMLESS if USB_HID help - Say Y here if you have a THRUSTMASTER FireStore Dual Power 2, + Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or + a THRUSTMASTER Ferrari GT Rumble Force or Force Feedback Wheel, and want to enable force feedback support for it. Note: if you say N here, this device will still be supported, but without force feedback. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c 2007-07-16 21:21 ` Dmitry Torokhov @ 2007-07-17 9:14 ` Gerald Folcher 2007-07-17 13:50 ` Dmitry Torokhov 0 siblings, 1 reply; 16+ messages in thread From: Gerald Folcher @ 2007-07-17 9:14 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: linux-input, Anssi Hannula Dmitry Torokhov wrote: > Not quite what I wanted either, what about this one? Ok, great, I tried both patches alternatively (this last one from Dmitry, and the previous Anssi's one) and they both worked well for my Thrustmaster FGT Force Feedback wheel (tested with the fftest, ffcfstress, and ffmvforce utilities). Thanks you both for doing patches so fast :) (OT: Btw, I'm sorry for the delay, I wanted to test it ASAP but ran into problems after upgrading the kernel with a something-git7 patch, it wouldn't compile (don't worry it's completely unrelated to your patches). Finally, after trying numerous unfruitful random things, I was able to compile after getting a very recent version of the kernel tree using git.) Thanks. -- Gerald Folcher ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c 2007-07-17 9:14 ` Gerald Folcher @ 2007-07-17 13:50 ` Dmitry Torokhov 2007-07-30 13:13 ` Jiri Kosina 0 siblings, 1 reply; 16+ messages in thread From: Dmitry Torokhov @ 2007-07-17 13:50 UTC (permalink / raw) To: Gerald Folcher, Jiri Kosina; +Cc: linux-input, Anssi Hannula [-- Attachment #1: Type: text/plain, Size: 513 bytes --] On 7/17/07, Gerald Folcher <geraldf2@free.fr> wrote: > Dmitry Torokhov wrote: > > Not quite what I wanted either, what about this one? > > Ok, great, I tried both patches alternatively (this last one from > Dmitry, and the previous Anssi's one) and they both worked well for my > Thrustmaster FGT Force Feedback wheel (tested with the fftest, > ffcfstress, and ffmvforce utilities). > > Thanks you both for doing patches so fast :) > Thank you for testing. Jiri, please consider adding to your tree. -- Dmitry [-- Attachment #2: hid-add-thrustmaster-fgt-wheel.patch --] [-- Type: application/octet-stream, Size: 8614 bytes --] Input: HID - add support for Thrustmaster FGT Force Feedback wheel Rework thrustmaster force-feedback module to support devices having different types of force feedback effects. Add signatures of Thrustmaster FGT Rumble Force and Thrustmaster FGT Force Feedback wheels to the list of devices dupported by tthe module. Parts of the patch were lifted off a simalar patch by Anssi Hannula <anssi.hannula@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru> --- drivers/hid/usbhid/Kconfig | 5 - drivers/hid/usbhid/hid-ff.c | 2 drivers/hid/usbhid/hid-tmff.c | 161 +++++++++++++++++++++++++++++++----------- 3 files changed, 124 insertions(+), 44 deletions(-) Index: linux/drivers/hid/usbhid/hid-ff.c =================================================================== --- linux.orig/drivers/hid/usbhid/hid-ff.c +++ linux/drivers/hid/usbhid/hid-ff.c @@ -67,6 +67,8 @@ static struct hid_ff_initializer inits[] #ifdef CONFIG_THRUSTMASTER_FF { 0x44f, 0xb300, hid_tmff_init }, { 0x44f, 0xb304, hid_tmff_init }, + { 0x44f, 0xb651, hid_tmff_init }, /* FGT Rumble Force Wheel */ + { 0x44f, 0xb654, hid_tmff_init }, /* FGT Force Feedback Wheel */ #endif #ifdef CONFIG_ZEROPLUS_FF { 0xc12, 0x0005, hid_zpff_init }, Index: linux/drivers/hid/usbhid/hid-tmff.c =================================================================== --- linux.orig/drivers/hid/usbhid/hid-tmff.c +++ linux/drivers/hid/usbhid/hid-tmff.c @@ -36,16 +36,39 @@ #include "usbhid.h" /* Usages for thrustmaster devices I know about */ -#define THRUSTMASTER_USAGE_RUMBLE_LR (HID_UP_GENDESK | 0xbb) +#define THRUSTMASTER_USAGE_FF (HID_UP_GENDESK | 0xbb) +struct dev_type { + u16 idVendor; + u16 idProduct; + const signed short *ff; +}; + +static const signed short ff_rumble[] = { + FF_RUMBLE, + -1 +}; + +static const signed short ff_joystick[] = { + FF_CONSTANT, + -1 +}; + +static const struct dev_type devices[] = { + { 0x44f, 0xb300, ff_rumble }, + { 0x44f, 0xb304, ff_rumble }, + { 0x44f, 0xb651, ff_rumble }, /* FGT Rumble Force Wheel */ + { 0x44f, 0xb654, ff_joystick }, /* FGT Force Feedback Wheel */ +}; struct tmff_device { struct hid_report *report; - struct hid_field *rumble; + struct hid_field *ff_field; }; /* Changes values from 0 to 0xffff into values from minimum to maximum */ -static inline int hid_tmff_scale(unsigned int in, int minimum, int maximum) +static inline int hid_tmff_scale_u16(unsigned int in, + int minimum, int maximum) { int ret; @@ -57,22 +80,57 @@ static inline int hid_tmff_scale(unsigne return ret; } +/* Changes values from -0x80 to 0x7f into values from minimum to maximum */ +static inline int hid_tmff_scale_s8(int in, + int minimum, int maximum) +{ + int ret; + + ret = (((in + 0x80) * (maximum - minimum)) / 0xff) + minimum; + if (ret < minimum) + return minimum; + if (ret > maximum) + return maximum; + return ret; +} + static int hid_tmff_play(struct input_dev *dev, void *data, struct ff_effect *effect) { struct hid_device *hid = input_get_drvdata(dev); struct tmff_device *tmff = data; + struct hid_field *ff_field = tmff->ff_field; + int x, y; int left, right; /* Rumbling */ - left = hid_tmff_scale(effect->u.rumble.weak_magnitude, - tmff->rumble->logical_minimum, tmff->rumble->logical_maximum); - right = hid_tmff_scale(effect->u.rumble.strong_magnitude, - tmff->rumble->logical_minimum, tmff->rumble->logical_maximum); - - tmff->rumble->value[0] = left; - tmff->rumble->value[1] = right; - dbg_hid("(left,right)=(%08x, %08x)\n", left, right); - usbhid_submit_report(hid, tmff->report, USB_DIR_OUT); - + switch (effect->type) { + case FF_CONSTANT: + x = hid_tmff_scale_s8(effect->u.ramp.start_level, + ff_field->logical_minimum, + ff_field->logical_maximum); + y = hid_tmff_scale_s8(effect->u.ramp.end_level, + ff_field->logical_minimum, + ff_field->logical_maximum); + + dbg_hid("(x, y)=(%04x, %04x)\n", x, y); + ff_field->value[0] = x; + ff_field->value[1] = y; + usbhid_submit_report(hid, tmff->report, USB_DIR_OUT); + break; + + case FF_RUMBLE: + left = hid_tmff_scale_u16(effect->u.rumble.weak_magnitude, + ff_field->logical_minimum, + ff_field->logical_maximum); + right = hid_tmff_scale_u16(effect->u.rumble.strong_magnitude, + ff_field->logical_minimum, + ff_field->logical_maximum); + + dbg_hid("(left,right)=(%08x, %08x)\n", left, right); + ff_field->value[0] = left; + ff_field->value[1] = right; + usbhid_submit_report(hid, tmff->report, USB_DIR_OUT); + break; + } return 0; } @@ -82,14 +140,16 @@ int hid_tmff_init(struct hid_device *hid struct list_head *pos; struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list); struct input_dev *input_dev = hidinput->input; + const signed short *ff_bits = ff_joystick; int error; + int i; tmff = kzalloc(sizeof(struct tmff_device), GFP_KERNEL); if (!tmff) return -ENOMEM; /* Find the report to use */ - __list_for_each(pos, &hid->report_enum[HID_OUTPUT_REPORT].report_list) { + list_for_each(pos, &hid->report_enum[HID_OUTPUT_REPORT].report_list) { struct hid_report *report = (struct hid_report *)pos; int fieldnum; @@ -100,48 +160,65 @@ int hid_tmff_init(struct hid_device *hid continue; switch (field->usage[0].hid) { - case THRUSTMASTER_USAGE_RUMBLE_LR: - if (field->report_count < 2) { - warn("ignoring THRUSTMASTER_USAGE_RUMBLE_LR with report_count < 2"); - continue; - } + case THRUSTMASTER_USAGE_FF: + if (field->report_count < 2) { + warn("ignoring FF field with report_count < 2"); + continue; + } - if (field->logical_maximum == field->logical_minimum) { - warn("ignoring THRUSTMASTER_USAGE_RUMBLE_LR with logical_maximum == logical_minimum"); - continue; - } + if (field->logical_maximum == field->logical_minimum) { + warn("ignoring FF field with logical_maximum == logical_minimum"); + continue; + } - if (tmff->report && tmff->report != report) { - warn("ignoring THRUSTMASTER_USAGE_RUMBLE_LR in other report"); - continue; - } + if (tmff->report && tmff->report != report) { + warn("ignoring FF field in other report"); + continue; + } - if (tmff->rumble && tmff->rumble != field) { - warn("ignoring duplicate THRUSTMASTER_USAGE_RUMBLE_LR"); - continue; + if (tmff->ff_field && tmff->ff_field != field) { + warn("ignoring duplicate FF field"); + continue; + } + + tmff->report = report; + tmff->ff_field = field; + + for (i = 0; i < ARRAY_SIZE(devices); i++) { + if (input_dev->id.vendor == devices[i].idVendor && + input_dev->id.product == devices[i].idProduct) { + ff_bits = devices[i].ff; + break; } + } - tmff->report = report; - tmff->rumble = field; + for (i = 0; ff_bits[i] >= 0; i++) + set_bit(ff_bits[i], input_dev->ffbit); - set_bit(FF_RUMBLE, input_dev->ffbit); - break; + break; - default: - warn("ignoring unknown output usage %08x", field->usage[0].hid); - continue; + default: + warn("ignoring unknown output usage %08x", field->usage[0].hid); + continue; } } } - error = input_ff_create_memless(input_dev, tmff, hid_tmff_play); - if (error) { - kfree(tmff); - return error; + if (!tmff->report) { + err("cant find FF field in output reports\n"); + error = -ENODEV; + goto fail; } - info("Force feedback for ThrustMaster rumble pad devices by Zinx Verituse <zinx@epicsol.org>"); + error = input_ff_create_memless(input_dev, tmff, hid_tmff_play); + if (error) + goto fail; + info("Force feedback for ThrustMaster devices by Zinx Verituse <zinx@epicsol.org>"); return 0; + + fail: + kfree(tmff); + return error; } Index: linux/drivers/hid/usbhid/Kconfig =================================================================== --- linux.orig/drivers/hid/usbhid/Kconfig +++ linux/drivers/hid/usbhid/Kconfig @@ -79,11 +79,12 @@ config PANTHERLORD_FF to enable force feedback support for it. config THRUSTMASTER_FF - bool "ThrustMaster FireStorm Dual Power 2 support (EXPERIMENTAL)" + bool "ThrustMaster devices support (EXPERIMENTAL)" depends on HID_FF && EXPERIMENTAL select INPUT_FF_MEMLESS if USB_HID help - Say Y here if you have a THRUSTMASTER FireStore Dual Power 2, + Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or + a THRUSTMASTER Ferrari GT Rumble Force or Force Feedback Wheel, and want to enable force feedback support for it. Note: if you say N here, this device will still be supported, but without force feedback. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c 2007-07-17 13:50 ` Dmitry Torokhov @ 2007-07-30 13:13 ` Jiri Kosina 2007-08-22 2:30 ` Gerald Folcher 0 siblings, 1 reply; 16+ messages in thread From: Jiri Kosina @ 2007-07-30 13:13 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Gerald Folcher, linux-input, Anssi Hannula On Tue, 17 Jul 2007, Dmitry Torokhov wrote: > > Ok, great, I tried both patches alternatively (this last one from > > Dmitry, and the previous Anssi's one) and they both worked well for my > > Thrustmaster FGT Force Feedback wheel (tested with the fftest, > > ffcfstress, and ffmvforce utilities). > > Thanks you both for doing patches so fast :) > Thank you for testing. Jiri, please consider adding to your tree. Hi, sorry for late reply, I was offline on vacation. I have fixed a minor typo in the patch changelog and applied it to my tree, thanks a lot. -- Jiri Kosina SUSE Labs ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c 2007-07-30 13:13 ` Jiri Kosina @ 2007-08-22 2:30 ` Gerald Folcher 2007-08-22 8:16 ` Jiri Kosina 0 siblings, 1 reply; 16+ messages in thread From: Gerald Folcher @ 2007-08-22 2:30 UTC (permalink / raw) To: Jiri Kosina; +Cc: Dmitry Torokhov, linux-input, Anssi Hannula Jiri Kosina wrote: > I have fixed a minor typo in the patch changelog and applied it to my > tree, thanks a lot. Please excuse my probable lack of a clue, but does that mean it is in the "HID development tree" ? Because I looked using the web interface at http://git.kernel.org/?p=linux/kernel/git/jikos/hid.git;a=tree;f=drivers/hid/usbhid;h=ada3794226b04c38854c4c5bd8813a85e02328a2;hb=HEAD and the hid-ff.c and hid-tmff.c files there seems to not include the changes. (?) -- Gerald Folcher ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c 2007-08-22 2:30 ` Gerald Folcher @ 2007-08-22 8:16 ` Jiri Kosina 2007-08-22 10:30 ` Gerald Folcher 0 siblings, 1 reply; 16+ messages in thread From: Jiri Kosina @ 2007-08-22 8:16 UTC (permalink / raw) To: Gerald Folcher; +Cc: Dmitry Torokhov, linux-input, Anssi Hannula On Wed, 22 Aug 2007, Gerald Folcher wrote: > Please excuse my probable lack of a clue, but does that mean it is in > the "HID development tree" ? Because I looked using the web interface at > http://git.kernel.org/?p=linux/kernel/git/jikos/hid.git;a=tree;f=drivers/hid/usbhid;h=ada3794226b04c38854c4c5bd8813a85e02328a2;hb=HEAD > and the hid-ff.c and hid-tmff.c files there seems to not include the > changes. (?) Hi Gerald, you were looking at the 'master' branch of the tree, but the patch is comitted in the 'upstream' branch -- please look at http://git.kernel.org/?p=linux/kernel/git/jikos/hid.git;a=shortlog;h=upstream -- Jiri Kosina SUSE Labs ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c 2007-08-22 8:16 ` Jiri Kosina @ 2007-08-22 10:30 ` Gerald Folcher 0 siblings, 0 replies; 16+ messages in thread From: Gerald Folcher @ 2007-08-22 10:30 UTC (permalink / raw) To: Jiri Kosina; +Cc: Dmitry Torokhov, linux-input, Anssi Hannula Jiri Kosina wrote: > you were looking at the 'master' branch of the tree, but the patch is > comitted in the 'upstream' branch -- please look at > http://git.kernel.org/?p=linux/kernel/git/jikos/hid.git;a=shortlog;h=upstream Ah ok, I didn't knew that, thanks a lot for your explanation. And sorry for the noise :) -- Gerald Folcher ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c 2007-07-16 17:14 ` Gerald Folcher 2007-07-16 17:21 ` Anssi Hannula 2007-07-16 20:50 ` Dmitry Torokhov @ 2007-07-17 13:14 ` Gerald Folcher 2 siblings, 0 replies; 16+ messages in thread From: Gerald Folcher @ 2007-07-17 13:14 UTC (permalink / raw) To: linux-input Gerald Folcher wrote: <snip> > 0x651, which is the id of the Rumble version <snip> > While the id of my wheel (Force Feedback) is: 0x654 (and according to > the aforementioned MS-Windows registry there is also an id 0x652 for a > Thrustmaster wheel with the same name). Btw, just to correct myself (of course Anssi and Dmitry understood what I meant), since these messages are archived and for correctness sake: I forgot the 'b's in the ids I mentionned, so they are in fact respectively 0xb651, 0xb654, and 0xb652. Phew, now I feel better. (Sorry for the noise.) -- Gerald Folcher ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2007-08-22 10:30 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-07-16 13:48 Force Feedback: Thrustmaster FGT Wheel quick-and-dirty in hid-lgff.c or hid-tmff.c Gerald Folcher 2007-07-16 16:05 ` 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).