From: Anssi Hannula <anssi.hannula@iki.fi>
To: ext-jari.vanhala@nokia.com
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>
Subject: Re: [PATCH] Input: Add direction to ff-memless
Date: Wed, 09 Dec 2009 03:15:22 +0200 [thread overview]
Message-ID: <4B1EFA2A.6000403@iki.fi> (raw)
In-Reply-To: <1260263284.19783.1758.camel@tema>
Jari Vanhala wrote:
> On Mon, 2009-12-07 at 22:16 +0100, ext Anssi Hannula wrote:
>> Jari Vanhala wrote:
>>> +static unsigned int ml_calculate_direction(
>>> + unsigned int direction, unsigned int force,
>>> + unsigned int new_direction, unsigned int new_force)
>>> +{
>>> + return ((u32)direction * force + new_direction * new_force) /
>>> + (force + new_force);
>>> +}
>> What if direction is 0xf000 and new_direction is 0x1000? The correct
>> behaviour would be to use direction 0x0000 or so, but this code would
>> return 0x8000 (assuming equal forces).
>
> I know it's not perfect, but it's simple and gives good enough result.
> And I just need to know which side of 0x8000 it is.
Ah, I assumed the motor directions (forward, reverse) were mapped to
up/down (180/0), not left/right.
Your way seems somewhat counter-intuitive, but it indeed makes
ml_calculate_direction() simpler :) And as there are no other rumble
drivers using the direction field, I guess the wrong results do not
matter, then.
I think a comment should be added in ml_calculate_direction(), anyway,
to make it clear that it only works correctly with motors with
left/right directions only.
--
Anssi Hannula
next prev parent reply other threads:[~2009-12-09 1:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-04 13:05 [PATCH] Input: Add direction to ff-memless Jari Vanhala
2009-12-04 13:05 ` [PATCH] Input: Force Feedback core memory leak Jari Vanhala
2009-12-07 6:26 ` Dmitry Torokhov
2009-12-07 21:16 ` [PATCH] Input: Add direction to ff-memless Anssi Hannula
2009-12-08 9:08 ` Jari Vanhala
2009-12-09 1:15 ` Anssi Hannula [this message]
2009-12-23 12:58 ` [PATCH v2] " Jari Vanhala
2009-12-24 23:37 ` Anssi Hannula
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=4B1EFA2A.6000403@iki.fi \
--to=anssi.hannula@iki.fi \
--cc=dmitry.torokhov@gmail.com \
--cc=ext-jari.vanhala@nokia.com \
--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.