Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6117DC636D7 for ; Thu, 23 Feb 2023 11:18:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233809AbjBWLSY (ORCPT ); Thu, 23 Feb 2023 06:18:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbjBWLSV (ORCPT ); Thu, 23 Feb 2023 06:18:21 -0500 Received: from out28-49.mail.aliyun.com (out28-49.mail.aliyun.com [115.124.28.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08AC9166C3; Thu, 23 Feb 2023 03:18:16 -0800 (PST) X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07649013|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_regular_dialog|0.0871468-0.0143109-0.898542;FP=0|0|0|0|0|-1|-1|-1;HT=ay29a033018047203;MF=michael@allwinnertech.com;NM=1;PH=DS;RN=8;RT=8;SR=0;TI=SMTPD_---.RUpMKkG_1677151093; Received: from 192.168.220.144(mailfrom:michael@allwinnertech.com fp:SMTPD_---.RUpMKkG_1677151093) by smtp.aliyun-inc.com; Thu, 23 Feb 2023 19:18:14 +0800 Message-ID: <9bf4463c-6541-a6cb-9bbc-6d070118509a@allwinnertech.com> Date: Thu, 23 Feb 2023 19:18:12 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH] HID: usbhid: enable remote wakeup for mice Content-Language: en-US To: Greg KH Cc: jikos@kernel.org, benjamin.tissoires@redhat.com, linux-usb@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, mario.limonciello@amd.com, richard.gong@amd.com References: <20230222013944.31095-1-michael@allwinnertech.com> From: Michael Wu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear Greg, On 2/22/2023 2:04 PM, Greg KH wrote: > On Wed, Feb 22, 2023 at 09:39:44AM +0800, Michael Wu wrote: >> This patch fixes a problem that USB mouse can't wake up the device that >> enters standby. > > This not a problem, it is that way by design. I got it, maybe it's a little problem to say that. > >> At present, the kernel only checks whether certain USB manufacturers >> support wake-up, which will easily cause inconvenience to the >> development work of other manufacturers and add unnecessary work to the >> maintenance of kernel. >> >> The USB protocol supports judging whether a usb supports the wake-up >> function, so it should be more reasonable to add a wake-up source by >> directly checking the settings from the USB protocol. > > But you do not do that in this patch, why not? I just want to explain the background of my patch, to prove we could use a similar way to avoid such a "disturbing" situation. To reduce the influence, my patch enables remote wakeup for USB mouse devices refer to what keyboard do. > >> There was a similar issue on the keyboard before, which was fixed by >> this patch (3d61510f4eca), but now the problem happened on the mouse. >> This patch uses a similar idea to fix this problem. >> >> Signed-off-by: Michael Wu >> --- >> drivers/hid/usbhid/hid-core.c | 8 ++++++++ >> drivers/hid/usbhid/usbmouse.c | 1 + >> 2 files changed, 9 insertions(+) >> >> diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c >> index be4c731aaa65..d3a6755cca09 100644 >> --- a/drivers/hid/usbhid/hid-core.c >> +++ b/drivers/hid/usbhid/hid-core.c >> @@ -1189,6 +1189,14 @@ static int usbhid_start(struct hid_device *hid) >> device_set_wakeup_enable(&dev->dev, 1); >> } >> >> + /** >> + * NOTE: enable remote wakeup by default for all mouse devices >> + * supporting the boot protocol. >> + */ >> + if (interface->desc.bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT && >> + interface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE) >> + device_set_wakeup_enable(&dev->dev, 1); > > Sorry, but we can not take this unless it is proven that this will work > properly for all of these devices. Other operating systems do not do > this last I checked, so there will be problems. As Mario Limonciello says, they has confirmed that the Microsoft Windows does set a similar policy as well. Can we talk about more in this topic: why does Linux not support it? Of course, if you have other great idea, I will appreciate that if we can have some further discussion. > > thanks, > > greg k-h -- Regards, Michael Wu