os22: fixed debian package dependency bug in opensync-plugin-barry
[barry.git] / doc / 0001-Snoop-limit-and-endpoint-patch.patch
blobd18c32e757d0561c5eb198e848d552656c33021f
1 From 97beaf75f426ed04e4cc20dd2f65f7e2ce65ece7 Mon Sep 17 00:00:00 2001
2 From: Chris Frey <cdfrey@foursquare.net>
3 Date: Fri, 31 Oct 2008 03:44:35 -0400
4 Subject: [PATCH] Snoop limit and endpoint patch
6 Puts a limit on the amount of data pushed into the printk log,
7 limiting it to the actual size of the USB urbs, not the whole
8 buffer.
10 This patch also adds some missed endpoint values to the logs.
11 ---
12 drivers/usb/core/devio.c | 19 +++++++++++++------
13 1 files changed, 13 insertions(+), 6 deletions(-)
15 diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
16 index de17738..aca73ae 100644
17 --- a/drivers/usb/core/devio.c
18 +++ b/drivers/usb/core/devio.c
19 @@ -288,7 +288,7 @@ static inline struct async *async_getpending(struct dev_state *ps,
21 static void snoop_urb(struct urb *urb, void __user *userurb)
23 - int j;
24 + int j, len;
25 unsigned char *data = urb->transfer_buffer;
27 if (!usbfs_snoop)
28 @@ -301,7 +301,12 @@ static void snoop_urb(struct urb *urb, void __user *userurb)
29 urb->transfer_buffer_length);
30 dev_info(&urb->dev->dev, "actual_length=%d\n", urb->actual_length);
31 dev_info(&urb->dev->dev, "data: ");
32 - for (j = 0; j < urb->transfer_buffer_length; ++j)
34 + len = urb->actual_length;
35 + if( len > urb->transfer_buffer_length )
36 + len = urb->transfer_buffer_length;
38 + for (j = 0; j < len; ++j)
39 printk("%02x ", data[j]);
40 printk("\n");
42 @@ -759,8 +764,8 @@ static int proc_bulk(struct dev_state *ps, void __user *arg)
43 kfree(tbuf);
44 return -EINVAL;
46 - snoop(&dev->dev, "bulk read: len=0x%02x timeout=%04d\n",
47 - bulk.len, bulk.timeout);
48 + snoop(&dev->dev, "bulk read: ep=0x%02x, len=0x%02x timeout=%04d\n",
49 + bulk.ep, bulk.len, bulk.timeout);
50 usb_unlock_device(dev);
51 i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo);
52 usb_lock_device(dev);
53 @@ -783,8 +788,8 @@ static int proc_bulk(struct dev_state *ps, void __user *arg)
54 return -EFAULT;
57 - snoop(&dev->dev, "bulk write: len=0x%02x timeout=%04d\n",
58 - bulk.len, bulk.timeout);
59 + snoop(&dev->dev, "bulk write: ep=0x%02x, len=0x%02x timeout=%04d\n",
60 + bulk.ep, bulk.len, bulk.timeout);
61 if (usbfs_snoop) {
62 dev_info(&dev->dev, "bulk write: data: ");
63 for (j = 0; j < len1; ++j)
64 @@ -1161,6 +1166,8 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
65 return -EFAULT;
68 + snoop(&ps->dev->dev, "submit urb: bEndpoint %02x\n",
69 + uurb->endpoint);
70 snoop_urb(as->urb, as->userurb);
71 async_newpending(as);
72 if ((ret = usb_submit_urb(as->urb, GFP_KERNEL))) {
73 --
74 1.6.0.3