|
From: abdullah u. <abd...@ya...> - 2014-04-15 20:15:47
|
Dear Tim,
Thank you very much for your time and explanations.
I have been gathering information about USB and examining or trying somethings.
In short term, I have solved my problem somehow. But in long term, your answers
provide me background on which I could achieve strong/considerable experience.
Thanks,
Abdullah
On Tuesday, April 15, 2014 8:24 PM, Tim Roberts <ti...@pr...> wrote:
abdullah unutmaz wrote:
>I read you answers again, firstly thank you for your time.
>
>In the beginning I had no idea about USB communication, found
something in web including explanations about interrupt,
isochronous... modes. Then I followed tutorials, discussions,
forms etc. and then applied some examples. I had never heard
something related to "libusb_set_interface_alt_setting", I am
going to check that, because it might be neccessary later in
another project.
>
It is generally only used with isochronous and interrupt pipes.
By the way, might I ask how I could specify the length of a buffer, by checking the length of desciriptor in bytes? Because I am still trying to understand better.
>
The length of the descriptor has nothing to do with your buffering.
You have to decide your buffer sizes, based on a couple of things:
1. The maximum packet size in the endpoint descriptor
(wMaxPacketSize). That's very different from the descriptor length,
which will always be 7 bytes (OK, sometimes it's 9 bytes).
Your buffers always need to be an integer multiple of the max packet
size. The max packet size includes the "number of transactions"
multiplier in high speed, and the burst multiplier in super speed.
2. Efficiency vs latency. For efficiency, you generally want to use
a large buffer. If you send down a megabyte, the hardware will keep
filling that buffer until it is done. If you send down 2,000
requests of 512 bytes, you'll get the same data, but you will have
made 2,000 round trips through the kernel to handle completions and
resubmissions.
The tradeoff for that efficiency is increased latency. If you send
down that megabyte buffer, you can't process any of the data until
the whole thing is filled. There are some applications where that
doesn't matter -- you have to know what you're doing with the data
to make that decision.
--
Tim Roberts, ti...@pr... Providenza & Boekelheide, Inc.
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
libusb-devel mailing list
lib...@li...
https://lists.sourceforge.net/lists/listinfo/libusb-devel |