Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 115794
b: refs/heads/master
c: 49e7cc8
h: refs/heads/master
v: v3
  • Loading branch information
Sarah Sharp authored and Greg Kroah-Hartman committed Oct 17, 2008
1 parent 6f94f41 commit 8d0d40c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eafe5b99f2135488b21cf17a262c54997c44f784
refs/heads/master: 49e7cc84a86784ef2ab4e651f1824093be8f5b2b
16 changes: 16 additions & 0 deletions trunk/Documentation/ABI/testing/sysfs-bus-usb
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,19 @@ Description:
Users:
PowerTOP <power@bughost.org>
http://www.lesswatts.org/projects/powertop/

What: /sys/bus/usb/device/<busnum>-<devnum>...:<config num>-<interface num>/supports_autosuspend
Date: January 2008
KernelVersion: 2.6.27
Contact: Sarah Sharp <sarah.a.sharp@intel.com>
Description:
When read, this file returns 1 if the interface driver
for this interface supports autosuspend. It also
returns 1 if no driver has claimed this interface, as an
unclaimed interface will not stop the device from being
autosuspended if all other interface drivers are idle.
The file returns 0 if autosuspend support has not been
added to the driver.
Users:
USB PM tool
git://git.moblin.org/users/sarah/usb-pm-tool/
24 changes: 24 additions & 0 deletions trunk/drivers/usb/core/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,29 @@ static ssize_t show_modalias(struct device *dev,
}
static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL);

static ssize_t show_supports_autosuspend(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct usb_interface *intf;
struct usb_device *udev;
int ret;

intf = to_usb_interface(dev);
udev = interface_to_usbdev(intf);

usb_lock_device(udev);
/* Devices will be autosuspended even when an interface isn't claimed */
if (!intf->dev.driver ||
to_usb_driver(intf->dev.driver)->supports_autosuspend)
ret = sprintf(buf, "%u\n", 1);
else
ret = sprintf(buf, "%u\n", 0);
usb_unlock_device(udev);

return ret;
}
static DEVICE_ATTR(supports_autosuspend, S_IRUGO, show_supports_autosuspend, NULL);

static struct attribute *intf_attrs[] = {
&dev_attr_bInterfaceNumber.attr,
&dev_attr_bAlternateSetting.attr,
Expand All @@ -751,6 +774,7 @@ static struct attribute *intf_attrs[] = {
&dev_attr_bInterfaceSubClass.attr,
&dev_attr_bInterfaceProtocol.attr,
&dev_attr_modalias.attr,
&dev_attr_supports_autosuspend.attr,
NULL,
};
static struct attribute_group intf_attr_grp = {
Expand Down

0 comments on commit 8d0d40c

Please sign in to comment.