所有輸入設(shè)備(鍵盤、鼠標(biāo)、touchpad,roller wheel……)等在linux內(nèi)核中都是由"input subsystem"來管理的。 "input subsystem"包含三個層次,由上到下為"input event driver"、"input core"、"input device driver"。 Input子系統(tǒng)中input core提供核心服務(wù),并將input device driver和input event driver串到自身框架內(nèi),其中前者與具體的硬件輸入設(shè)備打交道,后者在向用戶提供統(tǒng)一的訪問接口。 了解了輸入系統(tǒng)的架構(gòu),編寫一些特定的應(yīng)用就會有的放矢:比如,你想寫一個鍵盤記錄器,那么只要編寫一個input event driver就行了,應(yīng)為在event driver層次,你可以獲取任何外設(shè)的輸入事件。 |
|