lkml.org 
[lkml]   [2023]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] HID: usbhid: enable remote wakeup for mice
From
Dear Sergei:

On 2/22/2023 4:59 PM, Sergei Shtylyov wrote:
> Hello!
>
> On 2/22/23 4:39 AM, Michael Wu wrote:
>
>> 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 <michael@allwinnertech.com>
>> ---
>> 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);
>> }
>>
>> + /**
>

> The kernel-doc comments should not be used here in the function body.

We will remove the NOTE comments.

>
>> + * 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

--
Regards,
Michael Wu

\
 
 \ /
  Last update: 2023-03-27 00:33    [W:0.145 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site