diff mbox

HID: wiimote: fix weight conversion error for values > 17kg

Message ID alpine.DEB.2.02.1209172114000.3968@butterbrot (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Florian Echtler Sept. 17, 2012, 7:15 p.m. UTC
Signed-Off-By: Florian Echtler <floe@butterbrot.org>
---
  drivers/hid/hid-wiimote-ext.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

Comments

David Herrmann Sept. 17, 2012, 9:08 p.m. UTC | #1
On Mon, Sep 17, 2012 at 9:15 PM, Florian Echtler <floe@butterbrot.org> wrote:
> Signed-Off-By: Florian Echtler <floe@butterbrot.org>
> ---
>  drivers/hid/hid-wiimote-ext.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-wiimote-ext.c b/drivers/hid/hid-wiimote-ext.c
> index fc98cc9..bc85bf2 100644
> --- a/drivers/hid/hid-wiimote-ext.c
> +++ b/drivers/hid/hid-wiimote-ext.c
> @@ -585,7 +585,8 @@ static void handler_balance_board(struct wiimote_ext
> *ext, const __u8 *payload)
>                 } else {
>                         tmp = val[i] - ext->calib[i][1];
>                         tmp *= 1700;
> -                       tmp /= ext->calib[i][2] - ext->calib[i][1] + 1700;
> +                       tmp /= ext->calib[i][2] - ext->calib[i][1];
> +                       tmp += 1700;

That's the reason why I split up your extra long line from the
original :P I should have checked it again. Thanks for the fix. I've
compared it with the original and I messed it up during conversion.
Sorry.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>

Thanks Jiri for applying them.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Kosina Sept. 18, 2012, 9:38 a.m. UTC | #2
On Mon, 17 Sep 2012, Florian Echtler wrote:

> Signed-Off-By: Florian Echtler <floe@butterbrot.org>
> ---
>  drivers/hid/hid-wiimote-ext.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-wiimote-ext.c b/drivers/hid/hid-wiimote-ext.c
> index fc98cc9..bc85bf2 100644
> --- a/drivers/hid/hid-wiimote-ext.c
> +++ b/drivers/hid/hid-wiimote-ext.c
> @@ -585,7 +585,8 @@ static void handler_balance_board(struct wiimote_ext *ext,
> const __u8 *payload)
>  		} else {
>  			tmp = val[i] - ext->calib[i][1];
>  			tmp *= 1700;
> -			tmp /= ext->calib[i][2] - ext->calib[i][1] + 1700;
> +			tmp /= ext->calib[i][2] - ext->calib[i][1];
> +			tmp += 1700;
>  		}
>  		val[i] = tmp;
>  	}

I am not sure how you managed to do it :) but there are stray whitespaces 
in the patch context.

I have fixed it manually and applied, but please keep fixing that in mind 
for any future submissions.

Thanks,
Florian Echtler Sept. 18, 2012, 10:53 a.m. UTC | #3
Thanks Jiri, and sorry for the noise :-)

On 18.09.2012 11:38, Jiri Kosina wrote:
> On Mon, 17 Sep 2012, Florian Echtler wrote:
>
>> Signed-Off-By: Florian Echtler <floe@butterbrot.org>
>> ---
>>   drivers/hid/hid-wiimote-ext.c |    3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/hid/hid-wiimote-ext.c b/drivers/hid/hid-wiimote-ext.c
>> index fc98cc9..bc85bf2 100644
>> --- a/drivers/hid/hid-wiimote-ext.c
>> +++ b/drivers/hid/hid-wiimote-ext.c
>> @@ -585,7 +585,8 @@ static void handler_balance_board(struct wiimote_ext *ext,
>> const __u8 *payload)
>>   		} else {
>>   			tmp = val[i] - ext->calib[i][1];
>>   			tmp *= 1700;
>> -			tmp /= ext->calib[i][2] - ext->calib[i][1] + 1700;
>> +			tmp /= ext->calib[i][2] - ext->calib[i][1];
>> +			tmp += 1700;
>>   		}
>>   		val[i] = tmp;
>>   	}
>
> I am not sure how you managed to do it :) but there are stray whitespaces
> in the patch context.
>
> I have fixed it manually and applied, but please keep fixing that in mind
> for any future submissions.
>
> Thanks,
>
diff mbox

Patch

diff --git a/drivers/hid/hid-wiimote-ext.c b/drivers/hid/hid-wiimote-ext.c
index fc98cc9..bc85bf2 100644
--- a/drivers/hid/hid-wiimote-ext.c
+++ b/drivers/hid/hid-wiimote-ext.c
@@ -585,7 +585,8 @@  static void handler_balance_board(struct wiimote_ext *ext, const __u8 *payload)
  		} else {
  			tmp = val[i] - ext->calib[i][1];
  			tmp *= 1700;
-			tmp /= ext->calib[i][2] - ext->calib[i][1] + 1700;
+			tmp /= ext->calib[i][2] - ext->calib[i][1];
+			tmp += 1700;
  		}
  		val[i] = tmp;
  	}