提交 83f7d958 编写于 作者: A Alan Stern 提交者: Greg Kroah-Hartman

USB: add "busnum" attribute for USB devices

This patch (as903) adds a "busnum" sysfs attribute for USB devices.
Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 6a02c996
...@@ -117,6 +117,16 @@ show_speed(struct device *dev, struct device_attribute *attr, char *buf) ...@@ -117,6 +117,16 @@ show_speed(struct device *dev, struct device_attribute *attr, char *buf)
} }
static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL); static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL);
static ssize_t
show_busnum(struct device *dev, struct device_attribute *attr, char *buf)
{
struct usb_device *udev;
udev = to_usb_device(dev);
return sprintf(buf, "%d\n", udev->bus->busnum);
}
static DEVICE_ATTR(busnum, S_IRUGO, show_busnum, NULL);
static ssize_t static ssize_t
show_devnum(struct device *dev, struct device_attribute *attr, char *buf) show_devnum(struct device *dev, struct device_attribute *attr, char *buf)
{ {
...@@ -347,6 +357,7 @@ static struct attribute *dev_attrs[] = { ...@@ -347,6 +357,7 @@ static struct attribute *dev_attrs[] = {
&dev_attr_bNumConfigurations.attr, &dev_attr_bNumConfigurations.attr,
&dev_attr_bMaxPacketSize0.attr, &dev_attr_bMaxPacketSize0.attr,
&dev_attr_speed.attr, &dev_attr_speed.attr,
&dev_attr_busnum.attr,
&dev_attr_devnum.attr, &dev_attr_devnum.attr,
&dev_attr_version.attr, &dev_attr_version.attr,
&dev_attr_maxchild.attr, &dev_attr_maxchild.attr,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册