Hi Miro,
On Wed, Dec 11, 2013 at 1:21 PM, Miro <[email protected]> wrote: > > Hello all. > > So far I wrote a kernel driver that can read pwm encoded signal. I'd like to pass the data to the userspace now and this is what I'm thinking: > > User app creates several threads, one of which reads a device file in a loop. I want the read function to efficiently block, putting the thread to sleep until data is available. There will be other devices as well, some serial, thus other threads, but I'd like to use the same mechanism. > > How should I go about implementing this? Here's a multi-threaded serial port example: https://github.com/dhylands/projects/tree/master/host/sertest and the single-threaded version (which uses select) https://github.com/dhylands/projects/tree/master/host/sertest-select This is a kernel driver I wrote quite a while ago for reading gpio events. It has support for blocking and non-blocking reads (see the gpio_event_read function) and select (see gpio_event_poll) https://github.com/dhylands/projects/tree/master/linux/gpio-event/module I have to admit I haven't tried compiling this on a 3.0 kernel, but even if it doesn't compile, the concepts should all still be applicable. Feel free to ask questions. -- Dave Hylands Shuswap, BC, Canada http://www.davehylands.com -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
