Received: by 2002:a17:90a:37a3:0:0:0:0 with SMTP id v32csp742308pjb; Fri, 21 Jun 2019 07:53:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxuCTVWeBPuPmtITMfv7urap3x9ZC6lE6XIM5W/8nKf5+YsZkxHO+49vRORiwBRE9Iarcvf X-Received: by 2002:a63:1f23:: with SMTP id f35mr19105593pgf.160.1561128818734; Fri, 21 Jun 2019 07:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561128818; cv=none; d=google.com; s=arc-20160816; b=yeh9aIz25IUwiZ73C5YaVEjyTDxKH2oS4Ma1rhSMCqcY90cz2nJxgOYbb+CD6AV8KQ CR17GNJ48j3OqL+KEUEYvRrNJ8SO63yKXDp5AHmicYdCX2tx9UGAtSkRGuHngo0Hr2a7 W4oeTor476rZoT2ExQIuB0ozRgyf/VGAA79xRlNJ56zFxQQChV8Ig1EJv1wlfmSHolPv RHWDpbdbDUyn9YYY1xFSTgLM5wozLZAmo9wgiiW4B2CI45LNGtcifaWEx8sZZ+xOmRvx rxb2KMhBfok8PK3XP0AbJdNB+bo+VqQ6ScBxThMAeZSRRBjU0o2/IO0C1iU/9iZpAAuh 2r8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=GoE2Orc5MXhxi85M/gd8MdklhhXDFLFTeptMP8vj//U=; b=y9FCQdqzudNI3g7sx2dqOxLMUa1ZQeP1KS/Qi2yWr8J9JrrE9F153jzUR0PPAP1PFA hNDaPk1Epnb9BrGgH0EpEfBOE8EoE3iuBqHhA5hsoGuq99jF624HzNIMJ7GfrUzGT1Xn joOR57CqDa7SSWh22nyE2z28cE/V1caXhBIqKoxDJdifLWr0mx5VQXDFZEHiBxOqYHTB aRuMKBsTSzNvvMV/pMCw9k+jQtuPfhprkCIGUE5lp3Dk7tb4mfQkuQffenrBaet7tIo3 jc/uwRYDWKX1n+5Q3pnfKxa5oxUAqbcDDXQShc4pAtEs8RsSoD/JyyF//UOb7nRazZyz szrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RbjhldIL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t21si2971960pjq.62.2019.06.21.07.53.23; Fri, 21 Jun 2019 07:53:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RbjhldIL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726313AbfFUOxR (ORCPT + 99 others); Fri, 21 Jun 2019 10:53:17 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:38636 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725985AbfFUOxR (ORCPT ); Fri, 21 Jun 2019 10:53:17 -0400 Received: by mail-pg1-f194.google.com with SMTP id z75so893858pgz.5; Fri, 21 Jun 2019 07:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GoE2Orc5MXhxi85M/gd8MdklhhXDFLFTeptMP8vj//U=; b=RbjhldILBm/iPj8lCfjcyYHEAbw9X4D7WzTlZO57UxqppDImM1TSaLcaptJ++8NWpj Ryh09I1L2xBuf9o7wUCWs2dFuJ+5LoVLFjFWSwE99tjNSnRkmSJXteL4/J80zUUuqu8T dxonnK9e6v8K/pow+B1qfhCpYNDtnuMpZrbTlvxee2IUABi4yZ/MVIqeTwS2GqB+lBOa BVFzMY6W5dnBcX/38S+WNrF28lRWD1q2VuKClO011EHJsjLpFlu2pgoVaoSH5uww5YdY gAq4Xch50MOl2PMeBobX+LmsFtQdVYqmRonzY8weUQLMK4encgwqdbGTPRbB7w4DRiIv bzUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GoE2Orc5MXhxi85M/gd8MdklhhXDFLFTeptMP8vj//U=; b=sCt7DjtZ7jYuUaGAmYOYQAanpZK5ujATB6Th2pQMzNQDctKwAo5zK5+WQU2Ci0c+st OBFNwsI+Xkk91Xm6NAoCOJT1KRbOCbJ3rAMKHX1EhNXNWkRtFM7SMmFr85HeO2ZKbZxA +qHNrLJ2VNnMrHoZ1cDhuewZ2aGd/QGSBKlwhykEZI+hn8VH3YverGaH+fKAIx4jPcAV 79fRgVJVHLssbyvQsyUGZLjO8NWJqg2qqInJ2Mv1GNDmex0J4sUaYmJ7c8HJYwM93ELz mHcRS3WOKB+gY/bnrarMzdAp4RtS0dH6KoESPB4h1oUoEbR4NaBCfB9XDTfGqPnnEAlB V0tg== X-Gm-Message-State: APjAAAW4k6Hydj6gsCQa+3R6V8Oy4gZB5CQ05SSnDkR1CU0/bvw8Svkj 8vkxzSalfgjpVD06/woRZDu32RaU X-Received: by 2002:a17:90a:8a15:: with SMTP id w21mr7253348pjn.134.1561128796252; Fri, 21 Jun 2019 07:53:16 -0700 (PDT) Received: from aw-bldr-10.qualcomm.com (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id t2sm3099032pgo.61.2019.06.21.07.53.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Jun 2019 07:53:15 -0700 (PDT) From: Jeffrey Hugo To: benjamin.tissoires@redhat.com, dmitry.torokhov@gmail.com, jikos@kernel.org, hdegoede@redhat.com Cc: bjorn.andersson@linaro.org, agross@kernel.org, lee.jones@linaro.org, xnox@ubuntu.com, robh+dt@kernel.org, mark.rutland@arm.com, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Jeffrey Hugo Subject: [PATCH v8 2/5] HID: quirks: Refactor ELAN 400 and 401 handling Date: Fri, 21 Jun 2019 07:53:12 -0700 Message-Id: <20190621145312.38688-1-jeffrey.l.hugo@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190621144854.38568-1-jeffrey.l.hugo@gmail.com> References: <20190621144854.38568-1-jeffrey.l.hugo@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There needs to be coordination between hid-quirks and the elan_i2c driver about which devices are handled by what drivers. Currently, both use whitelists, which results in valid devices being unhandled by default, when they should not be rejected by hid-quirks. This is quickly becoming an issue. Since elan_i2c has a maintained whitelist of what devices it will handle, which is now in a header file that hid-quirks can access, use that to implement a blacklist in hid-quirks so that only the devices that need to be handled by elan_i2c get rejected by hid-quirks, and everything else is handled by default. Suggested-by: Benjamin Tissoires Signed-off-by: Jeffrey Hugo Acked-by: Benjamin Tissoires --- drivers/hid/hid-quirks.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c index e5ca6fe2ca57..48ed4caf0ebc 100644 --- a/drivers/hid/hid-quirks.c +++ b/drivers/hid/hid-quirks.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "hid-ids.h" @@ -914,6 +915,8 @@ static const struct hid_device_id hid_mouse_ignore_list[] = { bool hid_ignore(struct hid_device *hdev) { + int i; + if (hdev->quirks & HID_QUIRK_NO_IGNORE) return false; if (hdev->quirks & HID_QUIRK_IGNORE) @@ -978,18 +981,15 @@ bool hid_ignore(struct hid_device *hdev) break; case USB_VENDOR_ID_ELAN: /* - * Many Elan devices have a product id of 0x0401 and are handled - * by the elan_i2c input driver. But the ACPI HID ELAN0800 dev - * is not (and cannot be) handled by that driver -> - * Ignore all 0x0401 devs except for the ELAN0800 dev. + * Blacklist of everything that gets handled by the elan_i2c + * input driver. This avoids disabling valid touchpads and + * other ELAN devices. */ - if (hdev->product == 0x0401 && - strncmp(hdev->name, "ELAN0800", 8) != 0) - return true; - /* Same with product id 0x0400 */ - if (hdev->product == 0x0400 && - strncmp(hdev->name, "QTEC0001", 8) != 0) - return true; + if ((hdev->product == 0x0401 || hdev->product == 0x0400)) + for (i = 0; strlen(elan_acpi_id[i].id); ++i) + if (!strncmp(hdev->name, elan_acpi_id[i].id, + strlen(elan_acpi_id[i].id))) + return true; break; } -- 2.17.1