That sounds good, if it works feel free to commit it :) On Nov 29, 2007 7:29 AM, Roger Lindsjö <[EMAIL PROTECTED]> wrote: > Dan Streetman wrote: > > Aha, thanks for finding that. For a bit of background, that was added > > because the signal-based notification of URBs never worked (or at > > least, not when I was trying to make it work). So hence, the polling > > loop was added, and the FIXME comment. The reason it uses 0 is > > because back then, when the kernel had a hardcoded 10ms scheduler > > interval, any sleep was guaranteed at least 10ms of downtime. > > However, later kernels change that to much smaller intervals, and in > > some cases the scheduler is not even timer-based, so the assumption no > > longer applies. > > > > The reason for the counter to 20 is because when there are many URBs > > piling up in the kernel waiting for javax.usb to read them, we don't > > want to sleep, as that will greatly reduce throughput. So the > > 20-count was added to only sleep when there really was nothing > > happening on the USB bus. > > > > Modified patch (using only 10000) is applied in CVS, thanks. > > > If usleep works as it should now, should we not reduce the sleep to 1000 > (1ms) and just loop once for each sleep? Well, perhaps twice to reduce a > slight buildup of lag. I think I will try with 1ms here where the > processing of the sent commands takes a few ms. With the original C code > the communication would look like this (H->host, D->device): > (H) Send command. > (H) Ready yet? > (D) No. > (H) Ready yet? > (D) No. > (H) Ready yet? > (D) No. > (H) Ready yet? > (D) Yes. > Where the ready yet would be issued several times. With Javax.usb it > would almost always look like: > (H) Send command. > (H) Ready yet? > (D) Yes. > > Since often Send command and ready yet would be processed between > different sleeps. For sending / receiving data this is not noticeable, > but with query response it could be seen. > > Also, in order to compile I changed: > Index: jni/JavaxUsbKernel.h > =================================================================== > RCS file: /cvsroot/javax-usb/javax-usb-ri-linux/jni/JavaxUsbKernel.h,v > retrieving revision 1.5 > diff -r1.5 JavaxUsbKernel.h > 16d15 > < > 19c18 > < #include <linux/usb.h> > --- > > #include <linux/usb/ch9.h> > > I'll report how this goes. > > //Roger Lindsjö > >
------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 _______________________________________________ javax-usb-devel mailing list javax-usb-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/javax-usb-devel