patch-2.3.41 linux/drivers/usb/usb-debug.c

Next file: linux/drivers/usb/usb-ohci.c
Previous file: linux/drivers/usb/usb-core.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.40/linux/drivers/usb/usb-debug.c linux/drivers/usb/usb-debug.c
@@ -6,8 +6,8 @@
  */
 #include <linux/version.h>
 #include <linux/kernel.h>
-#include <linux/slab.h>
-
+#include <linux/mm.h>
+#include <linux/malloc.h>
 #define DEBUG
 
 #include "usb.h"
@@ -59,6 +59,11 @@
  */
 void usb_show_device_descriptor(struct usb_device_descriptor *desc)
 {
+	if (!desc)
+	{
+		printk("Invalid USB device descriptor (NULL POINTER)\n");
+		return;
+	}
 	printk("  Length              = %2d%s\n", desc->bLength,
 		desc->bLength == USB_DT_DEVICE_SIZE ? "" : " (!!!)");
 	printk("  DescriptorType      = %02x\n", desc->bDescriptorType);
@@ -160,10 +165,32 @@
 {
 	char *buf;
 
+	if (!index)
+		return;
 	if (!(buf = kmalloc(256, GFP_KERNEL)))
 		return;
 	if (usb_string(dev, index, buf, 256) > 0)
 		printk(KERN_INFO "%s: %s\n", id, buf);
 	kfree(buf);
+}
+
+void usb_dump_urb (purb_t purb)
+{
+	printk ("urb                   :%p\n", purb);
+	printk ("next                  :%p\n", purb->next);
+	printk ("dev                   :%p\n", purb->dev);
+	printk ("pipe                  :%08X\n", purb->pipe);
+	printk ("status                :%d\n", purb->status);
+	printk ("transfer_flags        :%08X\n", purb->transfer_flags);
+	printk ("transfer_buffer       :%p\n", purb->transfer_buffer);
+	printk ("transfer_buffer_length:%d\n", purb->transfer_buffer_length);
+	printk ("actual_length         :%d\n", purb->actual_length);
+	printk ("setup_packet          :%p\n", purb->setup_packet);
+	printk ("start_frame           :%d\n", purb->start_frame);
+	printk ("number_of_packets     :%d\n", purb->number_of_packets);
+	printk ("interval              :%d\n", purb->interval);
+	printk ("error_count           :%d\n", purb->error_count);
+	printk ("context               :%p\n", purb->context);
+	printk ("complete              :%p\n", purb->complete);
 }
 

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