[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/21] usb: add tracepoint for usb packet state chan
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 08/21] usb: add tracepoint for usb packet state changes. |
Date: |
Tue, 28 Feb 2012 11:20:17 +0100 |
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb.c | 27 +++++----------------------
trace-events | 3 +++
2 files changed, 8 insertions(+), 22 deletions(-)
diff --git a/hw/usb.c b/hw/usb.c
index e5b8f33..57fc5e3 100644
--- a/hw/usb.c
+++ b/hw/usb.c
@@ -26,6 +26,7 @@
#include "qemu-common.h"
#include "usb.h"
#include "iov.h"
+#include "trace.h"
void usb_attach(USBPort *port)
{
@@ -390,7 +391,6 @@ void usb_packet_init(USBPacket *p)
void usb_packet_set_state(USBPacket *p, USBPacketState state)
{
-#ifdef DEBUG
static const char *name[] = {
[USB_PACKET_UNDEFINED] = "undef",
[USB_PACKET_SETUP] = "setup",
@@ -399,28 +399,11 @@ void usb_packet_set_state(USBPacket *p, USBPacketState
state)
[USB_PACKET_COMPLETE] = "complete",
[USB_PACKET_CANCELED] = "canceled",
};
- static const char *rets[] = {
- [-USB_RET_NODEV] = "NODEV",
- [-USB_RET_NAK] = "NAK",
- [-USB_RET_STALL] = "STALL",
- [-USB_RET_BABBLE] = "BABBLE",
- [-USB_RET_ASYNC] = "ASYNC",
- };
- char add[16] = "";
+ USBDevice *dev = p->ep->dev;
+ USBBus *bus = usb_bus_from_device(dev);
- if (state == USB_PACKET_COMPLETE) {
- if (p->result < 0) {
- snprintf(add, sizeof(add), " - %s", rets[-p->result]);
- } else {
- snprintf(add, sizeof(add), " - %d", p->result);
- }
- }
- fprintf(stderr, "bus %s, port %s, dev %d, ep %d: packet %p: %s -> %s%s\n",
- p->ep->dev->qdev.parent_bus->name,
- p->ep->dev->port->path,
- p->ep->dev->addr, p->ep->nr,
- p, name[p->state], name[state], add);
-#endif
+ trace_usb_packet_state_change(bus->busnr, dev->port->path, p->ep->nr,
+ p, name[p->state], name[state]);
p->state = state;
}
diff --git a/trace-events b/trace-events
index e918ff6..c5d0f0f 100644
--- a/trace-events
+++ b/trace-events
@@ -227,6 +227,9 @@ sun4m_iommu_page_get_flags(uint64_t pa, uint64_t iopte,
uint32_t ret) "get flags
sun4m_iommu_translate_pa(uint64_t addr, uint64_t pa, uint32_t iopte) "xlate
dva %"PRIx64" => pa %"PRIx64" iopte = %x"
sun4m_iommu_bad_addr(uint64_t addr) "bad addr %"PRIx64
+# hw/usb.c
+usb_packet_state_change(int bus, const char *port, int ep, void *p, const char
*o, const char *n) "bus %d, port %s, ep %d, packet %p, state %s -> %s"
+
# hw/usb-bus.c
usb_port_claim(int bus, const char *port) "bus %d, port %s"
usb_port_attach(int bus, const char *port) "bus %d, port %s"
--
1.7.1
- [Qemu-devel] [PULL] usb patch queue, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 01/21] usb-hid: fix tablet activation, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 02/21] usb-ehci: fix reset, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 06/21] usb-uhci: implement packet queuing, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 08/21] usb: add tracepoint for usb packet state changes.,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 04/21] usb-uhci: add UHCIQueue, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 07/21] usb-xhci: enable packet queuing, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 18/21] usb-redir: Let the usb-host know about our device filtering, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 05/21] usb-uhci: process uhci_handle_td return code via switch., Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 03/21] usb-uhci: cleanup UHCIAsync allocation & initialization., Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 13/21] libcacard: fix reported ATR length, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 16/21] usb-redir: Fix printing of device version, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 09/21] usb-ehci: sanity-check iso xfers, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 19/21] usb-redir: Limit return values returned by iso packets, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 11/21] libcacard: link with glib for g_strndup, Gerd Hoffmann, 2012/02/28