lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 15 Sep 2011 10:03:11 -0700
From:	Sameer Nanda <snanda@...omium.org>
To:	stern@...land.harvard.edu, gregkh@...e.de
Cc:	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	Sameer Nanda <snanda@...omium.org>,
	Vincent Palatin <vpalatin@...omium.org>, olofj@...omium.org
Subject: RFC: Enable wakeup for intermediate USB bridge devices

This is a follow-up from the patch I sent earlier enabling wakeup by
default in the ehci-pci driver.  That thread is here:
http://marc.info/?l=linux-usb&m=131595571619689&w=2

The current wake policy is to enable wake by default for a small set
of devices that the users expect (like keyboards, power buttons and
maybe LAN interfaces).  An example check of this can be seen in
usbhid_start where wakeup is enabled only if the interface subclass is
USB_INTERFACE_SUBCLASS_BOOT and protocol is
USB_INTERFACE_PROTOCOL_KEYBOARD.

However, this doesn't quite work out of the box today since the USB
host controllers that these devices connect to do not enable wakeup by
default.

The proposal is to enable wakeup by default on the intermediate bridge
devices such as ehci-pci and ohci-hcd.  This allows wake from USB
keyboard to work by default.  For non-keyboard devices, the user will
still need to explicitly enable them as a wakesources so there is no
change in the device wakeup policy from what is in place currently for
those devices.

Below is an example patch that enables wakeup for the ehci-pci bridge
device.  I can spin up a similar patch for the ohci-hcd also,
if there is interest in moving this forward.

=============

If the PORTWAK register is implemented and at least one of the physical
ports is enabled for wakeup, enable wakeup for the ehci-pci device.

Signed-off-by: Sameer Nanda <snanda@...omium.org>
---
 drivers/usb/host/ehci-pci.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 1102ce6..ce6f784 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -285,6 +285,16 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
                      dev_warn(&pdev->dev, "Enabling legacy PCI PM\n");
                      device_set_wakeup_capable(&pdev->dev, 1);
              }
+       } else {
+               u16     port_wake;
+
+               pci_read_config_word(pdev, 0x62, &port_wake);
+
+               /* If PORTWAK register is implemented and at least one USB
+                * port is enabled for wakeup, enable wakeup.
+                */
+               if (port_wake & 0x0001 && port_wake & 0xfffe)
+                       device_set_wakeup_enable(&pdev->dev, 1);
      }

 #ifdef CONFIG_USB_SUSPEND
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ