HID: wiimote: fix weight conversion error for values > 17kg
authorFlorian Echtler <floe@butterbrot.org>
Mon, 17 Sep 2012 19:15:40 +0000 (21:15 +0200)
committerJiri Kosina <jkosina@suse.cz>
Tue, 18 Sep 2012 09:37:14 +0000 (11:37 +0200)
Signed-off-by: Florian Echtler <floe@butterbrot.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-wiimote-ext.c

index fc98cc9ed429515148ef9d825a2ad93d370b7405..bc85bf29062ea50c735a674b761ce688a5df0412 100644 (file)
@@ -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;
        }