diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/sysfs.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index ec9b3bde8ae5..4ab50009291d 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -286,6 +286,39 @@ static ssize_t show_interface_string(struct device *dev, char *buf) | |||
286 | } | 286 | } |
287 | static DEVICE_ATTR(interface, S_IRUGO, show_interface_string, NULL); | 287 | static DEVICE_ATTR(interface, S_IRUGO, show_interface_string, NULL); |
288 | 288 | ||
289 | static ssize_t show_modalias(struct device *dev, char *buf) | ||
290 | { | ||
291 | struct usb_interface *intf; | ||
292 | struct usb_device *udev; | ||
293 | |||
294 | intf = to_usb_interface(dev); | ||
295 | udev = interface_to_usbdev(intf); | ||
296 | if (udev->descriptor.bDeviceClass == 0) { | ||
297 | struct usb_host_interface *alt = intf->cur_altsetting; | ||
298 | |||
299 | return sprintf(buf, "usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X\n", | ||
300 | le16_to_cpu(udev->descriptor.idVendor), | ||
301 | le16_to_cpu(udev->descriptor.idProduct), | ||
302 | le16_to_cpu(udev->descriptor.bcdDevice), | ||
303 | udev->descriptor.bDeviceClass, | ||
304 | udev->descriptor.bDeviceSubClass, | ||
305 | udev->descriptor.bDeviceProtocol, | ||
306 | alt->desc.bInterfaceClass, | ||
307 | alt->desc.bInterfaceSubClass, | ||
308 | alt->desc.bInterfaceProtocol); | ||
309 | } else { | ||
310 | return sprintf(buf, "usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic*isc*ip*\n", | ||
311 | le16_to_cpu(udev->descriptor.idVendor), | ||
312 | le16_to_cpu(udev->descriptor.idProduct), | ||
313 | le16_to_cpu(udev->descriptor.bcdDevice), | ||
314 | udev->descriptor.bDeviceClass, | ||
315 | udev->descriptor.bDeviceSubClass, | ||
316 | udev->descriptor.bDeviceProtocol); | ||
317 | } | ||
318 | |||
319 | } | ||
320 | static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL); | ||
321 | |||
289 | static struct attribute *intf_attrs[] = { | 322 | static struct attribute *intf_attrs[] = { |
290 | &dev_attr_bInterfaceNumber.attr, | 323 | &dev_attr_bInterfaceNumber.attr, |
291 | &dev_attr_bAlternateSetting.attr, | 324 | &dev_attr_bAlternateSetting.attr, |
@@ -293,6 +326,7 @@ static struct attribute *intf_attrs[] = { | |||
293 | &dev_attr_bInterfaceClass.attr, | 326 | &dev_attr_bInterfaceClass.attr, |
294 | &dev_attr_bInterfaceSubClass.attr, | 327 | &dev_attr_bInterfaceSubClass.attr, |
295 | &dev_attr_bInterfaceProtocol.attr, | 328 | &dev_attr_bInterfaceProtocol.attr, |
329 | &dev_attr_modalias.attr, | ||
296 | NULL, | 330 | NULL, |
297 | }; | 331 | }; |
298 | static struct attribute_group intf_attr_grp = { | 332 | static struct attribute_group intf_attr_grp = { |