Does anyone have a select implemented with their version of a POLLING device driver? I only need select type SEL_IN because I only use select() to check for read ready. I have written a character driver with a select routine that works(?) sometimes and could use assistance making it better.
Problem: Because I am using polling I/O, I don't think I can register with select_wait(), because I don't have a wake-up routine (is this true?). I got around that by using the following method that I borrowed from lp.c static int my_select(...) {
. . .
timeout = jiffies + TIMEOUT*HZ;
if(sel_type != SEL_IN) return 0;
while(jiffies < timeout) { /* routine to check for new data to be read */ if(check_for_input()) return 1; /* code fragment from lp.c */ if (need_resched) schedule(); } return 0; } This method does work when I have one user process open and watch my device and prompt it for output from a separate user process. I have had problems when I try to use an X application watch the device with XtAppAddInput(). Thanks for any help. matt
|