From patchwork Sat Jan 29 06:37:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 516301 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0T6cLlU007604 for ; Sat, 29 Jan 2011 06:38:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751596Ab1A2GiS (ORCPT ); Sat, 29 Jan 2011 01:38:18 -0500 Received: from mail-iy0-f174.google.com ([209.85.210.174]:49242 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751135Ab1A2GiR (ORCPT ); Sat, 29 Jan 2011 01:38:17 -0500 Received: by iyj18 with SMTP id 18so3257200iyj.19 for ; Fri, 28 Jan 2011 22:38:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=nRYkyJ3wivEapBxWIXUe2ylwCEtUKBvAicH10Kbcs0c=; b=PQsFX0fB6f7RNLa3MLs+VQDOZ6Xcpp4QtG8AToU9Zgz6HofZaS3/HQM9gNA2eQWaqa v3gH2WtzwdPSzb5JWSbrQxWPjk4SJVbWlpS7USc5azkv3uNdDFXz9MREonT+ZYEfMPAX s1jsd7s1W8r5cq0NFGVU5ErNqu0JJiP7OOYgE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=lWHnqIYs+uBEY7RSxYx6bLLambEPA8HmdiHFTg2HadV5GSbBXhJMVAw3A17mybyczq B6a3WwhxaDtPF+vHxJYTdWmd4bgfcWMa1YEhr3iGnk1KrgcQD71VlRrWcz5Lk8jhW6u4 +nvM+s7JhGW3y/yzeqIddKpXlKxWDaWp+ysnA= Received: by 10.42.228.73 with SMTP id jd9mr3361154icb.38.1296283096920; Fri, 28 Jan 2011 22:38:16 -0800 (PST) Received: from localhost.localdomain (c-71-193-252-72.hsd1.wa.comcast.net [71.193.252.72]) by mx.google.com with ESMTPS id k38sm13940188ick.9.2011.01.28.22.38.14 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 28 Jan 2011 22:38:16 -0800 (PST) From: Ping Cheng To: linux-input@vger.kernel.org Cc: dmitry.torokhov@gmail.com, rydberg@euromail.se, Ping Cheng , Ping Cheng Subject: [PATCH v3] input : wacom_w8001 - report resolution to userland Date: Fri, 28 Jan 2011 22:37:42 -0800 Message-Id: <1296283062-20469-1-git-send-email-pinglinux@gmail.com> X-Mailer: git-send-email 1.7.3.5 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 29 Jan 2011 06:38:22 +0000 (UTC) diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c index 5cb8449..68dcca0 100644 --- a/drivers/input/touchscreen/wacom_w8001.c +++ b/drivers/input/touchscreen/wacom_w8001.c @@ -51,6 +51,10 @@ MODULE_LICENSE("GPL"); #define W8001_PKTLEN_TPCCTL 11 /* control packet */ #define W8001_PKTLEN_TOUCH2FG 13 +/* resolution in points/mm */ +#define W8001_PEN_RESOLUTION 100 +#define W8001_TOUCH_RESOLUTION 10 + struct w8001_coord { u8 rdy; u8 tsw; @@ -198,7 +202,7 @@ static void parse_touchquery(u8 *data, struct w8001_touch_query *query) query->y = 1024; if (query->panel_res) query->x = query->y = (1 << query->panel_res); - query->panel_res = 10; + query->panel_res = W8001_TOUCH_RESOLUTION; } } @@ -394,6 +398,8 @@ static int w8001_setup(struct w8001 *w8001) input_set_abs_params(dev, ABS_X, 0, coord.x, 0, 0); input_set_abs_params(dev, ABS_Y, 0, coord.y, 0, 0); + input_abs_set_res(dev, ABS_X, W8001_PEN_RESOLUTION); + input_abs_set_res(dev, ABS_Y, W8001_PEN_RESOLUTION); input_set_abs_params(dev, ABS_PRESSURE, 0, coord.pen_pressure, 0, 0); if (coord.tilt_x && coord.tilt_y) { input_set_abs_params(dev, ABS_TILT_X, 0, coord.tilt_x, 0, 0); @@ -418,15 +424,19 @@ static int w8001_setup(struct w8001 *w8001) w8001->max_touch_x = touch.x; w8001->max_touch_y = touch.y; - /* scale to pen maximum */ + /* pen supported */ if (w8001->max_pen_x && w8001->max_pen_y) { + /* scale to pen maximum */ touch.x = w8001->max_pen_x; touch.y = w8001->max_pen_y; + } else { /* touch only */ + /* set axes with touch data */ + input_set_abs_params(dev, ABS_X, 0, touch.x, 0, 0); + input_set_abs_params(dev, ABS_Y, 0, touch.y, 0, 0); + input_abs_set_res(dev, ABS_X, touch.panel_res); + input_abs_set_res(dev, ABS_Y, touch.panel_res); } - input_set_abs_params(dev, ABS_X, 0, touch.x, 0, 0); - input_set_abs_params(dev, ABS_Y, 0, touch.y, 0, 0); - switch (touch.sensor_id) { case 0: case 2: