Brad Hards wrote:
>
> David Brownell wrote:
[snip]
> > In fact, I'd like to fix all that stuff someday:
> >
> > Manufacturer = "Linux $(KERNEL_VERSION) $(DRIVER_NAME) USB Host"
> > Product="... from pci_dev->description"
> > Serial="...from pci_dev->slot_name"
> >
> > The serial number should be a more "stable" identifier than it is today,
> > and the other information should be more informative.
> I liked this idea so much, I decided to try to implement it. See
> attached
> patch. On my OHCI / UHCI system, with this patch, /proc/bus/usb/devices
> looks like:
[snip]
Well it looks nice anyway.
Applies cleanly to 2.4.2-ac16.
Could help hotplug.
And it is purely cosmetic.
Can it please go in to a -ac release?
Brad
diff -Naur -X dontdiff linux-2.4.2ac11-clean/drivers/usb/uhci.c
linux/drivers/usb/uhci.c
--- linux-2.4.2ac11-clean/drivers/usb/uhci.c Sun Mar 4 19:59:22 2001
+++ linux/drivers/usb/uhci.c Sun Mar 4 19:10:40 2001
@@ -1811,7 +1811,7 @@
0x00,
0x00, /* __u16 bcdDevice; */
0x00,
- 0x00, /* __u8 iManufacturer; */
+ 0x03, /* __u8 iManufacturer; */
0x02, /* __u8 iProduct; */
0x01, /* __u8 iSerialNumber; */
0x01 /* __u8 bNumConfigurations; */
@@ -2121,7 +2121,7 @@
OK(len);
case 0x03: /* string descriptors */
len = usb_root_hub_string(wValue & 0xff,
- uhci->io_addr, "UHCI-alt",
+ uhci->dev, "UHCI-alt",
data, wLength);
if (len > 0) {
OK(min (leni, len));
diff -Naur -X dontdiff linux-2.4.2ac11-clean/drivers/usb/usb-ohci.c
linux/drivers/usb/usb-ohci.c
--- linux-2.4.2ac11-clean/drivers/usb/usb-ohci.c Sun Mar 4 19:59:22 2001
+++ linux/drivers/usb/usb-ohci.c Sun Mar 4 19:46:16 2001
@@ -1581,7 +1581,7 @@
0x00,
0x00, /* __u16 bcdDevice; */
0x00,
- 0x00, /* __u8 iManufacturer; */
+ 0x03, /* __u8 iManufacturer; */
0x02, /* __u8 iProduct; */
0x01, /* __u8 iSerialNumber; */
0x01 /* __u8 bNumConfigurations; */
@@ -1854,7 +1854,7 @@
data_buf = root_hub_config_des; OK(len);
case (0x03): /* string descriptors */
len = usb_root_hub_string (wValue & 0xff,
- (int)(long) ohci->regs, "OHCI",
+ ohci->ohci_dev, "OHCI",
data, wLength);
if (len > 0) {
data_buf = data;
diff -Naur -X dontdiff linux-2.4.2ac11-clean/drivers/usb/usb-uhci.c
linux/drivers/usb/usb-uhci.c
--- linux-2.4.2ac11-clean/drivers/usb/usb-uhci.c Sun Mar 4 19:59:22 2001
+++ linux/drivers/usb/usb-uhci.c Sun Mar 4 19:48:01 2001
@@ -1790,7 +1790,7 @@
0x00,
0x00, /* __u16 bcdDevice; */
0x00,
- 0x00, /* __u8 iManufacturer; */
+ 0x03, /* __u8 iManufacturer; */
0x02, /* __u8 iProduct; */
0x01, /* __u8 iSerialNumber; */
0x01 /* __u8 bNumConfigurations; */
@@ -2091,7 +2091,7 @@
OK (len);
case (0x03): /* string descriptors */
len = usb_root_hub_string (wValue & 0xff,
- uhci->io_addr, "UHCI",
+ uhci->uhci_pci, "UHCI",
data, wLength);
if (len > 0) {
OK (min (leni, len));
diff -Naur -X dontdiff linux-2.4.2ac11-clean/drivers/usb/usb.c linux/drivers/usb/usb.c
--- linux-2.4.2ac11-clean/drivers/usb/usb.c Sun Mar 4 19:59:23 2001
+++ linux/drivers/usb/usb.c Sun Mar 4 19:27:29 2001
@@ -32,7 +32,8 @@
#include <linux/init.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/spinlock.h>
-
+#include <linux/version.h> /* for UTS_RELEASE */
+#include <linux/pci.h> /* for root hub info */
#ifdef CONFIG_USB_DEBUG
#define DEBUG
#else
@@ -1596,9 +1597,9 @@
* root_hub_string is used by each host controller's root hub code,
* so that they're identified consistently throughout the system.
*/
-int usb_root_hub_string (int id, int serial, char *type, __u8 *data, int len)
+int usb_root_hub_string (int id, struct pci_dev *pci_desc, char *type, __u8 *data,
+int len)
{
- char buf [30];
+ char buf [80];
// assert (len > (2 * (sizeof (buf) + 1)));
// assert (strlen (type) <= 8);
@@ -1611,13 +1612,15 @@
// serial number
} else if (id == 1) {
- sprintf (buf, "%x", serial);
+ sprintf (buf, "%s", pci_desc->slot_name);
// product description
} else if (id == 2) {
- sprintf (buf, "USB %s Root Hub", type);
-
+ sprintf (buf, "%s", pci_desc->name);
+
// id 3 == vendor description
+ } else if (id == 3) {
+ sprintf (buf, "Linux %s %s Root Hub", UTS_RELEASE, type);
// unsupported IDs --> "stall"
} else
diff -Naur -X dontdiff linux-2.4.2ac11-clean/include/linux/usb.h
linux/include/linux/usb.h
--- linux-2.4.2ac11-clean/include/linux/usb.h Sun Mar 4 19:59:34 2001
+++ linux/include/linux/usb.h Sun Mar 4 19:24:57 2001
@@ -135,6 +135,7 @@
#include <linux/interrupt.h> /* for in_interrupt() */
#include <linux/config.h>
#include <linux/list.h>
+#include <linux/pci.h> /* for root hub strings */
#define USB_MAJOR 180
@@ -666,7 +667,7 @@
extern int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request,
__u8 requesttype, __u16 value, __u16 index, void *data, __u16 size, int timeout);
-extern int usb_root_hub_string(int id, int serial, char *type, __u8 *data, int len);
+extern int usb_root_hub_string(int id, struct pci_dev *pci_desc, char *type, __u8
+*data, int len);
extern void usb_connect(struct usb_device *dev);
extern void usb_disconnect(struct usb_device **);