Re: XHCI and USB 2 soundcard

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

 



On Mon, May 6, 2013 at 7:52 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> On Mon, 6 May 2013, [ISO-8859-1] Aurélien Leblond wrote:
>
>> Hello all,
>>
>> I have two usb soundcards at home and my laptop has both EHCI and XHCI
>> usb ports.
>>
>> The M-Audio Fast-Track Ultra (USB 2) is not recognized by ALSA when
>> plugged on a USB 3 (XHCI) port on the kernel 3.9.
>>
>> I'm trying to figure out where the problem lies to report the issue to
>> the proper team: is it with XHCI or with ALSA?
>
> Neither one.  The problem is in the device.

No surprises there - the dev of the usb-audio module had to write a
great deal of code for this soundcard. It doesn't seem to respect much
standard.

>
>> In dmesg, this is what happens when the FTU is plugged:
>> [  107.461175] usb 3-1: new high-speed USB device number 3 using xhci_hcd
>> [  107.481695] usb 3-1: config 1 interface 3 altsetting 0 bulk
>> endpoint 0x7 has invalid maxpacket 8
>> [  107.481705] usb 3-1: config 1 interface 3 altsetting 0 bulk
>> endpoint 0x87 has invalid maxpacket 8
>
> See those warnings?  They indicate that the device has invalid entries
> in its endpoint descriptors.  The xHCI hardware can't cope with those
> invalid entries.
>
>> [  107.483384] usb 3-1: New USB device found, idVendor=0763, idProduct=2080
>> [  107.483392] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
>> [  107.483398] usb 3-1: Product: Fast Track Ultra
>> [  107.483403] usb 3-1: Manufacturer: M-Audio
>> [  107.483886] xhci_hcd 0000:04:00.0: ERROR: unexpected command
>> completion code 0x11.
>> [  107.483899] usb 3-1: can't set config #1, error -22
>
> This error is the result.  It prevents the system from using the
> device.
>
> Now, the xhci-hcd driver ought to be smart enough to compensate for
> mistakes like this (they are relatively common).  Does the patch below
> help?
>
> Alan Stern
>
>
>
> Index: usb-3.9/drivers/usb/host/xhci-mem.c
> ===================================================================
> --- usb-3.9.orig/drivers/usb/host/xhci-mem.c
> +++ usb-3.9/drivers/usb/host/xhci-mem.c
> @@ -1423,15 +1423,17 @@ int xhci_endpoint_init(struct xhci_hcd *
>         ep_ctx->ep_info2 |= cpu_to_le32(xhci_get_endpoint_type(udev, ep));
>
>         /* Set the max packet size and max burst */
> +       max_packet = GET_MAX_PACKET(usb_endpoint_maxp(&ep->desc));
> +       max_burst = 0;
>         switch (udev->speed) {
>         case USB_SPEED_SUPER:
> -               max_packet = usb_endpoint_maxp(&ep->desc);
> -               ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet));
>                 /* dig out max burst from ep companion desc */
> -               max_packet = ep->ss_ep_comp.bMaxBurst;
> -               ep_ctx->ep_info2 |= cpu_to_le32(MAX_BURST(max_packet));
> +               max_burst = ep->ss_ep_comp.bMaxBurst;
>                 break;
>         case USB_SPEED_HIGH:
> +               /* Some devices get this wrong */
> +               if (usb_endpoint_xfer_bulk(&ep->desc))
> +                       max_packet = 512;
>                 /* bits 11:12 specify the number of additional transaction
>                  * opportunities per microframe (USB 2.0, section 9.6.6)
>                  */
> @@ -1439,17 +1441,16 @@ int xhci_endpoint_init(struct xhci_hcd *
>                                 usb_endpoint_xfer_int(&ep->desc)) {
>                         max_burst = (usb_endpoint_maxp(&ep->desc)
>                                      & 0x1800) >> 11;
> -                       ep_ctx->ep_info2 |= cpu_to_le32(MAX_BURST(max_burst));
>                 }
> -               /* Fall through */
> +               break;
>         case USB_SPEED_FULL:
>         case USB_SPEED_LOW:
> -               max_packet = GET_MAX_PACKET(usb_endpoint_maxp(&ep->desc));
> -               ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet));
>                 break;
>         default:
>                 BUG();
>         }
> +       ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet) |
> +                       MAX_BURST(max_burst));
>         max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep);
>         ep_ctx->tx_info = cpu_to_le32(MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload));
>
>


Tested it in kernel 9.0 and it fixes the problem!
The soundcard is detected and the probing of the snd-usb module is triggered.

Thanks a lot Alan!
If there is anything you would like me to test or a trace you would
like me to do to ensure everything is working ok, let me know.

Kind Regards,
Aurélien
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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

  Powered by Linux