Skip to contentSkip to conversation

input: wacom: Fix physical size calculation for 3rd-gen Bamboo

PATCH Applied Jason Gerecke 3 participants 3 messages Mar 12, 2012 – Mar 13, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 input: wacom: Fix physical size calculation for 3rd-gen Bamboo

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.

---
 drivers/input/tablet/wacom_sys.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/input/tablet/wacom_sys.c +2 -2
index c9588ee..dc07821 100644
@@ -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]);
Signature · 1 line
1.7.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · 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.

Quoted 18 lines

---
 drivers/input/tablet/wacom_sys.c |    4 ++--

 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/input/tablet/wacom_sys.c +0 -0
index c9588ee..dc07821 100644
@@ -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;

Quoted 5 lines

               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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer Applied
#2 lore raw
Quoted 5 lines · Chris Bagwell
Quoted 4 lines · Jason Gerecke

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

Quoted 8 lines
Quoted 6 lines

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.

Applied, thank you.

Signature · 1 line
Dmitry