Thanks for all your input. My USB device may have poor performance because of the device itself as Peter pointed out, but I have no control it and can only try to make it faster in my driver. I don't know of how much help this will be , but I will rewrite my driver using more low-level code. <br>
<br>I don't have any experience in USB device drivers and I am a bit short on time. Which of the native Linux API or libusb will be easier and faster to develop? Any pointers will be helpful.<br><br>Once again thanks for all your help.<br>
<br>Thanks<br>Shivaprasad<br><br><div class="gmail_quote">On Thu, Apr 30, 2009 at 4:18 AM, Peter Stuge <span dir="ltr"><<a href="mailto:stuge-libhid@cdy.org">stuge-libhid@cdy.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">shivaprasad javali wrote:<br>
> unplug the USB devices which have to be reflected in my application<br>
> immediately( there is a visual indicator as to how many USB devices are<br>
> plugged in). So I open new handles to the USB devices once every<br>
> second.<br>
<br>
</div>I strongly recommend that you make your application event based<br>
instead. (Never poll, get plug/unplug events from the system and<br>
update your view accordingly.)<br>
<div class="im"><br>
<br>
> My target platform is the OLPC<br>
<br>
</div>I also work on coreboot, too bad for us you guys recruited Richard. :)<br>
<div class="im"><br>
<br>
> In my application a Motion sensor can be connected to the computer<br>
> through the USB device and when it is connected I read from the<br>
> sensor every 5ms so that I can detect any sort of movement across<br>
> the motion sensor. The OLPC in itself is very slow and that coupled<br>
> with my requirement on the USB driver has led the motion sensor to<br>
> be very sluggish in its response.<br>
<br>
</div>The OLPC is a Geode LX running at 400-500 MHz and the USB is 2.0.<br>
I don't consider that "very slow." There are admittedly many layers<br>
of software running on the CPU, but the system does not have to be<br>
sluggish.<br>
<br>
<br>
How USB performs is extremely dependant on the device. It is very<br>
easy for inexperienced USB device developers to create devices with<br>
very bad performance. Knowing when and how to use standardized device<br>
classes and the four endpoint types will make or break a device.<br>
<br>
HID devices are very easy to access in Windows. Many device vendors<br>
choose to abuse the HID specification for this reason, in spite of<br>
their devices having nothing to do with a Human Interface.<br>
<br>
But, as Charles pointed out, HID devices are never high performance.<br>
They use control or interrupt transfers, which have particular<br>
benefits and drawbacks (just like bulk and isochronous do).<br>
<br>
<br>
As you are targeting a particular system and need neither portability<br>
nor full featured HID report processing you should write your driver<br>
using either one of the native Linux APIs for USB (usbfs) and HID<br>
(hidraw) or possibly libusb-1.0.<br>
<br>
If you go for usbfs, make sure to keep multiple transfers pending at<br>
all times.<br>
<br>
You must write more low level code to get better performance.<br>
<br>
Your device will be the bottleneck. The device descriptors and the<br>
device firmware is critical. Most device vendors are not very skilled<br>
with USB. Geode LX+CS5536 can drive a lot of USB data effortlessly.<br>
<br>
<br>
//Peter<br>
<br>
_______________________________________________<br>
libhid-discuss mailing list<br>
<div class="im"><a href="mailto:libhid-discuss@lists.alioth.debian.org">libhid-discuss@lists.alioth.debian.org</a><br>
</div><a href="http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss" target="_blank">http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss</a><br>
<a href="http://libhid.alioth.debian.org/" target="_blank">http://libhid.alioth.debian.org/</a><br>
</blockquote></div><br>