linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] input: wacom: Fix physical size calculation for 3rd-gen Bamboo
@ 2012-03-12 22:53 Jason Gerecke
  2012-03-13  3:25 ` Chris Bagwell
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Gerecke @ 2012-03-12 22:53 UTC (permalink / raw)
  To: linux-input, dmitry.torokhov, chris, linuxwacom-devel; +Cc: Jason Gerecke

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] input: wacom: Fix physical size calculation for 3rd-gen Bamboo
  2012-03-12 22:53 [PATCH] input: wacom: Fix physical size calculation for 3rd-gen Bamboo Jason Gerecke
@ 2012-03-13  3:25 ` Chris Bagwell
  2012-03-13  5:21   ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Bagwell @ 2012-03-13  3:25 UTC (permalink / raw)
  To: Jason Gerecke; +Cc: linux-input, dmitry.torokhov, linuxwacom-devel

On Mon, Mar 12, 2012 at 5:53 PM, Jason Gerecke <killertofu@gmail.com> wrote:
> 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>

Reviewed-by: Chris Bagwell <chris@cnpbagwell.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
>
--
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] input: wacom: Fix physical size calculation for 3rd-gen Bamboo
  2012-03-13  3:25 ` Chris Bagwell
@ 2012-03-13  5:21   ` Dmitry Torokhov
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2012-03-13  5:21 UTC (permalink / raw)
  To: Chris Bagwell; +Cc: Jason Gerecke, linux-input, linuxwacom-devel

On Mon, Mar 12, 2012 at 10:25:47PM -0500, Chris Bagwell wrote:
> On Mon, Mar 12, 2012 at 5:53 PM, Jason Gerecke <killertofu@gmail.com> wrote:
> > 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>
> 
> Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-13  5:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-12 22:53 [PATCH] input: wacom: Fix physical size calculation for 3rd-gen Bamboo Jason Gerecke
2012-03-13  3:25 ` Chris Bagwell
2012-03-13  5:21   ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).