power: prevent enabling wakeup on USB hubs

Enabling wakeups on USB hubs, in particular the root hub, can cause certain
systems to fail to suspend. The initial implementation of FindParentWithSysattr
assumes that all USB input devices will expose a power/wakeup sysattr in the
sysfs subtree for that device. But that isn't always the case, so terminate the
search once the root node of the subtree for that device is encountered
(devtype == "usb_device").

BUG=chromium:421673
TEST=ensure powerd_dbus_suspend succeeds after plugging in a USB headset that
doesn't support remote wakeups. Also ensure wakeups via other external inputs
(keyboards, mice) work.

Reviewed-on: https://chromium-review.googlesource.com/230304
Reviewed-by: Benson Leung <bleung@chromium.org>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>

Conflicts:
	power_manager/powerd/policy/wakeup_controller.cc

Change-Id: I517078195408c6be68576f31017d5ec660ec1850
Reviewed-on: https://chromium-review.googlesource.com/230547
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>
6 files changed