From patchwork Tue Jan 25 18:31:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 506611 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 p0PIVnjr032387 for ; Tue, 25 Jan 2011 18:31:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751698Ab1AYSbs (ORCPT ); Tue, 25 Jan 2011 13:31:48 -0500 Received: from mail-iw0-f174.google.com ([209.85.214.174]:33498 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751508Ab1AYSbs (ORCPT ); Tue, 25 Jan 2011 13:31:48 -0500 Received: by iwn9 with SMTP id 9so70191iwn.19 for ; Tue, 25 Jan 2011 10:31:47 -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=4Y55XEPqM9YYiZL4JztXN6uLLUlTH1PZNGe99BcYzCY=; b=RJJRMq1cH9FHfVeyptlYTLDg3gQdG5q+mSLMkrchFJ7Y5slTQc/l0LIrsLONndypJE +saTIwBhHj50d6hErRc7PoUWVTjlEwxm+/atV0upSVpfsMiv0JlOQ/BT14na2jHT3XTk BN7ZTmqsqrmgS+UoH/BzHucx9PyjW4Db38cHg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=wTbsQAoponEEeb97wlBlr8EhG9TnKtJhLE0Uj6/xRfIuuiGpQqj3yA4Tjeou9PFodQ F3Qf9eEZPb9wkVaWE1/5CisTqJlgV9E3YKQkPLmI3PwQHBEwt4EqOlnYXbH9n62jSnbW /3bweyp9+0UEgE7mDKF45T3+DdtHtN+FyELDo= Received: by 10.231.171.197 with SMTP id i5mr7043548ibz.54.1295980307454; Tue, 25 Jan 2011 10:31:47 -0800 (PST) Received: from localhost.localdomain ([204.119.25.150]) by mx.google.com with ESMTPS id 8sm12157027iba.10.2011.01.25.10.31.45 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 25 Jan 2011 10:31:46 -0800 (PST) From: Ping Cheng To: linux-input@vger.kernel.org Cc: dmitry.torokhov@gmail.com, Ping Cheng , Ping Cheng Subject: [PATCH v3] input: wacom - Pass touch resolution to clients through input_absinfo Date: Tue, 25 Jan 2011 10:31:19 -0800 Message-Id: <1295980279-5610-1-git-send-email-pinglinux@gmail.com> X-Mailer: git-send-email 1.7.3.4 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]); Tue, 25 Jan 2011 18:31:49 +0000 (UTC) diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index f44c822..57bac83 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c @@ -1101,6 +1101,15 @@ void wacom_setup_device_quirks(struct wacom_features *features) } } +static int wacom_touch_resolution(struct wacom_features *features, int axe) +{ + /* touch physical size is in hundredths of a mm */ + if (!axe) + return (100 * features->x_max / features->x_phy); + else + return (100 * features->y_max / features->y_phy); +} + void wacom_setup_input_capabilities(struct input_dev *input_dev, struct wacom_wac *wacom_wac) { @@ -1228,8 +1237,11 @@ 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 */ + input_abs_set_res(input_dev, ABS_X, + wacom_touch_resolution(features, 0)); + input_abs_set_res(input_dev, ABS_Y, + wacom_touch_resolution(features, 1)); __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); } @@ -1272,6 +1284,11 @@ 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 */ + input_abs_set_res(input_dev, ABS_X, + wacom_touch_resolution(features, 0)); + input_abs_set_res(input_dev, ABS_Y, + wacom_touch_resolution(features, 0)); } else if (features->device_type == BTN_TOOL_PEN) { __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); __set_bit(BTN_TOOL_PEN, input_dev->keybit);