Am Montag, 13. September 2004 21:27 schrieb Linas Vepstas: > Another alkternative to returning -ENODEV is to have a zero-length read. > This is a traditional unix way of signifying that the remote end has > disconnected; e.g. for tcp sockets. That is, select() will tell you > that there is something to read, and the read() call will suceed > (without error), and return zero bytes read. For tcp, this is > understood to mean that the far side has closed its socket. > > I'm not sure, but maybe this would also make sense for any USB device > that can be read with open(), read() calls?
Unfortunately that would violate POSIX. Quote: When attempting to read a file (other than a pipe or FIFO) that supports non-blocking reads and has no data currently available: *If O_NONBLOCK is set, read() shall return -1 and set errno to [EAGAIN]. *If O_NONBLOCK is clear, read() shall block the calling thread until some data becomes available. *The use of the O_NONBLOCK flag has no effect if there is some data available. If you need to modify applications, you can just as well return a proper error. Regards Oliver ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel