* [PATCH 2/2] input: wacom - Pass touch resolution to clients through input_absinfo
@ 2011-01-23 23:26 Ping Cheng
2011-01-24 14:40 ` [2/2] " Henrik Rydberg
0 siblings, 1 reply; 5+ messages in thread
From: Ping Cheng @ 2011-01-23 23:26 UTC (permalink / raw)
To: linux-input; +Cc: dmitry.torokhov, Ping Cheng, Ping Cheng
Fixed the workaround used for kernels older than 2.6.35.
Signed-off-by: Ping Cheng <pingc@wacom.com>
---
drivers/input/tablet/wacom_wac.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index f44c822..497d0ba 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1105,7 +1105,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
struct wacom_wac *wacom_wac)
{
struct wacom_features *features = &wacom_wac->features;
- int i;
+ int i, res;
input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
@@ -1228,8 +1228,13 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
case TABLETPC:
if (features->device_type == BTN_TOOL_DOUBLETAP ||
features->device_type == BTN_TOOL_TRIPLETAP) {
- input_set_abs_params(input_dev, ABS_RX, 0, features->x_phy, 0, 0);
- input_set_abs_params(input_dev, ABS_RY, 0, features->y_phy, 0, 0);
+ /* set touch resolution in points/mm */
+ res = features->x_phy/100;
+ input_abs_set_res(input_dev, ABS_X,
+ features->x_max/res);
+ res = features->y_phy/100;
+ input_abs_set_res(input_dev, ABS_Y,
+ features->y_max/res);
__set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
}
@@ -1272,6 +1277,13 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
input_set_abs_params(input_dev, ABS_MT_PRESSURE,
0, features->pressure_max,
features->pressure_fuzz, 0);
+ /* set touch resolution in points/mm */
+ res = features->x_phy/100;
+ input_abs_set_res(input_dev, ABS_X,
+ features->x_max/res);
+ res = features->y_phy/100;
+ input_abs_set_res(input_dev, ABS_Y,
+ features->y_max/res);
} else if (features->device_type == BTN_TOOL_PEN) {
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
__set_bit(BTN_TOOL_PEN, input_dev->keybit);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [2/2] input: wacom - Pass touch resolution to clients through input_absinfo
2011-01-23 23:26 [PATCH 2/2] input: wacom - Pass touch resolution to clients through input_absinfo Ping Cheng
@ 2011-01-24 14:40 ` Henrik Rydberg
2011-01-24 18:18 ` Ping Cheng
0 siblings, 1 reply; 5+ messages in thread
From: Henrik Rydberg @ 2011-01-24 14:40 UTC (permalink / raw)
To: Ping Cheng; +Cc: linux-input, dmitry.torokhov, Ping Cheng
Hi Ping,
> @@ -1228,8 +1228,13 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
> case TABLETPC:
> if (features->device_type == BTN_TOOL_DOUBLETAP ||
> features->device_type == BTN_TOOL_TRIPLETAP) {
> - input_set_abs_params(input_dev, ABS_RX, 0, features->x_phy, 0, 0);
> - input_set_abs_params(input_dev, ABS_RY, 0, features->y_phy, 0, 0);
> + /* set touch resolution in points/mm */
> + res = features->x_phy/100;
> + input_abs_set_res(input_dev, ABS_X,
> + features->x_max/res);
It seems to me the construction above looses precision twice for no
apparent reason. How about instead use "100 * features->x_max /
features->x_phy"? Besides, it is a bit unfortunate that "res" is short
for both result and resolution. Finally, are the physical dimensions
actually presented in 100ths of millimeters?
Thanks,
Henrik
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [2/2] input: wacom - Pass touch resolution to clients through input_absinfo
2011-01-24 14:40 ` [2/2] " Henrik Rydberg
@ 2011-01-24 18:18 ` Ping Cheng
2011-01-24 18:36 ` Dmitry Torokhov
0 siblings, 1 reply; 5+ messages in thread
From: Ping Cheng @ 2011-01-24 18:18 UTC (permalink / raw)
To: Henrik Rydberg; +Cc: linux-input, dmitry.torokhov, Ping Cheng
On Mon, Jan 24, 2011 at 6:40 AM, Henrik Rydberg <rydberg@euromail.se> wrote:
> Hi Ping,
>
>> @@ -1228,8 +1228,13 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
>> case TABLETPC:
>> if (features->device_type == BTN_TOOL_DOUBLETAP ||
>> features->device_type == BTN_TOOL_TRIPLETAP) {
>> - input_set_abs_params(input_dev, ABS_RX, 0, features->x_phy, 0, 0);
>> - input_set_abs_params(input_dev, ABS_RY, 0, features->y_phy, 0, 0);
>> + /* set touch resolution in points/mm */
>> + res = features->x_phy/100;
>> + input_abs_set_res(input_dev, ABS_X,
>> + features->x_max/res);
>
> It seems to me the construction above looses precision twice for no
> apparent reason.
Well, there was a reason (logically instead of mathematically though):
features->x_phy/100 gives us the physical size of the touch area in
mm.
> How about instead use "100 * features->x_max /
> features->x_phy"?
Sure.
> Besides, it is a bit unfortunate that "res" is short
> for both result and resolution.
Resolution is defined as __s32 in input_absinfo. How about we use __s32 then?
> Finally, are the physical dimensions
> actually presented in 100ths of millimeters?
Well, the protocol says it is in thousandth of a centimeter. So, 100th
of a mm is right too.
Thank you for the comments.
Ping
--
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] 5+ messages in thread
* Re: [2/2] input: wacom - Pass touch resolution to clients through input_absinfo
2011-01-24 18:18 ` Ping Cheng
@ 2011-01-24 18:36 ` Dmitry Torokhov
2011-01-24 20:09 ` Ping Cheng
0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2011-01-24 18:36 UTC (permalink / raw)
To: Ping Cheng; +Cc: Henrik Rydberg, linux-input, Ping Cheng
On Mon, Jan 24, 2011 at 10:18:54AM -0800, Ping Cheng wrote:
> On Mon, Jan 24, 2011 at 6:40 AM, Henrik Rydberg <rydberg@euromail.se> wrote:
> > Hi Ping,
> >
> >> @@ -1228,8 +1228,13 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
> >> case TABLETPC:
> >> if (features->device_type == BTN_TOOL_DOUBLETAP ||
> >> features->device_type == BTN_TOOL_TRIPLETAP) {
> >> - input_set_abs_params(input_dev, ABS_RX, 0, features->x_phy, 0, 0);
> >> - input_set_abs_params(input_dev, ABS_RY, 0, features->y_phy, 0, 0);
> >> + /* set touch resolution in points/mm */
> >> + res = features->x_phy/100;
> >> + input_abs_set_res(input_dev, ABS_X,
> >> + features->x_max/res);
> >
> > It seems to me the construction above looses precision twice for no
> > apparent reason.
>
> Well, there was a reason (logically instead of mathematically though):
> features->x_phy/100 gives us the physical size of the touch area in
> mm.
>
> > How about instead use "100 * features->x_max /
> > features->x_phy"?
>
> Sure.
>
> > Besides, it is a bit unfortunate that "res" is short
> > for both result and resolution.
>
> Resolution is defined as __s32 in input_absinfo. How about we use __s32 then?
input_abs_set_res() takes and int argument so keep it int (or just
embed the expression into the call and forgo 'res').
--
Dmitry
--
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] 5+ messages in thread
* Re: [2/2] input: wacom - Pass touch resolution to clients through input_absinfo
2011-01-24 18:36 ` Dmitry Torokhov
@ 2011-01-24 20:09 ` Ping Cheng
0 siblings, 0 replies; 5+ messages in thread
From: Ping Cheng @ 2011-01-24 20:09 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Henrik Rydberg, linux-input
On Mon, Jan 24, 2011 at 10:36 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Mon, Jan 24, 2011 at 10:18:54AM -0800, Ping Cheng wrote:
>> On Mon, Jan 24, 2011 at 6:40 AM, Henrik Rydberg <rydberg@euromail.se> wrote:
>> > Hi Ping,
>> >
>> >> @@ -1228,8 +1228,13 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
>> >> case TABLETPC:
>> >> if (features->device_type == BTN_TOOL_DOUBLETAP ||
>> >> features->device_type == BTN_TOOL_TRIPLETAP) {
>> >> - input_set_abs_params(input_dev, ABS_RX, 0, features->x_phy, 0, 0);
>> >> - input_set_abs_params(input_dev, ABS_RY, 0, features->y_phy, 0, 0);
>> >> + /* set touch resolution in points/mm */
>> >> + res = features->x_phy/100;
>> >> + input_abs_set_res(input_dev, ABS_X,
>> >> + features->x_max/res);
>> >
>> > It seems to me the construction above looses precision twice for no
>> > apparent reason.
>>
>> Well, there was a reason (logically instead of mathematically though):
>> features->x_phy/100 gives us the physical size of the touch area in
>> mm.
>>
>> > How about instead use "100 * features->x_max /
>> > features->x_phy"?
>>
>> Sure.
>>
>> > Besides, it is a bit unfortunate that "res" is short
>> > for both result and resolution.
>>
>> Resolution is defined as __s32 in input_absinfo. How about we use __s32 then?
>
> input_abs_set_res() takes and int argument so keep it int (or just
> embed the expression into the call and forgo 'res').
I added 'res' to avoid confusion hence questions about the formula. I
am still questioned ;).
I'll forgo 'res' in v2. Thank you for the suggestions.
Ping
--
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] 5+ messages in thread
end of thread, other threads:[~2011-01-24 20:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-23 23:26 [PATCH 2/2] input: wacom - Pass touch resolution to clients through input_absinfo Ping Cheng
2011-01-24 14:40 ` [2/2] " Henrik Rydberg
2011-01-24 18:18 ` Ping Cheng
2011-01-24 18:36 ` Dmitry Torokhov
2011-01-24 20:09 ` Ping Cheng
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.