Re: USB headset mic: slightly "robotic" voice when plugged into a usb 3.0 port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 08, 2012 at 10:56:59AM -0400, Alan Stern wrote:
> On Tue, 8 May 2012, Sergio Correia wrote:
> 
> > the output from USBmon for both EHCI and xHCI is available at:
> > http://www.uece.net/misc/usb-headset-problem/usbmon-usb2-bus2-dev6.txt
> > http://www.uece.net/misc/usb-headset-problem/usbmon-usb3-bus3-dev5.txt
> 
> It's notable that the bus-2 trace (which I presume is the one using 
> EHCI) shows that even though each packet requested 96 bytes of data, 
> the device sent only 88 or 90 bytes.  By contrast, the bus-3 trace 
> (xHCI) shows that each packet contained 96 bytes.  We should expect the 
> two traces not to differ in this way.
> 
> This may be a bug in the xhci-hcd driver -- it may say it got more
> bytes than actually were received.

I actually suspect it might be a bug in the hardware itself.  The lspci
shows it's a very early Fresco Logic chipset revision, and it wouldn't
surprise me if the xHCI host just doesn't report the short packet
completion code.  Let's rule that out before I go digging around the
xHCI ring code (which looks like it's handling short packets properly,
BTW).

Sergio, can you apply the attached patch, and see if the host is
actually reporting short packets?

Sarah Sharp
>From 879ac4f986110507e459474267e1a1e5a8f266be Mon Sep 17 00:00:00 2001
From: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx>
Date: Tue, 8 May 2012 09:22:49 -0700
Subject: [PATCH] xhci: Print on xHC short packet completion code.

This will either generate a lot of debug output, or none at all, if the
hardware isn't working properly.  grep for "short packet" in dmesg.

Signed-off-by: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx>
---
 drivers/usb/host/xhci-ring.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 3d9422f..c3a11a8 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1696,6 +1696,10 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
 		}
 		break;
 	case COMP_SHORT_TX:
+		xhci_dbg(xhci, "Slot %u ep %u short packet, "
+				"untransferred length = %u\n",
+				slot_id, ep_index,
+				TRB_LEN(le32_to_cpu(event->transfer_len)));
 		if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
 			*status = -EREMOTEIO;
 		else
@@ -1789,6 +1793,8 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
 		frame->status = 0;
 		break;
 	case COMP_SHORT_TX:
+		xhci_dbg(xhci, "Isoc short packet, untransferred length = %u\n",
+				TRB_LEN(le32_to_cpu(event->transfer_len)));
 		frame->status = td->urb->transfer_flags & URB_SHORT_NOT_OK ?
 				-EREMOTEIO : 0;
 		break;
@@ -1883,7 +1889,8 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
 	switch (trb_comp_code) {
 	case COMP_SUCCESS:
 		/* Double check that the HW transferred everything. */
-		if (event_trb != td->last_trb) {
+		if (event_trb != td->last_trb ||
+				TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
 			xhci_warn(xhci, "WARN Successful completion "
 					"on short TX\n");
 			if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
@@ -1895,6 +1902,9 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
 		}
 		break;
 	case COMP_SHORT_TX:
+		xhci_dbg(xhci, "Bulk/intr short packet, "
+				"untransferred length = %u\n",
+				TRB_LEN(le32_to_cpu(event->transfer_len)));
 		if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
 			*status = -EREMOTEIO;
 		else
@@ -2048,7 +2058,14 @@ static int handle_tx_event(struct xhci_hcd *xhci,
 	 * transfer type
 	 */
 	case COMP_SUCCESS:
+		if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0)
+			break;
+		xhci_warn(xhci, "WARN Successful completion on short TX\n");
 	case COMP_SHORT_TX:
+		xhci_dbg(xhci, "Slot %u ep %u short packet, "
+				"untransferred length = %u\n",
+				slot_id, ep_index,
+				TRB_LEN(le32_to_cpu(event->transfer_len)));
 		break;
 	case COMP_STOP:
 		xhci_dbg(xhci, "Stopped on Transfer TRB\n");
-- 
1.7.9


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux