wakeup

usb wakeup

开启鼠标键盘唤醒

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
static int usbhid_start(struct hid_device *hid)
{
struct usb_interface *intf = to_usb_interface(hid->dev.parent);
struct usb_host_interface *interface = intf->cur_altsetting;
struct usb_device *dev = interface_to_usbdev(intf);
struct usbhid_device *usbhid = hid->driver_data;
unsigned int n, insize = 0;
int ret;

mutex_lock(&usbhid->mutex);
...
...
/* 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) {
if (interface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_KEYBOARD) { //键盘唤醒
usbhid_set_leds(hid);
device_set_wakeup_enable(&dev->dev, 1);
}
else if (interface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE) { //鼠标唤醒
device_set_wakeup_enable(&dev->dev, 1);
}
}
...
...
}

wakeup
https://tomwithkernel.github.io/pm/wakeup/
作者
Tom
发布于
2025年5月8日
更新于
2025年5月8日
许可协议