All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Ebke <johannes.ebke@physik.uni-muenchen.de>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Jiri Kosina <jkosina@suse.cz>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>
Subject: Re: Linux Force Feedback for Saitek Cyborg Evo Force
Date: Wed, 30 Dec 2009 10:01:01 +0100	[thread overview]
Message-ID: <4B3B16CD.1050700@physik.uni-muenchen.de> (raw)
In-Reply-To: <20091230032326.GC7049@core.coreip.homeip.net>

[-- Attachment #1: Type: text/plain, Size: 3096 bytes --]

Dmitry Torokhov wrote:
> On Tue, Dec 29, 2009 at 02:40:21PM -0800, Dmitry Torokhov wrote:
>>  Dec 29, 2009, at 4:46 AM, Johannes Ebke
>> <johannes.ebke@physik.uni-muenchen.de> wrote:
>>
>>> Dmitry Torokhov wrote:
>>>> On Sun, Dec 20, 2009 at 11:44:19PM -0800, Dmitry Torokhov wrote:
>>>>> On Sun, Dec 20, 2009 at 12:36:23AM +0100, Johannes Ebke wrote:
>>>>>> Hi,
>>>>>>
>>>>>> It seems that the force feedback works well, I have ported
>>>>>> the force
>>>>>> feedback for my favorite game to linux now, and it works well.
>>>>>>
>>>>>> What does not work is updating effects - there just nothing
>>>>>> happens, and
>>>>>> the old event is played. I have circumvented this by
>>>>>> deleting/re-uploading the effect, but this should probably
>>>>>> been made to
>>>>>> work. Does it work well with other hardware?
>>>>>>
>>>>>> Thirdly, I have re-discovered one kernel oops that occurs if the
>>>>>> joystick is unplugged if some process still has the event
>>>>>> device open.
>>>>>> Steps to reproduce:
>>>>>> * plug joystick in
>>>>>> * fftest /dev/input/eventXX
>>>>>> * unplug joystick
>>>>>>
>>>>>> (kern.log extract attached)
>>>>>>
>>>>>> Sometimes this just gives an oops, sometimes it escalates
>>>>>> into a kernel
>>>>>> panic.
>>>>>>
>>>>> Hmm, it looks like iforce unbinding is completely busted:
>>>>>
>>>>> static void iforce_usb_disconnect(struct usb_interface *intf)
>>>>> {
>>>>>       struct iforce *iforce = usb_get_intfdata(intf);
>>>>>       int open = 0; /* FIXME! iforce->dev.handle->open; */
>>>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>>>
>>>>>       usb_set_intfdata(intf, NULL);
>>>>>       if (iforce) {
>>>>>               iforce->usbdev = NULL;
>>>>>               input_unregister_device(iforce->dev);
>>>>>
>>>>>               if (!open) {
>>>>>                       iforce_delete_device(iforce);
>>>>>                       kfree(iforce);
>>>>>               }
>>>>>       }
>>>>> }
>>>>>
>>>>>
>>>>> Any chance you could fix that FIXME ;) ?
>>>>>
>>>> Actually, does the below fixes it for you?
>>>>
>>> This fixes the kernel oops - thanks! However it also disables FF,
>>> unless
>>> I remove "usb_kill_urb(iforce->out);" from iforce_close.
>> >From some debug statements I found that iforce_close is called
>>> twice if
>>> you just plug in the joystick, so the effect is immediate.
>> I still believe that usb_kill_urb is needed however we need to wait
>> for packet disabling FF to complete.
>>
> 
> Does the patch below (on top of the unmodofied previous one) fixes the
> issue for you?
> 
> Thanks.
> 

This fixes it completely, both the FF and the clean shutdown on
unexpected disconnect! Thank you very much!

Finally, for correct orientation of the rudder axis, I have attached one
small change to packets - this makes it work for me if i remove the old
configuration.

One other question: Since the USB HID driver can actually discover the
joystick buttons and axis ranges sucessfully, would it not be easier to
use that for generic input and only add force-feedback in iforce, or is
that just too much overhead? Thanks!

Cheers,
Johannes


[-- Attachment #2: flipRx.patch --]
[-- Type: text/x-patch, Size: 882 bytes --]

Input: iforce - flip initial RUDDER orientation to correct one

Remove the inversion from the data acqisition routine

Signed-off-by: Johannes Ebke <johannes.ebke@physik.uni-muenchen.de>
---

diff -ru drivers/input/joystick/iforce_dmitry/iforce-packets.c drivers/input/joystick/iforce/iforce-packets.c
--- drivers/input/joystick/iforce_dmitry/iforce-packets.c	2009-12-30 09:42:22.000000000 +0100
+++ drivers/input/joystick/iforce/iforce-packets.c	2009-12-30 09:32:34.000000000 +0100
@@ -193,7 +193,7 @@
 				if (HI(cmd) == 6) {
 					input_report_abs(dev, ABS_THROTTLE, data[4]);
 					if (LO(cmd) >= 8 && test_bit(ABS_RUDDER ,dev->absbit))
-						input_report_abs(dev, ABS_RUDDER, 255 - data[7]);
+						input_report_abs(dev, ABS_RUDDER, data[7]);
 				} else {
 					input_report_abs(dev, ABS_THROTTLE, 255 - data[4]);
 					if (LO(cmd) >= 8 && test_bit(ABS_RUDDER ,dev->absbit))

  reply	other threads:[~2009-12-30  9:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4B26B824.8010403@physik.uni-muenchen.de>
2009-12-15 13:07 ` Linux Force Feedback for Saitek Cyborg Evo Force Jiri Kosina
2009-12-17 23:18   ` Johannes Ebke
2009-12-18  8:59     ` Johannes Ebke
2009-12-18 10:52     ` Jiri Kosina
2009-12-18 17:50       ` Dmitry Torokhov
2009-12-19 23:36         ` Johannes Ebke
2009-12-21  0:22           ` Melchior FRANZ
2009-12-21  7:44           ` Dmitry Torokhov
2009-12-21  7:59             ` Dmitry Torokhov
2009-12-21  8:22             ` Dmitry Torokhov
2009-12-29 12:46               ` Johannes Ebke
2009-12-29 22:40                 ` Dmitry Torokhov
2009-12-30  3:23                   ` Dmitry Torokhov
2009-12-30  9:01                     ` Johannes Ebke [this message]
2009-12-30 10:47                       ` Dmitry Torokhov
2009-12-30 11:32                         ` Johannes Ebke
2011-06-08 18:51                           ` Richie Ward
2009-12-21 11:45             ` [PATCH] " Johannes Ebke
2009-12-21  0:24 Melchior FRANZ

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=4B3B16CD.1050700@physik.uni-muenchen.de \
    --to=johannes.ebke@physik.uni-muenchen.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    /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.