From patchwork Tue Nov 24 13:49:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Adrien_Verg=C3=A9?= X-Patchwork-Id: 7691351 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 75206BF90C for ; Tue, 24 Nov 2015 13:52:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8BABE207E5 for ; Tue, 24 Nov 2015 13:52:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8F5E2207D7 for ; Tue, 24 Nov 2015 13:52:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753780AbbKXNwh (ORCPT ); Tue, 24 Nov 2015 08:52:37 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:33253 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753749AbbKXNuT (ORCPT ); Tue, 24 Nov 2015 08:50:19 -0500 Received: by wmec201 with SMTP id c201so209846853wme.0; Tue, 24 Nov 2015 05:50:18 -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:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=Q0ongRneX4K75jdBIzgMzSoSBI9cYzZzipr5RUfSPkY=; b=WpJVpRPLOx8Juwl4c2vfGyYE5fZeVw2+xQAZ5PEcM9cgVC/byMmaV8+Ia/FoPNZl74 HfA9V1NI2wCJedrBTVFAodxaNYC3SW/vqgww4mIcaY6CfQJ6zRlWDK3yhDoF3TbuECit R0hZ1jy9oXMeCbbU44J847nZYpmHogAmrutplRE2jvlB23C5/2ZIKyvbk5a7U5uycTGA 2HwzLPmmjxLxQ7PgAop2RHMX58DOSW6L02olzesd/VZUXbW4xFf3CeNoPsKp+tDnKP96 P1raviLMQulUNib76yLIg6/SUU8Hfo+pzazRjiRDxatavV9vD/fsznYwmm4I+VkHgP/d rniw== X-Received: by 10.28.176.70 with SMTP id z67mr26881776wme.5.1448373017917; Tue, 24 Nov 2015 05:50:17 -0800 (PST) Received: from e7450.localdomain (204.13-14-84.ripe.coltfrance.com. [84.14.13.204]) by smtp.googlemail.com with ESMTPSA id m185sm2396585wmf.0.2015.11.24.05.50.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Nov 2015 05:50:17 -0800 (PST) From: =?UTF-8?q?Adrien=20Verg=C3=A9?= To: Oliver Neukum Cc: Jiri Kosina , Greg Kroah-Hartman , Logan Gunthorpe , Hans de Goede , Vincent Palatin , =?UTF-8?q?Adrien=20Verg=C3=A9?= , Macpaul Lin , Adel Gadllah , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH v3 2/2] USB: quirks: Apply ALWAYS_POLL to all ELAN devices Date: Tue, 24 Nov 2015 14:49:08 +0100 Message-Id: <1448372948-8861-3-git-send-email-adrienverge@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1448372948-8861-1-git-send-email-adrienverge@gmail.com> References: <1448165164-11398-1-git-send-email-adrienverge@gmail.com> <1448372948-8861-1-git-send-email-adrienverge@gmail.com> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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 All ELAN hid devices seem to require the ALWAYS_POLL quirk. Let's use this quirk for all devices from this vendor, rather than maintaining a list of all its known product IDs. To achieve that, this patch introduces a new hid_vendor_blacklist[] that is checked when the product ID is not found in hid_product_blacklist[]. Tested-by: Adrien Vergé Signed-off-by: Adrien Vergé --- drivers/hid/hid-ids.h | 5 ----- drivers/hid/usbhid/hid-quirks.c | 43 +++++++++++++++++++++++++++-------------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index ac1feea..3c7e0c3 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -316,11 +316,6 @@ #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001 #define USB_VENDOR_ID_ELAN 0x04f3 -#define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089 -#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B 0x009b -#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103 0x0103 -#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c 0x010c -#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F 0x016f #define USB_VENDOR_ID_ELECOM 0x056e #define USB_DEVICE_ID_ELECOM_BM084 0x0061 diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 94bb137..9550497 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c @@ -21,15 +21,29 @@ #include "../hid-ids.h" +struct hid_blacklist { + __u16 idVendor; + __u16 idProduct; + __u32 quirks; +}; + +/* + * Alphabetically sorted blacklist for vendor-global quirks. If a device matches + * both this blacklist and the product one (below), the more specific one + * (product ID) prevails. + */ + +static const struct hid_blacklist hid_vendor_blacklist[] = { + { USB_VENDOR_ID_ELAN, 0, HID_QUIRK_ALWAYS_POLL }, + + { 0, 0, 0 } +}; + /* * Alphabetically sorted blacklist by quirk type. */ -static const struct hid_blacklist { - __u16 idVendor; - __u16 idProduct; - __u32 quirks; -} hid_blacklist[] = { +static const struct hid_blacklist hid_product_blacklist[] = { { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_GAMEPAD, HID_QUIRK_BADPAD }, { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_PREDATOR, HID_QUIRK_BADPAD }, { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, @@ -72,11 +86,6 @@ static const struct hid_blacklist { { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT }, - { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL }, - { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL }, - { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL }, - { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c, HID_QUIRK_ALWAYS_POLL }, - { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL }, { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, @@ -337,10 +346,16 @@ static const struct hid_blacklist *usbhid_exists_squirk(const u16 idVendor, const struct hid_blacklist *bl_entry = NULL; int n = 0; - for (; hid_blacklist[n].idVendor; n++) - if (hid_blacklist[n].idVendor == idVendor && - hid_blacklist[n].idProduct == idProduct) - bl_entry = &hid_blacklist[n]; + for (; hid_product_blacklist[n].idVendor; n++) + if (hid_product_blacklist[n].idVendor == idVendor && + hid_product_blacklist[n].idProduct == idProduct) + bl_entry = &hid_product_blacklist[n]; + + if (bl_entry == NULL) { + for (n = 0; hid_vendor_blacklist[n].idVendor; n++) + if (hid_vendor_blacklist[n].idVendor == idVendor) + bl_entry = &hid_vendor_blacklist[n]; + } if (bl_entry != NULL) dbg_hid("Found squirk 0x%x for USB HID vendor 0x%hx prod 0x%hx\n",