patch-2.3.35 linux/drivers/usb/proc_usb.c

Next file: linux/drivers/usb/scanner.c
Previous file: linux/drivers/usb/printer.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.34/linux/drivers/usb/proc_usb.c linux/drivers/usb/proc_usb.c
@@ -381,22 +381,12 @@
 	return start;
 }
 
-static char *usb_dump_string(char *start, char *end, const struct usb_device *dev, char *id, int index)
-{
-	if (start > end)
-		return start;
-	start += sprintf(start, "Interface:");
-	if (index <= dev->maxstring && dev->stringindex && dev->stringindex[index])
-		start += sprintf(start, "%s: %s ", id, dev->stringindex[index]);
-	return start;
-}
-
 #endif /* PROC_EXTRA */
 
 /*****************************************************************/
 
 static char *usb_device_dump(char *start, char *end, const struct usb_device *usbdev,
-			     int bus, int level, int index, int count)
+			     const struct usb_bus *bus, int level, int index, int count)
 {
 	int chix;
 	int cnt = 0;
@@ -410,7 +400,7 @@
 	 * So the root hub's parent is 0 and any device that is
 	 * plugged into the root hub has a parent of 0.
 	 */
-	start += sprintf(start, format_topo, bus, level, parent_devnum, index, count,
+	start += sprintf(start, format_topo, bus->busnum-1, level, parent_devnum, index, count,
 			 usbdev->devnum, usbdev->slow ? "1.5" : "12 ", usbdev->maxchild);
 	/*
 	 * level = topology-tier level;
@@ -418,11 +408,18 @@
 	 * index = parent's connector number;
 	 * count = device count at this level
 	 */
-	/* do not dump descriptors for root hub */
-	if (usbdev->devnum >= 0)
-		start = usb_dump_desc(start, end, usbdev);
+	/* If this is the root hub, display the bandwidth information */
+	if (level == 0)
+		start += sprintf(start, format_bandwidth, bus->bandwidth_allocated, 
+				FRAME_TIME_MAX_USECS_ALLOC,
+				(100 * bus->bandwidth_allocated + FRAME_TIME_MAX_USECS_ALLOC / 2) / FRAME_TIME_MAX_USECS_ALLOC,
+			         bus->bandwidth_int_reqs, bus->bandwidth_isoc_reqs);
+
+	/* show the descriptor information for this device */
+	start = usb_dump_desc(start, end, usbdev);
 	if (start > end)
 		return start + sprintf(start, "(truncated)\n");
+
 	/* Now look at all of this device's children. */
 	for (chix = 0; chix < usbdev->maxchild; chix++) {
 		if (start > end)
@@ -440,7 +437,6 @@
 	char *page, *end;
 	ssize_t ret = 0;
 	unsigned int pos, len;
-	int busnum = 0;
 
 	if (*ppos < 0)
 		return -EINVAL;
@@ -453,13 +449,9 @@
 	pos = *ppos;
 	usb_bus_list = usb_bus_get_list();
 	/* enumerate busses */
-	for (buslist = usb_bus_list->next; buslist != usb_bus_list; buslist = buslist->next, ++busnum) {
-		/* print bandwidth allocation */
+	for (buslist = usb_bus_list->next; buslist != usb_bus_list; buslist = buslist->next) {
 		bus = list_entry(buslist, struct usb_bus, bus_list);
-		len = sprintf(page, format_bandwidth, bus->bandwidth_allocated, FRAME_TIME_MAX_USECS_ALLOC,
-			      (100 * bus->bandwidth_allocated + FRAME_TIME_MAX_USECS_ALLOC / 2) / FRAME_TIME_MAX_USECS_ALLOC,
-			      bus->bandwidth_int_reqs, bus->bandwidth_isoc_reqs);
-		end = usb_device_dump(page + len, page + (PAGE_SIZE - 100), bus->root_hub, busnum, 0, 0, 0);
+		end = usb_device_dump(page, page + (PAGE_SIZE - 100), bus->root_hub, bus, 0, 0, 0);
 		len = end - page;
 		if (len > pos) {
 			len -= pos;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)