分类: LINUX
2010-07-01 12:27:51
所有的input_dev 用双向链表 input_dev_list 连起来,如图所示:
/----------------\
/--------------->| input_dev_list |<------------------\
| \----------------/ |
| |
| |
| |
| |
| input_dev input_dev |
| +------------+ +------------+ |
| | | | | |
| +------------+ +------------+ |
| | | | | |
| +------------+ +------------+ |
| | | | | |
| +------------+ +------------+ |
\--->| node |<---- ...... ----| node |<---/
+------------+ +------------+
| h_list | | h_list |
+------------+ +------------+
所有的input_handler 用双向链表 input_handler_list 连起来, 如图所示:
/--------------------\
/--------------------->| input_handler_list |<--------------------\
| \--------------------/ |
| |
| |
| |
| |
| input_handler input_handler |
| +------------------+ +------------------+ |
| | private | | private | |
| +------------------+ +------------------+ |
| | (*event)() | | (*event)() | |
| +------------------+ +------------------+ |
| | (*connect)() | | (*connect)() | |
| +------------------+ +------------------+ |
| | (*disconnect)() | | (*disconnect)() | |
| +------------------+ +------------------+ |
| | (*start)() | | (*start)() | |
| +------------------+ +------------------+ |
| | fops | | fops | |
| +------------------+ +------------------+ |
| | minor | | minor | |
| +------------------+ +------------------+ |
| | name | | name | |
| +------------------+ +------------------+ |
| | id_table | | id_table | |
| +------------------+ +------------------+ |
| | blacklist | | blacklist | |
| +------------------+ +------------------+ |
| | hlist | | hlist | |
| +------------------+ +------------------+ |
\--->| node |<--- ...... ---->| node |<---/
+------------------+ +------------------+
通常在input_handler 的 connect函数中,就会创建 input_handle, input_handle就是负责将 input_dev 和 input_handler 联系在一起的,如图所示:
/----------------\
/--------------->| input_dev_list |<------------------\
| \----------------/ |
| |
| |
| |
| |
/-----------> input_dev input_dev |
| | +------------+ +------------+ |
| | | | | | |
| | +------------+ +------------+ |
| | | | | | |
| | +------------+ +------------+ |
| | | | | | |
| | +------------+ +------------+ |
| \--->| node |<---- ...... ----| node |<---/
| +------------+ +------------+
| /----->| h_list |<-------\ | h_list |
| | +------------+ | +------------+
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | input_handle |
| | +--------------+ |
| | | private | |
| | +--------------+ |
| | | open | |
| | +--------------+ |
| | | name | |
| | +--------------+ |
| \----->| d_node |<-----/
| +--------------+
\------<-----| *dev |
+--------------+
/-----<--------| *handler |
| +--------------+
| /-----| h_node |<-----\
| | +--------------+ |
| | |
| | |
| | |
| | |
| | |
| | |
\------------> input_handler |
| +------------------+ |
| | private | |
| +------------------+ |
| | (*event)() | |
| +------------------+ |
| | (*connect)() | |
| +------------------+ |
| | (*disconnect)() | |
| +------------------+ |
| | (*start)() | |
| +------------------+ |
| | fops | |
| +------------------+ |
| | minor | |
| +------------------+ |
| | name | |
| +------------------+ |
| | id_table | |
| +------------------+ |
| | blacklist | |
| +------------------+ |
\-->| hlist |<---/
+------------------+
| node |
+------------------+