From: Markus S. <msv...@ae...> - 2011-04-08 20:15:08
|
Kevyn, Can you share some code, showing how you would use inotify with a serial port, to detect when data is received on the port? Why is that approach better/simpler than using just plain select() or poll()? Markus On 11-04-08 04:00 PM, Kevyn-Alexandre Paré wrote: > Why not using simple inotify with select ! > > http://www.linuxjournal.com/article/8478 > > http://en.wikipedia.org/wiki/Inotify > > http://lxr.linux.no/linux+v2.6.38/Documentation/filesystems/inotify.txt > > > Best Regards > > Kevyn-Alexandre Paré > > On Fri, 2011-04-08 at 14:41 +0100, Dave Hylands wrote: >> Hi guys, >> >> On Fri, Apr 8, 2011 at 6:08 AM, Markus Svilans<msv...@ae...> wrote: >>> It sounds like you could use the open() system call to open a file >>> descriptor to the serial port device, and then use the poll() or >>> select() system calls in a loop to receive a notification when some data >>> is received. This is about as efficient and and fast a response as you >>> can get from a user space application. I have been doing it this way to >>> read data from all kinds of serial devices, and have had no problems >>> with the approach. Unless your needs are very special, I think you >>> should be able to get good results with the same approach. >> I normally launch a thread which is dedicated to reading the serial port. >> >> You can issue a read for multiple characters, but set it up so that >> the read will return when at least 1 character shows up. >> > > > ------------------------------------------------------------------------------ > Xperia(TM) PLAY > It's a major breakthrough. An authentic gaming > smartphone on the nation's most reliable network. > And it wants your games. > http://p.sf.net/sfu/verizon-sfdev > _______________________________________________ > gumstix-users mailing list > gum...@li... > https://lists.sourceforge.net/lists/listinfo/gumstix-users |