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); 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
