From patchwork Mon Aug 8 19:06:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 9269169 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C0C9B607D6 for ; Mon, 8 Aug 2016 19:06:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD41828159 for ; Mon, 8 Aug 2016 19:06:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A156A28161; Mon, 8 Aug 2016 19:06:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 071F028159 for ; Mon, 8 Aug 2016 19:06:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752297AbcHHTGr (ORCPT ); Mon, 8 Aug 2016 15:06:47 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:35699 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752265AbcHHTGq (ORCPT ); Mon, 8 Aug 2016 15:06:46 -0400 Received: by mail-pf0-f194.google.com with SMTP id h186so25420806pfg.2 for ; Mon, 08 Aug 2016 12:06:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dB7PhurNuahT6Cfnrmfdoa8D2xz1PvSMEurhLCPIO8c=; b=YYqSkZ6Iy1V2xE++sTROdobVvQPlH49FrRblmJ8jVWorvTRHJQRlh2KQvH1iBi41dZ M9bz3OcuywGwn3xRgjXITiyN7pLl5FxNF3Ju3HAGpzHveYXeBqUFY06V+zp53tNzv+9L ZHvakLTcZ7zgr54dSiAokrPQB9aOlSJymiUkS+sy3CtQo1xMO2V/r1kQ/Ew4LJx4/l9Q xPPehl389XbK3SkV4J1Vr3/Q1F7fIuKg9AS0H45mQVxRSUDKBQ7V9KyhX+w5J6YHRzyq Qi8/wIZAjieU46DCTL5EtJA4pM+unteolQT1CgCWNUm4CBsN2MVC9VdeQjRCEO2Q4MTp y5KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dB7PhurNuahT6Cfnrmfdoa8D2xz1PvSMEurhLCPIO8c=; b=K30Kyl9ZyI3OGT6aDKhFNPgQG9W4CwlYbBLrMLYZV9E1cZrage8HevOgwDVWMkvbqK sxVs66dmfD1Ut3ZMyMZtgzzpREL+hUFLg4T5TJGBZOy6MU7s8ofiPlk2o+PmhSY8zH1t smUwvDv6Vqfsr3vf7C3eOyu53VsH84BwKYsv68bY50Bk/ugrCEBKR83LNJACUgPaiN4U qRxDGOb1l5Ji19eOpawSAyS7zFrdEusj/qb8TZdlxXbkhbq2r/yJOa162Ky5AYVUVTDo q7CNtk219fEP1FFhr4bC1/78cjQVmGb1S5r/Y7rd4KySZpi0fST5uISM7NOWeqD5CKw+ +ggg== X-Gm-Message-State: AEkoout5XnJOA4LPO+5vTdEHTCPANV3Rf+SuLl/h/UeMaz0dvV/8q62yPLkm060jpLCIQw== X-Received: by 10.98.16.75 with SMTP id y72mr164684514pfi.50.1470683205681; Mon, 08 Aug 2016 12:06:45 -0700 (PDT) Received: from wtc005007.corp.onewacom.com (75-164-217-104.ptld.qwest.net. [75.164.217.104]) by smtp.gmail.com with ESMTPSA id h1sm50060075pay.48.2016.08.08.12.06.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Aug 2016 12:06:44 -0700 (PDT) From: Jason Gerecke To: linux-input@vger.kernel.org Cc: Ping Cheng , Aaron Skomra , Benjamin Tissoires , Jiri Kosina , Jason Gerecke , Jason Gerecke Subject: [PATCH v4 1/2] HID: wacom: Add WACOM_DEVICETYPE_DIRECT for Cintiqs and similar Date: Mon, 8 Aug 2016 12:06:29 -0700 Message-Id: <20160808190630.7641-1-killertofu@gmail.com> X-Mailer: git-send-email 2.9.2 In-Reply-To: <20160711180711.17537-1-killertofu@gmail.com> References: <20160711180711.17537-1-killertofu@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP "Direct" input devices like Cintiqs and Tablet PCs set the INPUT_PROP_DIRECT property to notify userspace that the sensor and screen are overlaid. This information can also be useful elsewhere within the kernel driver, however, so we introduce a new WACOM_DEVICETYPE_DIRECT that signals this to other kernel code. Signed-off-by: Jason Gerecke Reviewed-by: Benjamin Tissoires --- Changes from v3: * Changed 'WACOM24_HD' to 'WACOM_24HD' (/me places paper bag over head) drivers/hid/wacom_wac.c | 58 +++++++++++++++++++++++++++++++++---------------- drivers/hid/wacom_wac.h | 1 + 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 510a56b..cfefed0 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1740,10 +1740,10 @@ void wacom_wac_usage_mapping(struct hid_device *hdev, { struct wacom *wacom = hid_get_drvdata(hdev); struct wacom_wac *wacom_wac = &wacom->wacom_wac; + struct wacom_features *features = &wacom_wac->features; /* currently, only direct devices have proper hid report descriptors */ - __set_bit(INPUT_PROP_DIRECT, wacom_wac->pen_input->propbit); - __set_bit(INPUT_PROP_DIRECT, wacom_wac->touch_input->propbit); + features->device_type |= WACOM_DEVICETYPE_DIRECT; if (WACOM_PEN_FIELD(field)) return wacom_wac_pen_usage_mapping(hdev, field, usage); @@ -2449,6 +2449,33 @@ void wacom_setup_device_quirks(struct wacom *wacom) if (features->type == REMOTE) features->device_type = WACOM_DEVICETYPE_PAD; + switch (features->type) { + case PL: + case DTU: + case DTUS: + case DTUSX: + case WACOM_21UX2: + case WACOM_22HD: + case DTK: + case WACOM_24HD: + case WACOM_27QHD: + case CINTIQ_HYBRID: + case CINTIQ_COMPANION_2: + case CINTIQ: + case WACOM_BEE: + case WACOM_13HD: + case WACOM_24HDT: + case WACOM_27QHDT: + case TABLETPC: + case TABLETPCE: + case TABLETPC2FG: + case MTSCREEN: + case MTTPC: + case MTTPC_B: + features->device_type |= WACOM_DEVICETYPE_DIRECT; + break; + } + if (wacom->hdev->bus == BUS_BLUETOOTH) features->quirks |= WACOM_QUIRK_BATTERY; @@ -2482,6 +2509,11 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, if (!(features->device_type & WACOM_DEVICETYPE_PEN)) return -ENODEV; + if (features->device_type & WACOM_DEVICETYPE_DIRECT) + __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); + else + __set_bit(INPUT_PROP_POINTER, input_dev->propbit); + if (features->type == HID_GENERIC) /* setup has already been done */ return 0; @@ -2500,7 +2532,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, input_abs_set_res(input_dev, ABS_X, features->x_resolution); input_abs_set_res(input_dev, ABS_Y, features->y_resolution); - switch (features->type) { case GRAPHIRE_BT: __clear_bit(ABS_MISC, input_dev->absbit); @@ -2524,8 +2555,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); __set_bit(BTN_STYLUS, input_dev->keybit); __set_bit(BTN_STYLUS2, input_dev->keybit); - - __set_bit(INPUT_PROP_POINTER, input_dev->propbit); break; case WACOM_27QHD: @@ -2540,7 +2569,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, case CINTIQ_COMPANION_2: input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); input_abs_set_res(input_dev, ABS_Z, 287); - __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); wacom_setup_cintiq(wacom_wac); break; @@ -2556,8 +2584,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, /* fall through */ case INTUOS: - __set_bit(INPUT_PROP_POINTER, input_dev->propbit); - wacom_setup_intuos(wacom_wac); break; @@ -2567,8 +2593,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, case INTUOSPL: case INTUOS5S: case INTUOSPS: - __set_bit(INPUT_PROP_POINTER, input_dev->propbit); - input_set_abs_params(input_dev, ABS_DISTANCE, 0, features->distance_max, features->distance_fuzz, 0); @@ -2598,8 +2622,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); __set_bit(BTN_STYLUS, input_dev->keybit); __set_bit(BTN_STYLUS2, input_dev->keybit); - - __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); break; case PTU: @@ -2610,16 +2632,12 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, __set_bit(BTN_TOOL_PEN, input_dev->keybit); __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); __set_bit(BTN_STYLUS, input_dev->keybit); - - __set_bit(INPUT_PROP_POINTER, input_dev->propbit); break; case INTUOSHT: case BAMBOO_PT: case BAMBOO_PEN: case INTUOSHT2: - __set_bit(INPUT_PROP_POINTER, input_dev->propbit); - if (features->type == INTUOSHT2) { wacom_setup_basic_pro_pen(wacom_wac); } else { @@ -2650,6 +2668,11 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev, if (!(features->device_type & WACOM_DEVICETYPE_TOUCH)) return -ENODEV; + if (features->device_type & WACOM_DEVICETYPE_DIRECT) + __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); + else + __set_bit(INPUT_PROP_POINTER, input_dev->propbit); + if (features->type == HID_GENERIC) /* setup has already been done */ return 0; @@ -2684,8 +2707,6 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev, case INTUOSPL: case INTUOS5S: case INTUOSPS: - __set_bit(INPUT_PROP_POINTER, input_dev->propbit); - input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, features->y_max, 0, 0); input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); @@ -2708,7 +2729,6 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev, case TABLETPC: case TABLETPCE: - __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); break; case INTUOSHT: diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index 9326b60..324c40b 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h @@ -82,6 +82,7 @@ #define WACOM_DEVICETYPE_TOUCH 0x0002 #define WACOM_DEVICETYPE_PAD 0x0004 #define WACOM_DEVICETYPE_WL_MONITOR 0x0008 +#define WACOM_DEVICETYPE_DIRECT 0x0010 #define WACOM_VENDORDEFINED_PEN 0xff0d0001 #define WACOM_G9_PAGE 0xff090000