LDD之input子系統 總結與流程圖

-----------------------------------------------------------------------
本文系本站原創,歡迎轉載!
轉載請註明出處:http://blog.csdn.net/android_huber
交流郵箱:[email protected]

-----------------------------------------------------------------------


1.input.cinput_init

註冊input,初始化proc,註冊設備register_chrdev(INPUT_MAJOR,"input", &input_fops)

2.evdev.c evdev_init

input_register_handler(&evdev_handler)註冊handler:將evdev_handler加入到input_handler_list鏈表中,然後遍歷每一個掛在Input_dev_list上的設備調用input_attach_handler

3.inp[ut.c input_register_device

device_Add(&dev->dev)→

Kobject_get_path創建sys接口→

list_add_tail(&dev->node.&input_dev_list)將設備加入全局鏈表中→

然後遍歷input_handler_list中的每一個handler,調用input_attach_handler進行attach

4.input.c input_attach_handler

調用input_match_device檢測id匹配情況,然後調用handler中的connect函數:

connect中封裝了handleevdev->dev結構體

input_register_handle註冊handle,handle可看作handlerdevice的結合

最終調用device_Add(&evdev->dev)

5.input_event

Input_event-->input_handler_event:對type進行switch查找,對不同事件執行不同處理。對於按鍵和觸摸屏,交由handler->event處理。-->

Input_pass_event→

handler->event-->evdev_event函數

evdev_event中封裝了input_event,並將該結構體保存在client->buffer[client->head++]數組中。client中的buffer會處理成環形緩衝區,

處理方式:client->head &= EVDEV_BUFFER_SIZE-1

6.evdev.c evdev_read

client中的input_event結構體提取出來,然後將該結構體copy_to_user到應用層。


下面是我剛畫好的一個流程圖


大家可以參照 下面這篇分析代碼的文章一起看

http://blog.csdn.net/android_huber/article/details/7407103

圖看不全的話,大家可以保存到本地,然後方便放大了看。

需要清晰大圖的請到下面網址去下載

http://download.csdn.net/detail/android_huber/8537241


發佈了24 篇原創文章 · 獲贊 19 · 訪問量 19萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章