Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7728544ybi; Thu, 6 Jun 2019 00:08:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3fM4j7QLND1uI5vTJuqqEUiW4zuk697yqhLUZ3pUiksZ7J7+8PI65ujD2CEbzuLb9CZHQ X-Received: by 2002:a17:902:e409:: with SMTP id ci9mr49002164plb.103.1559804912396; Thu, 06 Jun 2019 00:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559804912; cv=none; d=google.com; s=arc-20160816; b=dWn2OnZQtTMcjWbRsPOiA1+4iZrlHi0fwrQRDAPkCMe4pfPicrdv5o7uFYujEXEfd3 HMWVMOBMM/BdJDratUSL/8QE6li608aGFw4tchs6sDKW+3N8UdmxgPVyO6pDAaU9trWM zBQTcC+n+Zg1nOCOV7m5rmEpMamZpmHZOH5l8z5+ZQwfQenFcf7lU+hqPHdo6e27uKeS RxT0rHFTSHOSY9ywgXW57YIg0FGIrW7rBDRyXDjAu/u53i6JXEIkeXLgJlbfxxVMsEcH RorQD3IJ/yX8WvR0FdhnU2sXbQsqneOqy/ekevICkUCylQzsCGz2yMs5gFMgT3kC2ko0 JViw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=HpE5F2PryY/7ekaCFARM6Uj5LXLqn4ImiAP5wBAaGFc=; b=PN569YichaBJvVQlVOT8Yl4NRxgmUbdt6bqzChapuOlUREYFtbu+P0lZY/sk2RcOiF K/d5O2rmxF/Y7UfS+0jv4+BGq1WWteqNzidxw6QN/dANy5u8EAn+aOMGjQ3tdd5U6NbT 3zGqoWJUt9WmCr+SgdCQIj+UBGlAgwCJykt5Ppq/Tr1p3/i46brYCYZ4n8WuP8NjNZqc h6oDcrnzKA5+JvHy7l829PW+LUEtAtRVP0/0Z0J5fXwYhUrXssEzTJvImQgZETkAF0+g 2wfChGuhmFl20/Lee+5gaL3mOTJxRGoJnfdpN5hcqv41yS51/UT0dDKtRUnWcCbtYpuP wEpA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s138si1129391pfc.148.2019.06.06.00.08.14; Thu, 06 Jun 2019 00:08:32 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726785AbfFFHHG (ORCPT + 99 others); Thu, 6 Jun 2019 03:07:06 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:35813 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726722AbfFFHHE (ORCPT ); Thu, 6 Jun 2019 03:07:04 -0400 Received: by mail-qk1-f194.google.com with SMTP id l128so858119qke.2 for ; Thu, 06 Jun 2019 00:07:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HpE5F2PryY/7ekaCFARM6Uj5LXLqn4ImiAP5wBAaGFc=; b=M81sOntjiUiOAKlhMo/QLavJ0pI6rSSQmV6JPd5rjSQri2FEo0pbQtmAog4+ADoCyu lXqWEPo/SIRjnmfH70PT8IPP04xxk5JIAem1HWt0nC8mYjgly+VztKlP5FSrR6uypRnw wezKuRYSp1BcTfnpBeWGfas7ktlGv7F5FBMXpxf6uEkMtXZuXqSnEcJNMbFR2wGWAjBS 8fyQyQOsTN7JhkncehDJCyHPms0EoQ+H4C7SeyALbp3GsoZzPsp+rn6H8exLnyFL1oNb P3q8gxHkKr6ZU6htuEKRyEfJOTc5XsoWUMGGuCjO/xiAjf0MgnG6C3F1hZ02CRw+4DF+ FMNA== X-Gm-Message-State: APjAAAUaqb0x8gKxm94E/Qbvw5182/+hTYRG36YJkg8lUzHUPLY5mUZz 7h8EPvdvnGI8a2420CQfc5Y2JANsXhtS9uaC++FZ4A== X-Received: by 2002:a37:8847:: with SMTP id k68mr37265523qkd.278.1559804823661; Thu, 06 Jun 2019 00:07:03 -0700 (PDT) MIME-Version: 1.0 References: <20190423160543.9922-1-jeffrey.l.hugo@gmail.com> <20190423160605.9970-1-jeffrey.l.hugo@gmail.com> <20190521164324.GA2085@tuxbook-pro> In-Reply-To: From: Benjamin Tissoires Date: Thu, 6 Jun 2019 09:06:51 +0200 Message-ID: Subject: Re: [PATCH v4 1/2] HID: quirks: Refactor ELAN 400 and 401 handling To: Jeffrey Hugo Cc: Bjorn Andersson , Dmitry Torokhov , Jiri Kosina , Lee Jones , Rob Herring , Mark Rutland , Andy Gross , David Brown , Hans de Goede , "open list:HID CORE LAYER" , devicetree@vger.kernel.org, MSM , lkml Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 6, 2019 at 1:25 AM Jeffrey Hugo wrote: > > On Tue, May 21, 2019 at 10:42 AM Bjorn Andersson > wrote: > > > > On Tue 23 Apr 09:06 PDT 2019, Jeffrey Hugo wrote: > > > > > 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, > > > 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. The downside is the whitelist and > > > blacklist need to be kept in sync. > > > > > > > Reviewed-by: Bjorn Andersson > > > > Jiri, the two patches in this series doesn't have a build time > > dependency, so if you take this one through your tree I'll take 2/2 > > through arm-soc. > > Ping? Is this good from the HID perspective? I would really like to > see this queued for 5.3. > Sorry, this felt through the cracks. I'm fine with the idea of the patch, but I just realized what bugged me: we should instead have a static array of the various ACPI matches, instead of duplicating the various strncmp. So IMO, we should: - merge patch 2/2 through Bjorn's tree (or with any changes he would request) - have a v5 for the HID/input part with: * a static array of the names to match against in hid-quirks.c * separate the elan_i2c trivial change in its separate patch as there are already a few changes committed in the input tree, which is different from the HID tree. I don't expect any conflicts though, so if Dmitry is fine, I can take the whole input/HID part through the HID tree, but a separate patch would be more obvious in case of a conflict. Cheers, Benjamin > > > > Regards, > > Bjorn > > > > > Suggested-by: Benjamin Tissoires > > > Signed-off-by: Jeffrey Hugo > > > --- > > > drivers/hid/hid-quirks.c | 64 ++++++++++++++++++++++++----- > > > drivers/input/mouse/elan_i2c_core.c | 4 ++ > > > 2 files changed, 58 insertions(+), 10 deletions(-) > > > > > > diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c > > > index 77ffba48cc73..656485e08eb7 100644 > > > --- a/drivers/hid/hid-quirks.c > > > +++ b/drivers/hid/hid-quirks.c > > > @@ -987,17 +987,61 @@ 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 should be kept in sync with the whitelist > > > + * that exists in that 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) > > > + if ((hdev->product == 0x0401 || hdev->product == 0x0400) && > > > + (strncmp(hdev->name, "ELAN0000", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0100", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0600", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0601", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0602", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0603", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0604", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0605", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0606", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0607", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0608", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0609", 8) == 0 || > > > + strncmp(hdev->name, "ELAN060B", 8) == 0 || > > > + strncmp(hdev->name, "ELAN060C", 8) == 0 || > > > + strncmp(hdev->name, "ELAN060F", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0610", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0611", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0612", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0613", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0614", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0615", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0616", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0617", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0618", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0619", 8) == 0 || > > > + strncmp(hdev->name, "ELAN061A", 8) == 0 || > > > + strncmp(hdev->name, "ELAN061B", 8) == 0 || > > > + strncmp(hdev->name, "ELAN061C", 8) == 0 || > > > + strncmp(hdev->name, "ELAN061D", 8) == 0 || > > > + strncmp(hdev->name, "ELAN061E", 8) == 0 || > > > + strncmp(hdev->name, "ELAN061F", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0620", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0621", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0622", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0623", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0624", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0625", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0626", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0627", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0628", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0629", 8) == 0 || > > > + strncmp(hdev->name, "ELAN062A", 8) == 0 || > > > + strncmp(hdev->name, "ELAN062B", 8) == 0 || > > > + strncmp(hdev->name, "ELAN062C", 8) == 0 || > > > + strncmp(hdev->name, "ELAN062D", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0631", 8) == 0 || > > > + strncmp(hdev->name, "ELAN0632", 8) == 0 || > > > + strncmp(hdev->name, "ELAN1000", 8) == 0 || > > > + strncmp(hdev->name, "elan,ekth3000", 13) == 0)) > > > return true; > > > break; > > > } > > > diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c > > > index f9525d6f0bfe..3ded19528cd4 100644 > > > --- a/drivers/input/mouse/elan_i2c_core.c > > > +++ b/drivers/input/mouse/elan_i2c_core.c > > > @@ -1332,6 +1332,10 @@ static const struct i2c_device_id elan_id[] = { > > > }; > > > MODULE_DEVICE_TABLE(i2c, elan_id); > > > > > > +/* > > > + * when these whtielists get updated, the corresponding blacklist in hid-quirks > > > + * needs to be updated to match. > > > + */ > > > #ifdef CONFIG_ACPI > > > static const struct acpi_device_id elan_acpi_id[] = { > > > { "ELAN0000", 0 }, > > > -- > > > 2.17.1 > > >