From patchwork Fri Dec 5 21:37:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 5445951 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 759F6BEEA8 for ; Fri, 5 Dec 2014 21:37:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 93440201F2 for ; Fri, 5 Dec 2014 21:37:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A364D201D3 for ; Fri, 5 Dec 2014 21:37:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751949AbaLEVhj (ORCPT ); Fri, 5 Dec 2014 16:37:39 -0500 Received: from mail-pd0-f176.google.com ([209.85.192.176]:49952 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751535AbaLEVhj (ORCPT ); Fri, 5 Dec 2014 16:37:39 -0500 Received: by mail-pd0-f176.google.com with SMTP id y10so1424028pdj.35 for ; Fri, 05 Dec 2014 13:37:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=nfGAERP3e/hetYa7P25hepni3+Avcx4Yfnzbc6LijlY=; b=e8f/E0+MrsJ9R3xX8eXlo8rJarDabXK527vRypKJwLdHcnd1rnW4FQEVOCxUjYEzvP Ckk0NsihJpNpm/20oaIq28CJp1/rbD1l5phAGgQ18LWRzjRO20+6QEI/HPcG13AMs0sP BTrs1Zs9Zzl8toTp4jjZxOmH3/4WaPr3140u/APfysTvsjxSPkX7vmD+0tyQQUvMnq+p FI04TONmMvKZITJ3xQTpfxPqYc1n6QRNCGhk1xcBTW2SwRcYJ+FPbxH6eE/diI7UBKPj ve1BZJ93PkCYXIV/cPNg7XopruvkpX+4Kj0kvVp3GRmounl3sPozhzPWJtWlVqzqdK6T pmlA== X-Received: by 10.68.230.10 with SMTP id su10mr38793454pbc.129.1417815458736; Fri, 05 Dec 2014 13:37:38 -0800 (PST) Received: from wacom-arch2.localdomain ([67.51.163.2]) by mx.google.com with ESMTPSA id fy4sm29749715pbb.42.2014.12.05.13.37.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Dec 2014 13:37:37 -0800 (PST) From: Jason Gerecke To: jkosina@suse.cz Cc: linux-input@vger.kernel.org, benjamin.tissoires@gmail.com, pinglinux@gmail.com, Jason Gerecke Subject: [PATCH v2 2/3] HID: wacom: Initialize MT slots for generic devices at post_parse_hid Date: Fri, 5 Dec 2014 13:37:32 -0800 Message-Id: <1417815453-10618-1-git-send-email-killertofu@gmail.com> X-Mailer: git-send-email 2.1.3 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If a HID descriptor places HID_DG_CONTACTID before HID_DG_X and HID_DG_Y then the ABS_X and ABS_Y will not be automatically initialized by the call to input_mt_init_slots. To ensure that this is not a problem, we relocate that call to occur after HID parsing has been completed and we've initalized all the multitouch axes. Signed-off-by: Jason Gerecke Reviewed-by: Benjamin Tissoires --- Changes from v1: * Patch renamed from "HID: wacom: Manually declare ABS_{X,Y} for pointer emulation" * Patch moves call to input_mt_init_slots rather than manually declare ABS_{X,Y} drivers/hid/wacom_sys.c | 18 ++++++++++++++++++ drivers/hid/wacom_wac.c | 3 --- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index eb55316..872aa0b 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -13,6 +13,7 @@ #include "wacom_wac.h" #include "wacom.h" +#include #define WAC_MSG_RETRIES 5 @@ -236,6 +237,21 @@ static void wacom_usage_mapping(struct hid_device *hdev, wacom_wac_usage_mapping(hdev, field, usage); } +static void wacom_post_parse_hid(struct hid_device *hdev, + struct wacom_features *features) +{ + struct wacom *wacom = hid_get_drvdata(hdev); + struct wacom_wac *wacom_wac = &wacom->wacom_wac; + + if (features->type == HID_GENERIC) { + /* Any last-minute generic device setup */ + if (features->touch_max > 1) { + input_mt_init_slots(wacom_wac->input, wacom_wac->features.touch_max, + INPUT_MT_DIRECT); + } + } +} + static void wacom_parse_hid(struct hid_device *hdev, struct wacom_features *features) { @@ -270,6 +286,8 @@ static void wacom_parse_hid(struct hid_device *hdev, wacom_usage_mapping(hdev, hreport->field[i], hreport->field[i]->usage + j); } + + wacom_post_parse_hid(hdev, features); } static int wacom_hid_set_device_mode(struct hid_device *hdev) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index a8a19a5..c33f889 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1381,7 +1381,6 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev, { struct wacom *wacom = hid_get_drvdata(hdev); struct wacom_wac *wacom_wac = &wacom->wacom_wac; - struct input_dev *input = wacom_wac->input; unsigned touch_max = wacom_wac->features.touch_max; switch (usage->hid) { @@ -1400,8 +1399,6 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev, ABS_MT_POSITION_Y, 4); break; case HID_DG_CONTACTID: - input_mt_init_slots(input, wacom_wac->features.touch_max, - INPUT_MT_DIRECT); break; case HID_DG_INRANGE: break;