HID: usbhid: enable remote wakeup for mice
PATCH 1/1 HID: usbhid: enable remote wakeup for mice
This patch fixes a problem that USB mouse can't wake up the device that enters standby.
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.
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.
--- drivers/hid/usbhid/hid-core.c | 8 ++++++++ drivers/hid/usbhid/usbmouse.c | 1 + 2 files changed, 9 insertions(+)
drivers/hid/usbhid/hid-core.c +8 -0
@@ -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 ); +mutex_unlock (&usbhid->mutex);return 0 ;
drivers/hid/usbhid/usbmouse.c +1 -0
@@ -188,6 +188,7 @@ static int usb_mouse_probe(struct usb_interface *intf, const struct usb_device_i goto fail3;usb_set_intfdata (intf, mouse); +device_set_wakeup_enable (&dev->dev,1 );return 0 ; fail3:
Signature · 1 line
2.29.0
Greg KH
maintainerQuoted 2 lines · Michael Wu
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.
Quoted 8 lines
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?
Quoted 15 lines
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 <[email protected]>--- drivers/hid/usbhid/hid-core.c | 8 ++++++++ drivers/hid/usbhid/usbmouse.c | 1 + 2 files changed, 9 insertions(+)drivers/hid/usbhid/hid-core.c +0
-0
drivers/hid/usbhid/hid-core.c static int usbhid_start(struct hid_device *hid) · line 1198
Quoted 10 lines
drivers/hid/usbhid/hid-core.c +7
-0@@ -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.
thanks,
greg k-h
+Richard
Quoted 47 lines · Greg KH
Quoted 2 lines · Michael Wu
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.
Quoted 8 lines
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?
Quoted 15 lines
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 <[email protected]>--- drivers/hid/usbhid/hid-core.c | 8 ++++++++ drivers/hid/usbhid/usbmouse.c | 1 + 2 files changed, 9 insertions(+)drivers/hid/usbhid/hid-core.c +0
-0drivers/hid/usbhid/hid-core.c static int usbhid_start(struct hid_device *hid) · line 1198
Quoted 10 lines
drivers/hid/usbhid/hid-core.c +7
-0@@ -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.
Quoted 4 lines
thanks,
greg k-h
Richard and I both sent out relatively similar patches in the past, but they never went anywhere. We did confirm that Windows does set a similar policy as well though, which is what prompted us to attempt this.
As there is more interest again maybe we can revive that discussion and merge together some ideas from the sets of patches.
Previous submissions:
v4:
https://lore.kernel.org/linux-usb/[email protected]/
v3:
https://lore.kernel.org/linux-usb/[email protected]/
Quoted 1 line · Mario
Richard and I both sent out relatively similar patches in the past, but they never went anywhere.
The problem here is that the default will never satisfy a great majority. just a majority. So if we admit that there is no optimal solution, why not pick the tested, that is, current solution, as long as it does least?
Quoted 3 lines
We did confirm that Windows does set a similar policy as well though, which is what prompted us to attempt this.
As there is more interest again maybe we can revive that discussion and merge together some ideas from the sets of patches.
Well, the most obvious question, as this can also be done with a udev rule, is, what are the risks of a change?
Quoted 4 lines
Previous submissions:
This one at least restricts it to some cases. And as much as it pains me, we need to ask whether there are risks in not emulating Windows.
And on the other hand, what happens if we do this. Are you sure, for example, that you do not break use cases for S4 with this change?
If a laptop goes into S4 because power is too low, we really do not want it to wake up just because somebody accidentally hits a mouse button.
Regards
Oliver
Dear Greg,
Quoted 5 lines · Greg KH
Quoted 2 lines · Michael Wu
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.
Quoted 11 lines
Quoted 9 lines
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.
Quoted 19 lines
Quoted 19 lines
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 <[email protected]>--- drivers/hid/usbhid/hid-core.c | 8 ++++++++ drivers/hid/usbhid/usbmouse.c | 1 + 2 files changed, 9 insertions(+)drivers/hid/usbhid/hid-core.c +0
-0@@ -1189,6 +1189,14 @@ static int usbhid_start(struct hid_device *hid)device_set_wakeup_enable (&dev->dev,1 ); }
Quoted 11 lines
drivers/hid/usbhid/hid-core.c static int usbhid_start(struct hid_device *hid) · line 1198
Quoted 7 lines
drivers/hid/usbhid/hid-core.c +7
-0+/** +* 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.
Quoted 4 lines
thanks,
greg k-h
Signature · 2 lines
Regards, Michael Wu
Greg KH
maintainerQuoted 10 lines · Michael Wu
Dear Greg,
Quoted 5 lines · Greg KH
Quoted 2 lines · Michael Wu
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.
It is.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
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.
Quoted 6 lines
Quoted 1 line
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.
Keyboards are not mice :)
Quoted 29 lines
Quoted 20 lines
Quoted 20 lines
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 <[email protected]>--- drivers/hid/usbhid/hid-core.c | 8 ++++++++ drivers/hid/usbhid/usbmouse.c | 1 + 2 files changed, 9 insertions(+)drivers/hid/usbhid/hid-core.c +3
-0@@ -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. Quoted 8 lines
drivers/hid/usbhid/hid-core.c static int usbhid_start(struct hid_device *hid) · line 1198
Quoted 4 lines
drivers/hid/usbhid/hid-core.c +4
-0+*/ +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.
Quoted 5 lines
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.
You need to provide some sort of "proof" that this has been heavily tested on a huge range of devices before we can change this.
When this was first implemented, Windows did not work this way and many devices on the market were broken if this were to be enabled. I'm sure the mailing list archives from 20+ years ago have many more details, please dig around there for specifics.
If you feel strongly that this is the way forward, why not do it in userspace today for your systems as part of testing this out? It should not require a kernel change, right?
thanks,
greg k-h
Quoted 7 lines · Greg KH
Quoted 4 lines
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.Keyboards are not mice :)
OK, let me explain, why I never proposed switching on autosuspend for mice or using them as a system wakeup source. The reasons are very similar.
Basically the standard gives us no way to ask a device what constitutes a wakeup event for it. We just get the blanket statement of support or no support.
For runtime PM I would want my mouse to generate a remote wakeup whenever a button is pressed or the mouse is moved. Under this premise runtime PM with a mouse works wonderfully. Testing that, however, is a challenge.
It turns out that mice that claim that they support remote wakeup by and large deactivate their LED/laser when you send them into suspension. Hence they react only to buttons being pressed or mouse wheels moved.
As a system wakeup source a mouse that generates events when it is moved, however, would make the system unsuspendable, whenever even a bit of vibration is acting on the system.
And as S4 is used in many setups to prevent an uncontrolled shutdown at low power, this must work.
I suspect that most, but _not_ _all_ mice, are designed for use with a system that ties power management to the screen saver. That is a mode of operation that due to the lack of coupling between GUI and kernel is hard to copy.
Frankly given these constraints the only default safe in every case seems to me to leave the kernel's default at off and put the work into udev's hwdb. Not that that is a good solution, merely the best I can come up with.
Regards
Oliver
[AMD Official Use Only - General]
Quoted 40 lines
-----Original Message-----
From: Oliver Neukum <[email protected]>
Sent: Thursday, February 23, 2023 06:02
To: Greg KH <[email protected]>; Michael Wu <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; linux- [email protected]; Limonciello, Mario <[email protected]>; Gong, Richard <[email protected]>
Subject: Re: [PATCH] HID: usbhid: enable remote wakeup for miceQuoted 1 line · Greg KH
Quoted 1 line
I just want to explain the background of my patch, to prove we could use
a
Quoted 2 lines
Quoted 2 lines
similar way to avoid such a "disturbing" situation. To reduce the influence, my patch enables remote wakeup for USB
mouse
Quoted 4 lines
Quoted 1 line
devices refer to what keyboard do.
Keyboards are not mice :)
OK, let me explain, why I never proposed switching on autosuspend for mice or using them as a system wakeup source. The reasons are very similar.
Basically the standard gives us no way to ask a device what constitutes a wakeup event for it. We just get the blanket statement of support or no support.
For runtime PM I would want my mouse to generate a remote wakeup whenever a button is pressed or the mouse is moved. Under this premise runtime PM with a mouse works wonderfully. Testing that, however, is a challenge.
It turns out that mice that claim that they support remote wakeup by and large deactivate their LED/laser when you send them into suspension. Hence they react only to buttons being pressed or mouse wheels moved.
Quoted 6 lines
As a system wakeup source a mouse that generates events when it is moved, however, would make the system unsuspendable, whenever even
a bit of vibration is acting on the system.
And as S4 is used in many setups to prevent an uncontrolled shutdown at low power, this must work.
At least in my version of the series, this is part of the reason that it was only intended to be used with s2idle.
The kernel driver is well aware of what power state you're in the suspend callback (pm_suspend_target_state).
What about if we agreed to treat this one special by examining that?
If the sysfs is set to "enabled"
* During suspend if your target is s2idle -> program it
* During suspend if your target is mem -> disable it
* During suspend if your target is hibernate -> disable it
With that type of policy on how to handle the suspend call in place perhaps we could set it to enabled by default?
Quoted 6 lines
I suspect that most, but _not_ _all_ mice, are designed for use with a system that ties power management to the screen saver. That is a mode of operation that due to the lack of coupling between GUI and kernel is hard to copy.
Quoted 7 lines
Frankly given these constraints the only default safe in every case seems to me to leave the kernel's default at off and put the work into udev's hwdb. Not that that is a good solution, merely the best I can come up with.
Regards
Oliver
Turning on "autosuspend" for USB mice makes them behave pretty similarly to how they work when they're marked for remote wakeup.
On some mice the lasers turn off, and they only wakeup when you press a button or roll a wheel.
On 23.02.23 20:41, Limonciello, Mario wrote:
Hi,
Quoted 9 lines
Quoted 6 lines
As a system wakeup source a mouse that generates events when it is moved, however, would make the system unsuspendable, whenever even
a bit of vibration is acting on the system.
And as S4 is used in many setups to prevent an uncontrolled shutdown at low power, this must work.At least in my version of the series, this is part of the reason that it was only intended to be used with s2idle.
Yes, that is sensible. If these patches are to be taken at all, that will be a necessary condition to meet. But it is not sufficient.
Quoted 6 lines
The kernel driver is well aware of what power state you're in the suspend callback (
pm_suspend_target_state).What about if we agreed to treat this one special by examining that?
If the sysfs is set to "enabled"
If user space needs to manipulate sysfs at all, we can have user space tell kernel space exactly what to do. Hence I see no point in conditional interpretations values in sysfs at that point.
We are discussing the kernel's default here.
Quoted 3 lines
* During suspend if your target is s2idle -> program it
* During suspend if your target is mem -> disable it
* During suspend if your target is hibernate -> disable it
To my mind these defaults make sense.
However, do they make much more sense than what we are doing now?
Quoted 2 lines
With that type of policy on how to handle the suspend call in place perhaps we could set it to enabled by default?
It pains me to say, but I am afraid in that regard the only decision that will not cause ugly surprises is to follow Windows. Yet, what is wrong about the current defaults?
Quoted 2 lines
Turning on "autosuspend" for USB mice makes them behave pretty similarly to how they work when they're marked for remote wakeup.
Because it is exactly the same mechanism.
Quoted 2 lines
On some mice the lasers turn off, and they only wakeup when you press a button or roll a wheel.
Yes. And _some_ is the exact problem. If we could tell, _how_ mice react, this discussion were unnecessary.
Regards
Oliver
[Public]
Quoted 22 lines
-----Original Message-----
From: Oliver Neukum <[email protected]>
Sent: Tuesday, February 28, 2023 03:03
To: Limonciello, Mario <[email protected]>; Oliver Neukum <[email protected]>; Greg KH <[email protected]>; Michael Wu <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; linux- [email protected]; Gong, Richard <[email protected]>
Subject: Re: [PATCH] HID: usbhid: enable remote wakeup for miceOn 23.02.23 20:41, Limonciello, Mario wrote:
Hi,
Quoted 7 lines
Quoted 6 lines
As a system wakeup source a mouse that generates events when it is moved, however, would make the system unsuspendable, whenever even
a bit of vibration is acting on the system.
And as S4 is used in many setups to prevent an uncontrolled shutdown at low power, this must work.
Quoted 5 lines
Quoted 2 lines
At least in my version of the series, this is part of the reason that it was only intended to be used with s2idle.
Yes, that is sensible. If these patches are to be taken at all, that will be a necessary condition to meet. But it is not sufficient.
Ack.
Quoted 6 lines
Quoted 6 lines
The kernel driver is well aware of what power state you're in the suspend callback (
pm_suspend_target_state).What about if we agreed to treat this one special by examining that?
Quoted 7 lines
Quoted 1 line
If the sysfs is set to "enabled"
If user space needs to manipulate sysfs at all, we can have user space tell kernel space exactly what to do. Hence I see no point in conditional interpretations values in sysfs at that point.
We are discussing the kernel's default here.
Right, I was meaning if the kernel defaulted to enabled or if userspace changed it to enabled to follow this behavior.
Quoted 7 lines
Quoted 4 lines
* During suspend if your target is s2idle -> program it
* During suspend if your target is mem -> disable it
* During suspend if your target is hibernate -> disable itTo my mind these defaults make sense.
However, do they make much more sense than what we are doing now?
If you're talking about purely "policy default", I think it makes more sense.
Userspace can still change it, and it better aligns with what Windows does out of the box.
Quoted 7 lines
Quoted 3 lines
With that type of policy on how to handle the suspend call in place perhaps we could set it to enabled by default?
It pains me to say, but I am afraid in that regard the only decision that will not cause ugly surprises is to follow Windows. Yet, what is wrong about the current defaults?
I still keep getting inquiries about this where teams that work on the same hardware for Windows and Linux complain about this difference during their testing.
I keep educating them to change it in sysfs (or to use a udev rule), but you have to question if you keep getting something asked about policy over and over if it's actually the right policy.
Greg KH
maintainerQuoted 7 lines · Mario
I still keep getting inquiries about this where teams that work on the same hardware for Windows and Linux complain about this difference during their testing.
I keep educating them to change it in sysfs (or to use a udev rule), but you have to question if you keep getting something asked about policy over and over if it's actually the right policy.
Why not complain to the Windows team to get them to change their policy back as they are the ones that changed it over time and are not backwards-compatible with older systems?
:)
thanks,
greg k-h
[AMD Official Use Only - General]
Quoted 16 lines
-----Original Message-----
From: Greg KH <[email protected]>
Sent: Tuesday, February 28, 2023 13:05
To: Limonciello, Mario <[email protected]>
Cc: Oliver Neukum <[email protected]>; Michael Wu <[email protected]>; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; Gong, Richard <[email protected]>
Subject: Re: [PATCH] HID: usbhid: enable remote wakeup for miceQuoted 4 lines · Mario
I still keep getting inquiries about this where teams that work on the same hardware for Windows and Linux complain about this difference during their testing.
Quoted 8 lines
Quoted 3 lines
I keep educating them to change it in sysfs (or to use a udev rule), but you have to question if you keep getting something asked about policy over and over if it's actually the right policy.
Why not complain to the Windows team to get them to change their policy back as they are the ones that changed it over time and are not backwards-compatible with older systems?
Heh.
I don't think that's actually true though - Modern Standby is relatively new. Picking new policies tied to that shouldn't break backwards compatibility.
Dear Greg:
Quoted 23 lines · Greg KH
Quoted 10 lines · Michael Wu
Dear Greg,
Quoted 5 lines · Greg KH
Quoted 2 lines · Michael Wu
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.
It is.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
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.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
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.Keyboards are not mice :)
Sorry, What I wanted to say is that we registered the mouse wake-up source by referring to the practice of the keyboard.
Quoted 39 lines
Quoted 30 lines
Quoted 21 lines
Quoted 21 lines
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 <[email protected]>--- drivers/hid/usbhid/hid-core.c | 8 ++++++++ drivers/hid/usbhid/usbmouse.c | 1 + 2 files changed, 9 insertions(+)drivers/hid/usbhid/hid-core.c +3
-0@@ -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. Quoted 8 lines
drivers/hid/usbhid/hid-core.c static int usbhid_start(struct hid_device *hid) · line 1198
Quoted 4 lines
drivers/hid/usbhid/hid-core.c +4
-0+*/ +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.
Quoted 5 lines
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.You need to provide some sort of "proof" that this has been heavily tested on a huge range of devices before we can change this.
Quoted 8 lines
When this was first implemented, Windows did not work this way and many devices on the market were broken if this were to be enabled. I'm sure the mailing list archives from 20+ years ago have many more details, please dig around there for specifics.
If you feel strongly that this is the way forward, why not do it in userspace today for your systems as part of testing this out? It should not require a kernel change, right?
Thanks for your advises. I'm clear now. I will try it in userspace.
Quoted 4 lines
thanks,
greg k-h
Signature · 2 lines
Regards, Michael Wu
Hello!
Quoted 27 lines · Michael Wu
This patch fixes a problem that USB mouse can't wake up the device that enters standby.
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.
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 <[email protected]>--- drivers/hid/usbhid/hid-core.c | 8 ++++++++ drivers/hid/usbhid/usbmouse.c | 1 + 2 files changed, 9 insertions(+)drivers/hid/usbhid/hid-core.c +0
-0
drivers/hid/usbhid/hid-core.c static int usbhid_start(struct hid_device *hid) · line 1192
Quoted 4 lines
drivers/hid/usbhid/hid-core.c +1
-0@@ -1189,6 +1189,14 @@ static int usbhid_start(struct hid_device *hid)device_set_wakeup_enable (&dev->dev,1 ); } +/**
The kernel-doc comments should not be used here in the function body.
drivers/hid/usbhid/hid-core.c static int usbhid_start(struct hid_device *hid) · line 1202
Quoted 10 lines
drivers/hid/usbhid/hid-core.c +7
-0+* 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 ); +mutex_unlock (&usbhid->mutex);return 0 ;
[...]
MBR, Sergey
Dear Sergei:
Quoted 34 lines · Sergei Shtylyov
Hello!
Quoted 30 lines · Michael Wu
This patch fixes a problem that USB mouse can't wake up the device that enters standby.
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.
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 <[email protected]>--- drivers/hid/usbhid/hid-core.c | 8 ++++++++ drivers/hid/usbhid/usbmouse.c | 1 + 2 files changed, 9 insertions(+)drivers/hid/usbhid/hid-core.c +0
-0@@ -1189,6 +1189,14 @@ static int usbhid_start(struct hid_device *hid)device_set_wakeup_enable (&dev->dev,1 ); }
Quoted 4 lines
drivers/hid/usbhid/hid-core.c static int usbhid_start(struct hid_device *hid) · line 1192
Quoted 1 line
drivers/hid/usbhid/hid-core.c +1
-0+/** The kernel-doc comments should not be used here in the function body.
We will remove the NOTE comments.
Quoted 14 lines
drivers/hid/usbhid/hid-core.c static int usbhid_start(struct hid_device *hid) · line 1202
Quoted 11 lines
drivers/hid/usbhid/hid-core.c +7
-0+* 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 ); +mutex_unlock (&usbhid->mutex);return 0 ;[...]
MBR, Sergey
Signature · 2 lines
Regards, Michael Wu
Quoted 2 lines · Michael Wu
This patch fixes a problem that USB mouse can't wake up the device that enters standby.
Hi,
I am afraid I need to ask you to be a bit more precise here. Are you referring to USB mice being unable to wake up a system, even if you so request via sysfs, or that they won't by default?
Regards
Oliver
Dear Oliver,
Quoted 4 lines · Oliver Neukum
Quoted 2 lines · Michael Wu
This patch fixes a problem that USB mouse can't wake up the device that enters standby.
Quoted 8 lines
Hi,
I am afraid I need to ask you to be a bit more precise here. Are you referring to USB mice being unable to wake up a system, even if you so request via sysfs, or that they won't by default?
Regards
Oliver
Yes. I can't use any USB mouse which supports Remote Wakeup to wake up the system by default.
If I enable the wakeup node in /sys/bus/usb/devices which is disabled by default, the mouse can wakeup the system successfully. Clearly, the only thing I can do is to register the wakeup source for USB Mouse devices.
Signature · 2 lines
Regards, Michael Wu
Quoted 4 lines · Michael Wu
Yes. I can't use any USB mouse which supports Remote Wakeup to wake up the system by default.
If I enable the wakeup node in/sys/bus/usb/deviceswhich is disabled by default, the mouse can wakeup the system successfully. Clearly, the only thing I can do is to register the wakeup source for USB Mouse devices.
Hi,
thank you for answering this. I feel a long discussion coming up, which I would avoid if I could, so it is important that we are clear and do not discuss about a misunderstanding.
Regards
Oliver