public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ryan <ryanzhou54@gmail.com>
To: jikos@kernel.org
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, ryan <ryanzhou54@gmail.com>
Subject: [PATCH] hid: usbhid: Enable remote wake-up based on device configuration
Date: Thu, 11 Jul 2024 07:16:06 +0800	[thread overview]
Message-ID: <20240710231606.3029-1-ryanzhou54@gmail.com> (raw)

According to the USB protocol, the host should automatically
adapt the remote wake-up function based on the configuration
descriptor reported by the device, rather than only the default
keyboard support. Therefore, it's necessary to support other hid
devices, such as digital headsets,mice,etc.

Signed-off-by: ryan <ryanzhou54@gmail.com>
---
 drivers/hid/usbhid/hid-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index a90ed2ceae84..d2901ad9a871 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1179,16 +1179,16 @@ static int usbhid_start(struct hid_device *hid)
 	/* Some keyboards don't work until their LEDs have been set.
 	 * Since BIOSes do set the LEDs, it must be safe for any device
 	 * that supports the keyboard boot protocol.
-	 * In addition, enable remote wakeup by default for all keyboard
-	 * devices supporting the boot protocol.
 	 */
 	if (interface->desc.bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT &&
 			interface->desc.bInterfaceProtocol ==
 				USB_INTERFACE_PROTOCOL_KEYBOARD) {
 		usbhid_set_leds(hid);
-		device_set_wakeup_enable(&dev->dev, 1);
 	}
 
+	if (dev->actconfig->desc.bmAttributes & USB_CONFIG_ATT_WAKEUP)
+		device_set_wakeup_enable(&dev->dev, 1);
+
 	mutex_unlock(&usbhid->mutex);
 	return 0;
 
-- 
2.17.1


             reply	other threads:[~2024-07-10 23:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-10 23:16 ryan [this message]
2024-07-11  1:47 ` [PATCH] hid: usbhid: Enable remote wake-up based on device configuration Alan Stern
2024-07-11  7:41   ` Greg KH
2024-07-15 15:36     ` ryan zhou
2024-07-15 15:43       ` Greg KH
2024-07-15 17:45       ` Alan Stern

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=20240710231606.3029-1-ryanzhou54@gmail.com \
    --to=ryanzhou54@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jikos@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