Hi to all of You!

I (who am a total newbie to usb and libusb/libhid) am using libhid to both read and write from an IN and OUT interrupt endpoint in a hid. This goes OK with hid_interrupt_read() and hid_interrupt_write(). I have been doing a lot of reading about usb and have among many other things that an interrupt ep has a polling time. AFAI understand it, this is used for calculating the required bandwidth (along with the ep size, this is done by driver code that is on a lower level in the usb stack) and off course for setting the polling time. However, when I "steal" the device from the kernel hid driver, do I have to see to it that this polling time is respected? I guess I do because I can't find another possibility. Esp. for reading this is important. For writing (updating the readings on a display) I can just send a package whenever there is something to be sent, being carefull to respect the polling time.

Another question is how pressing a button on the usb device might wake up the pc if it is suspended. AFAI can see, this is not possible.

Are my own answers to my questions correct? Or am I overlooking something?

My last question is about the fact that there are two things taking place. The display part (the display is on the device) of my program is reading from a fifo, I could do that with a blocking read or with select with a time-out, the last option allows me to poll the in ep at a regular interval where the first one doesn't. The in ep needs to be read every 50 ms and then something has to be put into another fifo. What would be the most elegant solution to achieve this?

The thought occured to me that I could fork the program and have child and parent do their own parts.

Another option would be to have a select with just a timeout, when it times out (10ms) it polls the in ep every fifth time (polling time for the out ep is 10 ms, for in ep 50 ms) and it checks the fifo that in this case would have been opened as non-blocking to see if there is anything to send to the out ep.

I am not only new to usb and libhid but also rather new to Linux and would very much like to hear Your opinions about this or perhaps You have a completely different idea about how I would best design this.

Thank You very much in advance!

Yours sincerely,
Rene

P.S. And for the readers who have build libhid: A big thank You for that fact as well!


_______________________________________________
libhid-discuss mailing list
libhid-discuss@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/

Reply via email to