9
0
Fork 0

usb: rename USB devices to reflect bus structure

This renames the USB devices to reflect the bus structure.
The base name for a USB device is usb<devno>. For each child
device we add a -<parent-port-no>. This makes it more easy
to identify devices.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2013-06-19 23:39:49 +02:00
parent 0339fe1d37
commit 1e60cbaf63
1 changed files with 11 additions and 3 deletions

View File

@ -431,14 +431,22 @@ static int usb_new_device(struct usb_device *dev)
if (dev->descriptor->iSerialNumber)
usb_string(dev, dev->descriptor->iSerialNumber,
dev->serial, sizeof(dev->serial));
if (parent) {
sprintf(dev->dev.name, "%s-%d", parent->dev.name, port);
} else {
sprintf(dev->dev.name, "usb%d", dev->host->busnum);
}
dev->dev.id = DEVICE_ID_SINGLE;
register_device(&dev->dev);
/* now prode if the device is a hub */
usb_hub_probe(dev, 0);
sprintf(dev->dev.name, "usb%d-%d", dev->host->busnum, dev->devnum);
print_usb_device(dev);
register_device(&dev->dev);
dev_add_param_int_ro(&dev->dev, "iManufacturer",
dev->descriptor->iManufacturer, "%d");
dev_add_param_int_ro(&dev->dev, "iProduct",