On Tuesday 15 January 2008, Matthieu CASTET wrote:
> Hi,
>
> I am trying to use usbtest and g_zero to do some device driver test
> (http://www.linux-usb.org/usbtest/).
>
> I have some question about usbtest and g_zero with pattern=1.
That's a handy test mode that's certainly turned up bugs ... but
unfortunately it's awkward to set up and use, so it doesn't get
used as much as would be good.
> pattern=1 imply mod63 test and the buffer received. This allow to catch
> case were we lose packet.
>
> * But when the test start, on the host set_altsetting will be called.
> This will on the device call zero_set_config which will do a :
> - zero_reset_config (do usb_ep_disable)
> - set_source_sink_config (do usb_ep_enable & usb_ep_queue)
>
> But most gadget drivers flush their fifo on usb_ep_enable
The peripheral controller driver should do that instead. You'll
note that in the USB spec, "configuration" events (SET_CONFIGURATION
and SET_INTERFACE/altsetting) leave endpoints in a known state,
and they're the only times at which you can activate endpoints.
That state involves no traffic in-flight, and data toggles in
a defined state for non-iso endpoints).
> or when there is nothing in the queue.
Nothing in the queue? That would be a bug. It's perfectly legit
to send some data and then wait a while before sending more of it.
And neither data in the FIFO nor the endpoint data toggle should
change if there's no intervening config change event, regardless
of how full (or empty) the queue is.
> So if on the host we send data on the bulk endpoint after the
> set_altsetting but the device isn't fast enough, the usb_ep_enable &
> usb_ep_queue won't be done and we can lose packet due to the flush.
>
> How the sync between host and device is supposed to work ?
The peripheral doesn't return from SET_INTERFACE (set_altsetting)
until after the endpoints are enabled.
> Is ok for device driver to do flush on usb_ep_enable ?
Gadget driver shouldn't do that, since the peripheral controller
driver should be doing it instead.
> * Also with pattern mode there need to be a sync between host and device
> and sending several packets [1]. So this mean in this mode we should
> either make sure there is short packet or either choose a correct buflen
> for g_zero ?
Yes.
> * Is there some tests that use loopback mode of g_zero ?
NetChip had some windows-based tests using that mode.
I'm not sure there were ever any Linux-based ones.
Feel free to write and submit some. :)
- Dave
> Thanks,
>
> Matthieu CASTET
>
> [1]
> /* mod63 stays in sync with short-terminated transfers,
> * or otherwise when host and gadget agree on how large
> * each usb transfer request should be. resync is done
> * with set_interface or set_config.
> */
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
linux-usb-devel@xxxxxxxxxxxxxxxxxxxxx
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
[Home]
[Video for Linux]
[Photo]
[Yosemite Forum]
[Yosemite Photos]
[Video Projectors]
[PDAs]
[Hacking TiVo]
[Linux Kernel]
[Linux SCSI]
[XFree86]
[Devices]
[Big List of Linux Books]
[Free Dating]