Maybe "touch resolution = logical size * 10 / physical size" comes to
more accurate answer then "l / (p / 10)"?  If so then really I'm just
looking for hints on how the formula was derived.  If you added a
comment in code that ABS_RX/ABS_RY are in units of 0.001 of cm and
your wanting units per meter then I think I could figure out the rest.

Thanks,
Chris

On Mon, Jan 24, 2011 at 9:49 AM, Chris Bagwell <[email protected]> wrote:
> Hi Ping,
>
> I'm trying to catch up with you in understanding... You mentioned
> elsewhere that HW is reporting physical size in terms of 0.001 of a
> cm.  Assuming thats true (what a crazy unit!), then the HID spec shows
> how to compute resolution like this:
>
> resolution in units per cm = logical_size / (physical_size * 10-3)
>
> Would you mind changing your math below to be closer to HID spec?  I
> think it will help readers understand faster if they've read HID spec
> first.  So I mean change like this:
>
> resolution in units per meter = logical_size / (physical_size * 0.1)
>
> It would be cool if HID turns out to be reporting in terms of mm
> (10^-1 or 0.1 of cm).  Then it reduces to:
>
> resolution in units per meter = logical_size / physical_size
>
> I have one more comment below.
>
> On Mon, Jan 24, 2011 at 1:39 AM, Ping Cheng <[email protected]> wrote:
>> resolution = logical size / physical size
>>
>> The touch physical size we get from the kernel is in thousandth cm.
>> The resolution unit we need to report to XInput is in point/m. So,
>>
>> touch resolution = logical size * 10 / physical size
>>
>> Signed-off-by: Ping Cheng <[email protected]>
>> ---
>>  src/wcmUSB.c |   24 ++++++++++--------------
>>  1 files changed, 10 insertions(+), 14 deletions(-)
>>
>> diff --git a/src/wcmUSB.c b/src/wcmUSB.c
>> index cfaf920..d8e8312 100644
>> --- a/src/wcmUSB.c
>> +++ b/src/wcmUSB.c
>> @@ -483,33 +483,29 @@ int usbWcmGetRanges(InputInfoPtr pInfo)
>>                common->wcmMaxTouchY = absinfo.maximum;
>>
>>        /* max finger strip X for tablets with Expresskeys
>> -        * or touch physical X for TabletPCs with touch */
>> +        * or physical X for touch device in thousandth cm */
>>        if (ioctl(pInfo->fd, EVIOCGABS(ABS_RX), &absinfo) == 0)
>>        {
>> -               if (is_touch)
>> -                       common->wcmTouchResolX = absinfo.maximum;
>> +               if (is_touch && !common->wcmTouchResolX)
>> +                       common->wcmTouchResolX =
>> +                               (int)(((double)common->wcmMaxTouchX * 10.0
>> +                                / (double)absinfo.maximum) + 0.5);
>
> This gives preference to the lookup table instead of hardware.  Maybe
> we should give preference to HW reported value (and fall back to
> table)?
>
>  +               if (is_touch && absinfo.maximum)
>
> It doesn't really matter much since this is code that will not be used
> with any new HW.
>
> Chris
>
>>                else
>>                        common->wcmMaxStripX = absinfo.maximum;
>>        }
>>
>>        /* max finger strip Y for tablets with Expresskeys
>> -        * or touch physical Y for TabletPCs with touch */
>> +        * or physical Y for touch device in thousandth cm */
>>        if (ioctl(pInfo->fd, EVIOCGABS(ABS_RY), &absinfo) == 0)
>>        {
>> -               if (is_touch)
>> -                       common->wcmTouchResolY = absinfo.maximum;
>> +               if (is_touch && !common->wcmTouchResolY)
>> +                       common->wcmTouchResolY =
>> +                                (int)(((double)common->wcmMaxTouchY * 10.0
>> +                                / (double)absinfo.maximum) + 0.5);
>>                else
>>                        common->wcmMaxStripY = absinfo.maximum;
>>        }
>>
>> -       if (is_touch && common->wcmTouchResolX && common->wcmMaxTouchX)
>> -       {
>> -               common->wcmTouchResolX = 
>> (int)(((double)common->wcmTouchResolX)
>> -                        / ((double)common->wcmMaxTouchX) + 0.5);
>> -               common->wcmTouchResolY = 
>> (int)(((double)common->wcmTouchResolY)
>> -                        / ((double)common->wcmMaxTouchY) + 0.5);
>> -       }
>> -
>>        /* max z cannot be configured */
>>        if (ioctl(pInfo->fd, EVIOCGABS(ABS_PRESSURE), &absinfo) == 0)
>>                common->wcmMaxZ = absinfo.maximum;
>> --
>> 1.7.3.4
>>
>>
>> ------------------------------------------------------------------------------
>> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
>> Finally, a world-class log management solution at an even better price-free!
>> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
>> February 28th, so secure your free ArcSight Logger TODAY!
>> http://p.sf.net/sfu/arcsight-sfd2d
>> _______________________________________________
>> Linuxwacom-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
>>
>

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to