Make USB device addresses match while sniffing USB communication with usbmon and hardware USB sniffer (OpenVizsla) at the same time. On xHCI root hubs the address is assigned by hardware and can be different than devnum. Signed-off-by: Tomasz Moń <desowin@xxxxxxxxx> --- Documentation/usb/usbmon.rst | 2 +- drivers/usb/mon/mon_bin.c | 6 +++--- drivers/usb/mon/mon_text.c | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Documentation/usb/usbmon.rst b/Documentation/usb/usbmon.rst index b0bd51080799..e603159f8a93 100644 --- a/Documentation/usb/usbmon.rst +++ b/Documentation/usb/usbmon.rst @@ -220,7 +220,7 @@ the following structure (its name is made up, so that we can refer to it):: unsigned char type; /* 8: Same as text; extensible. */ unsigned char xfer_type; /* ISO (0), Intr, Control, Bulk (3) */ unsigned char epnum; /* Endpoint number and transfer direction */ - unsigned char devnum; /* Device address */ + unsigned char devaddr; /* Device address */ u16 busnum; /* 12: Bus number */ char flag_setup; /* 14: Same as text */ char flag_data; /* 15: Same as text; Binary zero is OK. */ diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c index f48a23adbc35..d7a55be5df68 100644 --- a/drivers/usb/mon/mon_bin.c +++ b/drivers/usb/mon/mon_bin.c @@ -91,7 +91,7 @@ struct mon_bin_hdr { unsigned char type; /* Same as in text API; extensible. */ unsigned char xfer_type; /* ISO, Intr, Control, Bulk */ unsigned char epnum; /* Endpoint number and transfer direction */ - unsigned char devnum; /* Device address */ + unsigned char devaddr; /* Device address */ unsigned short busnum; /* Bus number */ char flag_setup; char flag_data; @@ -567,7 +567,7 @@ static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb, ep->type = ev_type; ep->xfer_type = xfer_to_pipe[usb_endpoint_type(epd)]; ep->epnum = dir | usb_endpoint_num(epd); - ep->devnum = urb->dev->devnum; + ep->devaddr = urb->dev->devaddr; ep->busnum = urb->dev->bus->busnum; ep->id = (unsigned long) urb; ep->ts_sec = ts.tv_sec; @@ -655,7 +655,7 @@ static void mon_bin_error(void *data, struct urb *urb, int error) ep->xfer_type = xfer_to_pipe[usb_endpoint_type(&urb->ep->desc)]; ep->epnum = usb_urb_dir_in(urb) ? USB_DIR_IN : 0; ep->epnum |= usb_endpoint_num(&urb->ep->desc); - ep->devnum = urb->dev->devnum; + ep->devaddr = urb->dev->devaddr; ep->busnum = urb->dev->bus->busnum; ep->id = (unsigned long) urb; ep->ts_sec = ts.tv_sec; diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c index bc5ecd5ff565..8f0d4a4416ef 100644 --- a/drivers/usb/mon/mon_text.c +++ b/drivers/usb/mon/mon_text.c @@ -59,7 +59,7 @@ struct mon_event_text { unsigned long id; /* From pointer, most of the time */ unsigned int tstamp; int busnum; - char devnum; + char devaddr; char epnum; char is_in; char xfertype; @@ -210,7 +210,7 @@ static void mon_text_event(struct mon_reader_text *rp, struct urb *urb, ep->type = ev_type; ep->id = (unsigned long) urb; ep->busnum = urb->dev->bus->busnum; - ep->devnum = urb->dev->devnum; + ep->devaddr = urb->dev->devaddr; ep->epnum = usb_endpoint_num(&urb->ep->desc); ep->xfertype = usb_endpoint_type(&urb->ep->desc); ep->is_in = usb_urb_dir_in(urb); @@ -282,7 +282,7 @@ static void mon_text_error(void *data, struct urb *urb, int error) ep->type = 'E'; ep->id = (unsigned long) urb; ep->busnum = urb->dev->bus->busnum; - ep->devnum = urb->dev->devnum; + ep->devaddr = urb->dev->devaddr; ep->epnum = usb_endpoint_num(&urb->ep->desc); ep->xfertype = usb_endpoint_type(&urb->ep->desc); ep->is_in = usb_urb_dir_in(urb); @@ -523,7 +523,7 @@ static void mon_text_read_head_t(struct mon_reader_text *rp, p->cnt += snprintf(p->pbuf + p->cnt, p->limit - p->cnt, "%lx %u %c %c%c:%03u:%02u", ep->id, ep->tstamp, ep->type, - utype, udir, ep->devnum, ep->epnum); + utype, udir, ep->devaddr, ep->epnum); } static void mon_text_read_head_u(struct mon_reader_text *rp, @@ -541,7 +541,7 @@ static void mon_text_read_head_u(struct mon_reader_text *rp, p->cnt += snprintf(p->pbuf + p->cnt, p->limit - p->cnt, "%lx %u %c %c%c:%d:%03u:%u", ep->id, ep->tstamp, ep->type, - utype, udir, ep->busnum, ep->devnum, ep->epnum); + utype, udir, ep->busnum, ep->devaddr, ep->epnum); } static void mon_text_read_statset(struct mon_reader_text *rp, -- 2.24.1