Re: Polling a usbfs file descriptor.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 21 Apr 2015, Dave Mielke wrote:

> [quoted lines by Alan Stern on 2015/04/21 at 10:50 -0400]
> 
> >Yes, it's okay.  A userspace ABI like that isn't going to go away.  
> >It's also true that you can poll for POLLERR or POLLHUP to see when a
> >device has been disconnected, although libusb probably isn't interested
> >in doing that.
> 
> Out of curiosity, do you know why one must poll for output (rather than for 
> input)?

I have no idea.  Perhaps someone decided to do it that way because you 
need to have the file open for writing before you can submit or reap 
URBs.

> JDoes "writability" precisely mean that there's at least one 
> user-submitted URB that can now be reaped?

Yes.  The exact test is:

	if (file->f_mode & FMODE_WRITE && !list_empty(&ps->async_completed))
		mask |= POLLOUT | POLLWRNORM;

where ps->async_completed is the list of completed but not-yet-reaped 
URBs.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux