Re: How to notify a user process from within a driver

From: Chris Friesen (cfriesen@nortelnetworks.com)
Date: Thu May 01 2003 - 17:37:33 EST


Lee, Shuyu wrote:

> For example, assuming there are 8 input lines on my hardware, and the user
> wants to be notified in the following three cases:
> 1) input on Line 1 only,
> 2) input on either Line 2 or Line 3,
> 3) input on both Line 4 and Line 5,
> how do I pass that info to the driver? Also, other than POLLERR and POLLHUP,
> can I pass back to the user more descriptive error messages?

One to do something like this is to use signals. You could use ioctl for
userspace to register with the driver, and to query the status. When the
correct combination of inputs occurs, you thwap the process with a SIGUSR1,
which tells it to wake up and query the input line status.

Alternately, you could use ioctl for configuration and wait on a socket for
notification as to when to query the status.

Finally, you could use ioctl for configuration and write a byte to the socket
when the right event happens, the byte being a bitmap of the 8 input lines.

Chris

-- 
Chris Friesen                    | MailStop: 043/33/F10
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: cfriesen@nortelnetworks.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 07 2003 - 22:00:14 EST