diff options
author | Pete Zaitcev <zaitcev@redhat.com> | 2010-01-05 13:50:07 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 17:53:30 -0500 |
commit | 2bc0d109326e9f2b25fa1dfcc9de2489e1e00e36 (patch) | |
tree | 1c76c6d4218ccabb61767953cf53ed3eca260753 /drivers/usb/mon | |
parent | 7ed069c12c866c5c06e4e05d26878797e3731829 (diff) |
usbmon: add bus number to text API
Due to a simple oversight when bus zero was added, the text API fails to
deliver the bus number in 'E' messages (which are equivalent of 'C'
messages, only for error case). This makes it harder, for instance,
use a search-and-highlight in a text editor. So fix it.
Also, Alan Stern requested adding timestamps to 'E' messages. This is
purely cosmetic, but makes it easier to read the trace. This is done
for both text and binary APIs.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/mon')
-rw-r--r-- | drivers/usb/mon/mon_bin.c | 7 | ||||
-rw-r--r-- | drivers/usb/mon/mon_text.c | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c index 385ec052016..6dd44bc1f5f 100644 --- a/drivers/usb/mon/mon_bin.c +++ b/drivers/usb/mon/mon_bin.c | |||
@@ -460,8 +460,8 @@ static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb, | |||
460 | char ev_type, int status) | 460 | char ev_type, int status) |
461 | { | 461 | { |
462 | const struct usb_endpoint_descriptor *epd = &urb->ep->desc; | 462 | const struct usb_endpoint_descriptor *epd = &urb->ep->desc; |
463 | unsigned long flags; | ||
464 | struct timeval ts; | 463 | struct timeval ts; |
464 | unsigned long flags; | ||
465 | unsigned int urb_length; | 465 | unsigned int urb_length; |
466 | unsigned int offset; | 466 | unsigned int offset; |
467 | unsigned int length; | 467 | unsigned int length; |
@@ -600,10 +600,13 @@ static void mon_bin_complete(void *data, struct urb *urb, int status) | |||
600 | static void mon_bin_error(void *data, struct urb *urb, int error) | 600 | static void mon_bin_error(void *data, struct urb *urb, int error) |
601 | { | 601 | { |
602 | struct mon_reader_bin *rp = data; | 602 | struct mon_reader_bin *rp = data; |
603 | struct timeval ts; | ||
603 | unsigned long flags; | 604 | unsigned long flags; |
604 | unsigned int offset; | 605 | unsigned int offset; |
605 | struct mon_bin_hdr *ep; | 606 | struct mon_bin_hdr *ep; |
606 | 607 | ||
608 | do_gettimeofday(&ts); | ||
609 | |||
607 | spin_lock_irqsave(&rp->b_lock, flags); | 610 | spin_lock_irqsave(&rp->b_lock, flags); |
608 | 611 | ||
609 | offset = mon_buff_area_alloc(rp, PKT_SIZE); | 612 | offset = mon_buff_area_alloc(rp, PKT_SIZE); |
@@ -623,6 +626,8 @@ static void mon_bin_error(void *data, struct urb *urb, int error) | |||
623 | ep->devnum = urb->dev->devnum; | 626 | ep->devnum = urb->dev->devnum; |
624 | ep->busnum = urb->dev->bus->busnum; | 627 | ep->busnum = urb->dev->bus->busnum; |
625 | ep->id = (unsigned long) urb; | 628 | ep->id = (unsigned long) urb; |
629 | ep->ts_sec = ts.tv_sec; | ||
630 | ep->ts_usec = ts.tv_usec; | ||
626 | ep->status = error; | 631 | ep->status = error; |
627 | 632 | ||
628 | ep->flag_setup = '-'; | 633 | ep->flag_setup = '-'; |
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c index 047568ff223..16bfb61d24f 100644 --- a/drivers/usb/mon/mon_text.c +++ b/drivers/usb/mon/mon_text.c | |||
@@ -273,12 +273,12 @@ static void mon_text_error(void *data, struct urb *urb, int error) | |||
273 | 273 | ||
274 | ep->type = 'E'; | 274 | ep->type = 'E'; |
275 | ep->id = (unsigned long) urb; | 275 | ep->id = (unsigned long) urb; |
276 | ep->busnum = 0; | 276 | ep->busnum = urb->dev->bus->busnum; |
277 | ep->devnum = urb->dev->devnum; | 277 | ep->devnum = urb->dev->devnum; |
278 | ep->epnum = usb_endpoint_num(&urb->ep->desc); | 278 | ep->epnum = usb_endpoint_num(&urb->ep->desc); |
279 | ep->xfertype = usb_endpoint_type(&urb->ep->desc); | 279 | ep->xfertype = usb_endpoint_type(&urb->ep->desc); |
280 | ep->is_in = usb_urb_dir_in(urb); | 280 | ep->is_in = usb_urb_dir_in(urb); |
281 | ep->tstamp = 0; | 281 | ep->tstamp = mon_get_timestamp(); |
282 | ep->length = 0; | 282 | ep->length = 0; |
283 | ep->status = error; | 283 | ep->status = error; |
284 | 284 | ||