All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gerecke <killertofu@gmail.com>
To: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com,
	chris@cnpbagwell.com, linuxwacom-devel@lists.sourceforge.net
Cc: Jason Gerecke <killertofu@gmail.com>
Subject: [PATCH] input: wacom: Fix physical size calculation for 3rd-gen Bamboo
Date: Mon, 12 Mar 2012 15:53:04 -0700	[thread overview]
Message-ID: <1331592784-6894-1-git-send-email-killertofu@gmail.com> (raw)

This calculation determines the physical dimensions of the tablet,
used later on in calculate_touch_res to obtain the touch sensor
resolution.

Instead of dividing the logical size by the resolution, the current
code performs a multiplication. This doesn't pose a problem for the
3rd-gen Bamboo since the resolution and scale factor happen to be
identical, but will produce an incorrect result for other cases.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
---
 drivers/input/tablet/wacom_sys.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index c9588ee..dc07821 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -184,9 +184,9 @@ static int wacom_parse_logical_collection(unsigned char *report,
 		 * data before its overwritten.
 		 */
 		features->x_phy =
-			(features->x_max * features->x_resolution) / 100;
+			(features->x_max * 100) / features->x_resolution;
 		features->y_phy =
-			(features->y_max * features->y_resolution) / 100;
+			(features->y_max * 100) / features->y_resolution;
 
 		features->x_max = features->y_max =
 			get_unaligned_le16(&report[10]);
-- 
1.7.9.1


             reply	other threads:[~2012-03-12 22:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-12 22:53 Jason Gerecke [this message]
2012-03-13  3:25 ` [PATCH] input: wacom: Fix physical size calculation for 3rd-gen Bamboo Chris Bagwell
2012-03-13  5:21   ` Dmitry Torokhov

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=1331592784-6894-1-git-send-email-killertofu@gmail.com \
    --to=killertofu@gmail.com \
    --cc=chris@cnpbagwell.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linuxwacom-devel@lists.sourceforge.net \
    /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.