[usbhid] identifying a particular usbhid device as wakeup reason?

From: Rajat Jain
Date: Thu Oct 12 2017 - 20:39:40 EST


Hi usbhid folks,

I'd like to identify after a wakeup from suspend, that my USB HID
keyboard was used to wake up the system.

I'm trying to understand why don't I see "wakeup_count" increase for
my USB keyboard or trackpad in /sys/kernel/debug/wakeup_sources, when
I indeed woke up the system using the keyboard? I do not see
wakeup_count increased for any device (including the underlying usb
device for usbhid) when I wake using the keyboard.

I do see that the wakeup_count increases for other devices when I wake
using them (e.g. wifi on a PCI bus, or bluetooth controller on USB
bus).

My questions:

1) How can I go about fixing this problem?

2) Is it because the usbhid driver does not call pm_wakeup_event() on
wake? In retrospect, is it because the usbhid driver cannot tell that
its key presses indeed woke up the system (as opposite to if the
system was already up)?

Thanks,

Rajat