[USB] Assign proper names to devices. Fix pegasus driver to use it.
[people/balajirrao/gpxe.git] / src / drivers / bus / usb / usbcore.c
index d47b3c7..473f646 100644 (file)
@@ -44,6 +44,9 @@ int usb_probe (struct usb_device *udev) {
                                continue;
                        udev->driver = driver;
                        udev->driver_name = id->name;
+#define min(a, b) (((a) < (b)) ? (a) : (b))
+                       strncpy(udev->dev.name, id->name,
+                               min(strlen(id->name), sizeof(udev->dev.name)));
                        DBG ("...using driver %s\n", udev->driver_name);
                        if ((rc = driver->probe(udev, id )) != 0) {
                                DBG ("......probe failed\n");