From patchwork Wed Dec 7 09:11:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 30720 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp73619wrr; Wed, 7 Dec 2022 01:23:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf6kWl0IJ3niEm/ikCnORqSsaZmkv+75j+GvhDlFIvBnj17y2TztU/Plc07g0cpzCJye5vbR X-Received: by 2002:a17:902:9a92:b0:189:9031:6758 with SMTP id w18-20020a1709029a9200b0018990316758mr13634650plp.138.1670404981536; Wed, 07 Dec 2022 01:23:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670404981; cv=none; d=google.com; s=arc-20160816; b=TLxvF3yxMhBB+ufzaLyjGbem0VMVvwo1G1gbiIMsIGbl0DxfhXqsfCxq607/0qWbWP B44vSjPNk/4stAAJRs/9s98rlTXd/irFyruSqUTj6wzB0msAZrIqHH/DlWajA7MfPIgZ 0OyJIOhe4IbmctaOrcA/4vVzQUEIQWGyv62suE8FhHdpbJz9rMXkCiUJVspDISllMRDW huKGl/uD/3s8anQYraFh9oNdYPZj31fkno5fzk8hIhXMZAZpj/R/513ElMezwpW3K8vL pmJPrI6qMjiiPQFOdoT+s/QiKGg7hgQRTBsE4i2IFnlFhii9PNQCNvJPMWBwwbvKY1rV 1ciQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=LaFaI5kUp+ekQOEhR2qxNEZ4crNmcO/CaudvDetY2Z0=; b=MzPPeYjJm8vU2b0up0gPnMAW6GGU17xEXmMYACwbhcFMeZ6L5OS3JRVtPdGHsKkslZ piioAwSpEEts7AQceXFWr5TqhUPCC2gGOTyg93iVTMZBkiU/wsJUeREWh6Q+TJVcv/G+ R8IyAIxIiTL1dk+5uekygHlUqPIBKxTJ0lQQD3KdUfXOaAfLoJb5jqYw/oybgUb7RFqv fHwgTtrrbjTzoqbNiOYfzLdPggb4OL7TuoHRG/x530KHgovHNx+hPzLGouBiDhXvjlgH FYp6oHIKgxQl6VSctO5jE46h7xHXHj1z0sV2msRK7td+eoUWyIuaFXqnFn5YcB7kVpzr vEQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a22-20020a63e416000000b00478d902b3e1si5025803pgi.61.2022.12.07.01.22.45; Wed, 07 Dec 2022 01:23:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230163AbiLGJNx (ORCPT + 99 others); Wed, 7 Dec 2022 04:13:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230149AbiLGJNH (ORCPT ); Wed, 7 Dec 2022 04:13:07 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 753CC286F5; Wed, 7 Dec 2022 01:13:06 -0800 (PST) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.1.0) id 71a7a6d26ff50113; Wed, 7 Dec 2022 10:13:04 +0100 Received: from kreacher.localnet (unknown [213.134.169.108]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 22F24780872; Wed, 7 Dec 2022 10:13:04 +0100 (CET) Authentication-Results: v370.home.net.pl; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: v370.home.net.pl; spf=fail smtp.mailfrom=rjwysocki.net From: "Rafael J. Wysocki" To: Jiri Kosina , Bastien Nocera Cc: Filipe =?iso-8859-1?q?La=EDns?= , Benjamin Tissoires , linux-input@vger.kernel.org, LKML , "Rafael J. Wysocki" , Thorsten Leemhuis Subject: [PATCH v1 1/2] HID: generic: Add ->match() check to __check_hid_generic() Date: Wed, 07 Dec 2022 10:11:50 +0100 Message-ID: <4809717.31r3eYUQgx@kreacher> In-Reply-To: <5647715.DvuYhMxLoT@kreacher> References: <2262737.ElGaqSPkdT@kreacher> <5647715.DvuYhMxLoT@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 213.134.169.108 X-CLIENT-HOSTNAME: 213.134.169.108 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrudekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppedvudefrddufeegrdduieelrddutdeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudeiledruddtkedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepkedprhgtphhtthhopehjihhkohhssehkvghrnhgvlhdrohhrghdprhgtphhtthhopehhrgguvghssheshhgruggvshhsrdhnvghtpdhrtghpthhtoheplhgrihhnshesrhhishgvuhhprdhnvghtpdhrtghpthhtohepsggvnhhjrghmihhnrdhtihhsshhoihhrvghssehrvgguhhgrthdrtghomhdprhgtphhtthhopehlihhnuhigqdhinhhpuhhtsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhgrfhgrvghlsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehrvghgrhgvshhsihhonhhssehlvggvmhhhuhhishdrihhnfhho X-DCC--Metrics: v370.home.net.pl 1024; Body=8 Fuz1=8 Fuz2=8 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751546574043861452?= X-GMAIL-MSGID: =?utf-8?q?1751546574043861452?= From: Rafael J. Wysocki Some special HID drivers (for example, hid-logitech-hidpp) use ->match() callbacks to reject specific devices that otherwise would match the driver's device ID list, with the expectation that those devices will be handled by some other drivers. However, this doesn't work if hid-generic is expected to bind to the given device, because its ->match() callback, hid_generic_match(), rejects all devices that match device ID lists of the other HID drivers regardless of what is returned by the other drivers' ->match() callbacks. To make it work, amend the function used by hid_generic_match() for checking an individual driver, __check_hid_generic(), with a check involving the given driver's ->match() callback, so 0 is returned when that callback rejects the device in question. Fixes: 532223c8ac57 ("HID: logitech-hidpp: Enable HID++ for all the Logitech Bluetooth devices") Signed-off-by: Rafael J. Wysocki --- drivers/hid/hid-generic.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) Index: linux-pm/drivers/hid/hid-generic.c =================================================================== --- linux-pm.orig/drivers/hid/hid-generic.c +++ linux-pm/drivers/hid/hid-generic.c @@ -31,7 +31,13 @@ static int __check_hid_generic(struct de if (hdrv == &hid_generic) return 0; - return hid_match_device(hdev, hdrv) != NULL; + if (!hid_match_device(hdev, hdrv)) + return 0; + + if (hdrv->match) + return hdrv->match(hdev, false); + + return 1; } static bool hid_generic_match(struct hid_device *hdev, From patchwork Wed Dec 7 09:12:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 30721 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp74203wrr; Wed, 7 Dec 2022 01:24:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf6P+3vCS3eGgVESJuxqF6Ws0zMyx6v5ot7Xcm4GBgm4zHkCda1RxlhD12Zpsh7lpjuTBa4J X-Received: by 2002:aa7:9acb:0:b0:577:1f5f:cc28 with SMTP id x11-20020aa79acb000000b005771f5fcc28mr10100705pfp.16.1670405093284; Wed, 07 Dec 2022 01:24:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670405093; cv=none; d=google.com; s=arc-20160816; b=hMgbac7KLhzGzCu/LXG/6Iz32J9g27Llk1t2ziKZUAEqd5BFqd4bMsKwsyD4CxP7Am w/uKTtZWHOJwQoKl/PpIiD13q1rE81y55bx/iEI6CsKkPd39ovE7Bx8JHt05dRfeURTg MZLAs6VphA0q7fT+hkoud7Xj1VjskJCIhsq0nlglYhV8C/ZiKk39tXFQI0PiGjl9xGPX 2Gd8XPIbTrEhPX3iqUd6tQneUsZK8y5UUUmxkFWhztRmSQVVxkbYqkkQzp90yEBLY03r 5uouDOuX6Ahp9b/sFmNiwltWuEPrziKNa8oYlRFtQDvaqOpixTAkhzlgavpN+Wv3t19z dH1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=IDYCLhWV87utWnNjgs8u5tSBkFByfx+bTAMTNAsvBYE=; b=xNRzMa3wbtFcB9iqKkC2HPw6YUzgjm3Eb6OkFNw/8OJ5SGrAAqUFp8Uj9ToOmOZhZB z5QDKYT1QuwoAzgERgwOA3V+LLxKnUQfpOemRU9FkRy5xO4IcICngu9CyojhP8cloPi5 7H2elCA6oStnue8wk54vuTq/rt+C5nCKX2P+/PD8PdgokrU7NBAIAXbj66Q9XWgg9uM0 bhTn+PbAJmWz/0mEWTa/eBY+Y+1ZyY98e/1rQlnJnzuvH6WHNl1G0dlkcoBJgeVa4E7G l8rMKENqWqMsmjFuE3kxx4ux/Gp2D/iEBO/i9X5NnueWkz+WSDJwqJ68u5ng9kFglDaq JdlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t14-20020a17090aae0e00b00212d06b4743si967313pjq.34.2022.12.07.01.24.37; Wed, 07 Dec 2022 01:24:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230148AbiLGJNv (ORCPT + 99 others); Wed, 7 Dec 2022 04:13:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230143AbiLGJNG (ORCPT ); Wed, 7 Dec 2022 04:13:06 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AB381F61D; Wed, 7 Dec 2022 01:13:04 -0800 (PST) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.1.0) id 4e8274c1484625d8; Wed, 7 Dec 2022 10:13:03 +0100 Received: from kreacher.localnet (unknown [213.134.169.108]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 64ECE780872; Wed, 7 Dec 2022 10:13:02 +0100 (CET) Authentication-Results: v370.home.net.pl; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: v370.home.net.pl; spf=fail smtp.mailfrom=rjwysocki.net From: "Rafael J. Wysocki" To: Jiri Kosina , Bastien Nocera Cc: Filipe =?iso-8859-1?q?La=EDns?= , Benjamin Tissoires , linux-input@vger.kernel.org, LKML , "Rafael J. Wysocki" , Thorsten Leemhuis Subject: [PATCH v1 2/2] HID: logitech-hidpp: Add Bluetooth Mouse M336/M337/M535 to unhandled_hidpp_devices[] Date: Wed, 07 Dec 2022 10:12:39 +0100 Message-ID: <2283816.ElGaqSPkdT@kreacher> In-Reply-To: <5647715.DvuYhMxLoT@kreacher> References: <2262737.ElGaqSPkdT@kreacher> <5647715.DvuYhMxLoT@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 213.134.169.108 X-CLIENT-HOSTNAME: 213.134.169.108 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrudekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppedvudefrddufeegrdduieelrddutdeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudeiledruddtkedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepkedprhgtphhtthhopehjihhkohhssehkvghrnhgvlhdrohhrghdprhgtphhtthhopehhrgguvghssheshhgruggvshhsrdhnvghtpdhrtghpthhtoheplhgrihhnshesrhhishgvuhhprdhnvghtpdhrtghpthhtohepsggvnhhjrghmihhnrdhtihhsshhoihhrvghssehrvgguhhgrthdrtghomhdprhgtphhtthhopehlihhnuhigqdhinhhpuhhtsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhgrfhgrvghlsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehrvghgrhgvshhsihhonhhssehlvggvmhhhuhhishdrihhnfhho X-DCC--Metrics: v370.home.net.pl 1024; Body=8 Fuz1=8 Fuz2=8 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751546690821607345?= X-GMAIL-MSGID: =?utf-8?q?1751546690821607345?= From: Rafael J. Wysocki Evidently, Logitech Bluetooth Mouse M336/M337/M535 (0xb016) does not work when HID++ is enabled for it, so add it to the list of devices that are not handled by logitech-hidpp. Fixes: 532223c8ac57 ("HID: logitech-hidpp: Enable HID++ for all the Logitech Bluetooth devices") Signed-off-by: Rafael J. Wysocki --- drivers/hid/hid-logitech-hidpp.c | 1 + 1 file changed, 1 insertion(+) Index: linux-pm/drivers/hid/hid-logitech-hidpp.c =================================================================== --- linux-pm.orig/drivers/hid/hid-logitech-hidpp.c +++ linux-pm/drivers/hid/hid-logitech-hidpp.c @@ -4274,6 +4274,7 @@ static const struct hid_device_id unhand { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) }, /* Handled in hid-generic */ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DINOVO_EDGE_KBD) }, + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb016) }, {} };