Re: Slightly off-topic, USB code in Linux working, but fails in U-Boot

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

 



On Wed, Feb 12, 2014 at 03:36:57PM -0500, Ben Collins wrote:
> On Feb 9, 2014, at 9:38 PM, Peter Chen <peter.chen@xxxxxxxxxxxxx> wrote:
> >> 
> >>        desc = (struct usb_device_descriptor *)tmpbuf;
> >>        dev->descriptor.bMaxPacketSize0 = 64;       /* Start off at 64
> >> bytes  */
> >>        /* Default to 64 byte max packet size */
> >>        dev->maxpacketsize = PACKET_SIZE_64;
> >>        dev->epmaxpacketin[0] = 64;
> >>        dev->epmaxpacketout[0] = 64;
> >> 
> >>        err = usb_control_msg(dev, usb_rcvaddr0pipe(),
> >>                        USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
> >>                        USB_DT_DEVICE << 8, 0, desc, 64,
> >>                        USB_CNTL_TIMEOUT);
> >> 
> >>        if (err < 0) {
> >>                printf("usb_new_device: usb_get_descriptor() failed\n");
> >>                return 1;
> >>        }
> >> 
> >> This control message fails. Here's the full lsusb output from Linux:
> >> 
> > 
> > - If you have a usb bus analyzer, please check if the GET_DESCRPTOR sends out successfully.
> > (Most probably, I don't think it sends out)
> 
> I've attached a screen cap of the USB capture. At the to in red is the "SETUP txn" that fails in u-boot (shows Timed Out). Below on the second capture, the Get Descriptor succeeds to the same device, but this time from Linux.
> 
> Should the analyzer show the IN/OUT portion of the first get-descriptor or does that only show up when the device responds? I'm no too familiar with USB protocol.

Using plain text to send email next time please, you can upload capture at some
place.

For GET_DESCRIPTOR:

setup stage:
host sends setup token
host sends data (8 bytes here)
device sends IN for response

data stage:
host sends IN token
device sends data (8 bytes here)
host sends OUT for response

status stage:
host sends OUT 
host sends 0-byte data
device sends IN for response

Since I can't see device IN response for setup stage from your capture
log, but I assume the device is ok.

So your problem may is the host does not send out IN token for data
stage, please check the function qh_urb_transaction at u-boot
(if the name is the same with linux) to see if the qtd for data
stage is setup correctly.

Peter

> 
> I've yet to dump qH/qTD structures, but should have a chance later this week.
> 
> 
> 
> --
> Servergy  : http://www.servergy.com/
> SwissDisk : http://www.swissdisk.com/
> Ubuntu    : http://www.ubuntu.com/
> My Blog   : http://ben-collins.blogspot.com/
> 



-- 

Best Regards,
Peter Chen

--
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