* [PATCH] HID: usbhid: set mouse as a wakeup resource @ 2022-04-04 21:45 Richard Gong 2022-04-05 4:59 ` Greg KH 0 siblings, 1 reply; 3+ messages in thread From: Richard Gong @ 2022-04-04 21:45 UTC (permalink / raw) To: jikos, benjamin.tissoires Cc: linux-usb, linux-input, linux-kernel, mario.limonciello, amit.bhutani, richard.gong USB HID transport layer doesn't set mouse as a wakeup resource by default so user can't wake system from s0i3 using wired USB mouse. However, users can wake the same system from s0i3 with the same wired USB mouse on Windows. To work around this wakeup issue on Linux, the user must manually enable wakeup via the following command: echo enabled > /sys/bus/usb/device/*/power/wakeup The mouse is set to wake resource by default to ensure the same behavior across operating systems. Signed-off-by: Richard Gong <richard.gong@amd.com> --- drivers/hid/usbhid/hid-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 54752c85604b..571dded02b3d 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -1183,8 +1183,10 @@ static int usbhid_start(struct hid_device *hid) * devices supporting the boot protocol. */ if (interface->desc.bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT && - interface->desc.bInterfaceProtocol == - USB_INTERFACE_PROTOCOL_KEYBOARD) { + ((interface->desc.bInterfaceProtocol == + USB_INTERFACE_PROTOCOL_KEYBOARD) + || (interface->desc.bInterfaceProtocol == + USB_INTERFACE_PROTOCOL_MOUSE))) { usbhid_set_leds(hid); device_set_wakeup_enable(&dev->dev, 1); } -- 2.25.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: usbhid: set mouse as a wakeup resource 2022-04-04 21:45 [PATCH] HID: usbhid: set mouse as a wakeup resource Richard Gong @ 2022-04-05 4:59 ` Greg KH 2022-04-05 13:45 ` Limonciello, Mario 0 siblings, 1 reply; 3+ messages in thread From: Greg KH @ 2022-04-05 4:59 UTC (permalink / raw) To: Richard Gong Cc: jikos, benjamin.tissoires, linux-usb, linux-input, linux-kernel, mario.limonciello, amit.bhutani On Mon, Apr 04, 2022 at 04:45:57PM -0500, Richard Gong wrote: > USB HID transport layer doesn't set mouse as a wakeup resource by default > so user can't wake system from s0i3 using wired USB mouse. However, users > can wake the same system from s0i3 with the same wired USB mouse > on Windows. Is that because of the huge good/bad list that Windows has for USB mice? Or is it this way now on Windows for _ALL_ USB mice? We have been loath to make this change because not all USB mice could support this, as well as the "wake up a laptop in a backpack that gets the touchpad touched" issue. > > To work around this wakeup issue on Linux, the user must manually enable > wakeup via the following command: > echo enabled > /sys/bus/usb/device/*/power/wakeup > > The mouse is set to wake resource by default to ensure the same behavior > across operating systems. > > Signed-off-by: Richard Gong <richard.gong@amd.com> > --- > drivers/hid/usbhid/hid-core.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c > index 54752c85604b..571dded02b3d 100644 > --- a/drivers/hid/usbhid/hid-core.c > +++ b/drivers/hid/usbhid/hid-core.c > @@ -1183,8 +1183,10 @@ static int usbhid_start(struct hid_device *hid) > * devices supporting the boot protocol. > */ > if (interface->desc.bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT && > - interface->desc.bInterfaceProtocol == > - USB_INTERFACE_PROTOCOL_KEYBOARD) { > + ((interface->desc.bInterfaceProtocol == > + USB_INTERFACE_PROTOCOL_KEYBOARD) > + || (interface->desc.bInterfaceProtocol == > + USB_INTERFACE_PROTOCOL_MOUSE))) { This is a big change, how many different systems and devices did you test it on? What about userspace tools that previously assumed the old behavior? Why change this now 20 years later? What changed to require this now? In short, unless there is a really good reason now to make this change, we shouldn't for all the reasons we never did so in the past. Oh, and proof of loads of testing will be required as well. thanks, greg k-h ^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] HID: usbhid: set mouse as a wakeup resource 2022-04-05 4:59 ` Greg KH @ 2022-04-05 13:45 ` Limonciello, Mario 0 siblings, 0 replies; 3+ messages in thread From: Limonciello, Mario @ 2022-04-05 13:45 UTC (permalink / raw) To: Greg KH, Gong, Richard Cc: jikos@kernel.org, benjamin.tissoires@redhat.com, linux-usb@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Bhutani, Amit [Public] > -----Original Message----- > From: Greg KH <gregkh@linuxfoundation.org> > Sent: Monday, April 4, 2022 23:59 > To: Gong, Richard <Richard.Gong@amd.com> > Cc: jikos@kernel.org; benjamin.tissoires@redhat.com; linux- > usb@vger.kernel.org; linux-input@vger.kernel.org; linux- > kernel@vger.kernel.org; Limonciello, Mario <Mario.Limonciello@amd.com>; > Bhutani, Amit <Amit.Bhutani@amd.com> > Subject: Re: [PATCH] HID: usbhid: set mouse as a wakeup resource > > On Mon, Apr 04, 2022 at 04:45:57PM -0500, Richard Gong wrote: > > USB HID transport layer doesn't set mouse as a wakeup resource by default > > so user can't wake system from s0i3 using wired USB mouse. However, > users > > can wake the same system from s0i3 with the same wired USB mouse > > on Windows. > > Is that because of the huge good/bad list that Windows has for USB mice? > Or is it this way now on Windows for _ALL_ USB mice? > > We have been loath to make this change because not all USB mice could > support this, as well as the "wake up a laptop in a backpack that gets > the touchpad touched" issue. > > > > > To work around this wakeup issue on Linux, the user must manually enable > > wakeup via the following command: > > echo enabled > /sys/bus/usb/device/*/power/wakeup > > > > The mouse is set to wake resource by default to ensure the same behavior > > across operating systems. > > > > Signed-off-by: Richard Gong <richard.gong@amd.com> > > --- > > drivers/hid/usbhid/hid-core.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c > > index 54752c85604b..571dded02b3d 100644 > > --- a/drivers/hid/usbhid/hid-core.c > > +++ b/drivers/hid/usbhid/hid-core.c > > @@ -1183,8 +1183,10 @@ static int usbhid_start(struct hid_device *hid) > > * devices supporting the boot protocol. > > */ > > if (interface->desc.bInterfaceSubClass == > USB_INTERFACE_SUBCLASS_BOOT && > > - interface->desc.bInterfaceProtocol == > > - USB_INTERFACE_PROTOCOL_KEYBOARD) { > > + ((interface->desc.bInterfaceProtocol == > > + USB_INTERFACE_PROTOCOL_KEYBOARD) > > + || (interface->desc.bInterfaceProtocol == > > + USB_INTERFACE_PROTOCOL_MOUSE))) { > > This is a big change, how many different systems and devices did you > test it on? What about userspace tools that previously assumed the old > behavior? > > Why change this now 20 years later? What changed to require this now? > > In short, unless there is a really good reason now to make this change, > we shouldn't for all the reasons we never did so in the past. Oh, and > proof of loads of testing will be required as well. > > thanks, > > greg k-h A number of other drivers have been adding in compatibility for wake sources with Windows to match user expectations even with legacy interfaces. For example i8042 enables keyboard wake when in s2idle mode. So I think what's missing here is to guard this for only the scenarios that matter. Platforms from 20 years ago didn't support Modern Standby in Windows nor s2idle in Linux. This is a very modern feature. I think it needs a check for If (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) This will narrow it down to just supporting this on platforms the last few years and decrease the testing matrix. Thanks, ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-05 20:34 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-04-04 21:45 [PATCH] HID: usbhid: set mouse as a wakeup resource Richard Gong 2022-04-05 4:59 ` Greg KH 2022-04-05 13:45 ` Limonciello, Mario
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox