Hi, I am writing a device driver based on usb-skeleton.c. I want to use the select() system call in user space and therefore I am trying to implement the device driver method poll().
I found code for implementing the driver method poll in Linux Device Drivers 3, chapter 6. I simply added the following code to the driver: // ------------------------------------------ static unsigned int skel_poll(struct file *filp, poll_table *wait) { struct usb_skel *dev = filp->private_data; unsigned int mask = 0; printk(KERN_INFO "*** skel_poll\n"); down(&dev->sem); poll_wait(filp, &dev->inq, wait); poll_wait(filp, &dev->outq, wait); if(dev->rp != dev->wp) mask |= POLLIN | POLLRDNORM; /* readable */ if(spacefree(dev)) mask |= POLLOUT | POLLWRNORM; /* writable */ up(&dev->sem); return mask; } static int spacefree(struct usb_skel *dev) { if(dev->rp == dev->wp) return dev->bulk_in_size - 1; return (( dev->rp + dev->bulk_in_size - dev->wp) % dev->bulk_in_size) -1; } // ------------------------------------------ Now, when I am testing the driver with select() in user space, the computer hangs. The driver without the poll code above works normally and prints out the KERN_INFO printouts as it uses the read() and write() system calls. How shall I modify the code to make the poll() implementation work? Thanks in advance. / Moge -If you want the whole device driver code attached, just ask me and I'll send it. ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel