public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: huanglei814 <huanglei814@163.com>
To: jikos@kernel.org, bentiss@kernel.org
Cc: linux-usb@vger.kernel.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org, huanglei <huanglei@kylinos.cn>
Subject: [PATCH] HID: usbhid: enable remote wakeup for mouse
Date: Wed, 22 May 2024 17:22:57 +0800	[thread overview]
Message-ID: <20240522092257.19373-1-huanglei814@163.com> (raw)

From: huanglei <huanglei@kylinos.cn>

This patch enables remote wakeup by default for USB mouse
devices.  Mouse can used to be wakeup devices, but the correct
place to enable it depends on the device's bus; no single
approach will work for all mouse devices.  In particular, this
covers only USB mouse (and then only those supporting the boot
protocol).

Signed-off-by: huanglei <huanglei@kylinos.cn>
---
 drivers/hid/usbhid/hid-core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index a90ed2ceae84..7ed3ab36426d 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1189,6 +1189,15 @@ static int usbhid_start(struct hid_device *hid)
 		device_set_wakeup_enable(&dev->dev, 1);
 	}
 
+	/* 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;
 
-- 
2.17.1


             reply	other threads:[~2024-05-22  9:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22  9:22 huanglei814 [this message]
2024-05-22 10:00 ` [PATCH] HID: usbhid: enable remote wakeup for mouse Oliver Neukum
2024-05-24  3:14   ` huanglei
2024-05-22 11:23 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2021-05-17  6:01 Qiang Ma
2021-05-17  8:31 ` Oliver Neukum
2021-05-17 13:32   ` Alan Stern
2021-05-17  8:58 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240522092257.19373-1-huanglei814@163.com \
    --to=huanglei814@163.com \
    --cc=bentiss@kernel.org \
    --cc=huanglei@kylinos.cn \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox