I still try getting happy with libusb-0.1.12
My goal is to achieve a datarate of 12 MB/s using usb_reads,
but i dont get it done so far,( Using threads!!!) all of them doing
usb_bulk_read i get about 4 MB/s.
I read something about usb-1.0 and that it has asynchronous usb_reads.
I really want to test asynchronous usb read .
on the libusb homepage i managed to check out v1.0 of libusb, but
it does neither seem to completely compile, nor does its documentation
show me that asynchrounous transfers are supported.
I even read about libusb-1.0.7 but i did not manage to actually find it on
the net.
Can anybody give me detailled instructions, how to get, compile
and use asynchronous usb read transfers ?
thanks in advance
Plug in a USB-2.0 flash storage device ("key" drive, "thumb" drive, etc.)
and do "time dd if=/dev/sda1 of=/dev/null bs=32k count=10000" which
reads 320MB in 32KB chunks. I get between 6MB/s and 10MB/s using
consumer-grade devices purchased at stores selling office supplies.
This gives a practical upper limit. If the buffer size is smaller
then the average data rate will be lower.
--
> time dd if=/dev/sda1 of=/dev/null bs=32k count=10000
Thank you for your reply.
I tested it. Using this command i get 22 MB/s but this value
is th result of kernel-side usb.
I am using user-side-usb (libusb) and want to use a quite big data rate
n my useer-level C program.
rds
To get high USB bandwidth, you must ensure that you always have buffers
queued up for the host controller. One of the problems with libusb 0.x is
that it does not support asynchronous transfers: you submit one request,
you wait until it is complete, then you submit another. The problem with
that is that, the whole time you are preparing to submit another request,
you have no buffers queued, so nothing is being scheduled for transfer.
If you use large buffers, you can get the bandwidth up a bit higher, but
the only way to "kick it up a notch" is to use asynchronous transfers, and
that means abandoning libusb.
We were able to achieve 30MB/s over a Linux bulk pipe by using the usbfs
ioctls directly. This is the same driver interface that libusb uses; we
just skipped the thin libusb layer so we could submit asynchronous URBs on
our own.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.
I spend most of the day trying to get rid of libusb.
First I flattened libusb into my program, second optimize it ;
remove unneeded code which helped my understand it better
Then I implemented another approch for usb_bulk read.
It is called usb_bulk_read1 and and uses an approch of 10 simultaniuos
usb_urb requests.
But i am still not happy with the solution.
just using 1 thread, i still cannot get data fast enough.
Just using multiple threads fixes the solution, but I cannot find a reason,
why 1 thread is not good enough using the new approcah.
I would be very glad, if you could look at this:
http://194.208.18.155/package.tar.gz
myusb.c: modified duplicate of libusb
myusb.h: its headers
datarate.c : testprogram to measure the received datarate
thank you in advance