From patchwork Sat Jan 29 06:21:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 516291 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 p0T6MOr3005655 for ; Sat, 29 Jan 2011 06:22:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751176Ab1A2GWW (ORCPT ); Sat, 29 Jan 2011 01:22:22 -0500 Received: from mail-pw0-f46.google.com ([209.85.160.46]:37031 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751036Ab1A2GWW (ORCPT ); Sat, 29 Jan 2011 01:22:22 -0500 Received: by pwj3 with SMTP id 3so750974pwj.19 for ; Fri, 28 Jan 2011 22:22:22 -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=cahZhXXIwxjV3y0OSndtj2h/F0sEVQOpu/evSGEX4LM=; b=j2FlLkT+6LUsFJ9bZJALyRe7yEC9vNib0eXpP6Q3NEVSGSLvOnWT/olCZFatsaBDmN y4Gig1WgKuTUSKG2kAjKUpKvINgWHzapBpfIPilZTmuSdtAQYhtkEzkksHecVwYKjhmr hoSfiu4HPwNFYWYLnQxjiCV7D7efPz/bYekPE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=h4UMPpSo+iBsmxlMU21FbaKq0utPjNbmLOhRlmsLVAlWHicWD2JwLhkRecNIDPgNLo G12OzGHBDVx3N7Vm8yqSq44fWK6YLJa5S4EKa+Z+/R1seIA7g+U8lQW9vD29Pjd4Cppe Aq3zFF+K0Xdvd+CclqZYFGg1svJp57ayCCsqA= Received: by 10.142.204.9 with SMTP id b9mr3887422wfg.354.1296282141978; Fri, 28 Jan 2011 22:22:21 -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 q13sm24416749wfc.5.2011.01.28.22.22.20 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 28 Jan 2011 22:22:21 -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 v2] input : wacom_w8001 - report resolution to userland Date: Fri, 28 Jan 2011 22:21:47 -0800 Message-Id: <1296282107-14237-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:22:36 +0000 (UTC) diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c index 5cb8449..d9dde0d 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,15 @@ static int w8001_setup(struct w8001 *w8001) w8001->max_touch_x = touch.x; w8001->max_touch_y = touch.y; - /* scale to pen maximum */ - if (w8001->max_pen_x && w8001->max_pen_y) { - touch.x = w8001->max_pen_x; - touch.y = w8001->max_pen_y; + /* pen not supported */ + if (!w8001->max_pen_x || !w8001->max_pen_y) { + /* 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: