How to poll multiple devices in kernel ?

From: Matthieu H. (mhameau_at_gmail.com)
Date: 02/28/05


Date: 28 Feb 2005 06:58:01 -0800

Hello everybody,

I'm a beginner in driver and module programming, and I need some help:

I designed a driver that need to listen at multiple devices (network
device, serial device, USB device) for incoming data.
Once received, that data should be accessible to user space through
the "read" function.
That's why I cannot use the poll/select functions from user space.

My first idea is to make a kernel thread for EACH device that do a
blocking read. When data comes, read returns and fills a global buffer
(protected with mutexes). Do you think it is a good idea?

Second idea is to make only ONE kernel thread that will call an
equivalent to the poll/select function inside the kernel. When data
arrives, i should test which device can be read and etc...
I think it's a better idea than the first one, but i don't know how to
do that.
 
What do you think? Any coments and/or help are welcome!
I already look for info everywhere but people always talk about poll
implementation of the struct file_operation and nothing else :(

Thanks by advance!

Matt



Relevant Pages

  • Re: [PATCH 1/2] cciss: kernel thread to detect changes on MSA2012
    ... This is the reason for this patch. ... wait_for_completion_timeout needs a timeout parameter as well, ... You can't really have and endless loop for a thread in a modular driver, ... If you want an example of using the kernel thread stop API for the ...
    (Linux-Kernel)
  • Re: [Openipmi-developer] BUG: soft lockup detected on CPU#1, ipmi_si
    ... is not setting things properly and is always telling the driver it has ... the kernel thread when a short timeout is requested by the state machine. ... | ipmi device interface ... | IPMI System Interface driver. ...
    (Linux-Kernel)
  • Re: Suspend not working with SATA:
    ... following code into every single kernel thread: ... But I consider suspend untested at best... ... itself is the one doing I/O on behalf of the driver. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Driver for Thinkpad Hotkeys.
    ... > instead of sleep button driver), ... Those button will not produce any ACPI notification, ... those keys set toggle value to RTC ram and you can access ... > To assert event from kernel, kernel thread will be needed. ...
    (freebsd-hackers)