入力イベントについて
はじめに
Input Deviceの種類を確認する
さて、端末がどのようなInput Deviceを監視しているのか確認します。
確認方法は「adb shell」のコマンドを使用します。
以下のようなコマンドを入力してみましょう。
adb shell ls dev/input
確認結果
Nexus Sの場合
$ ls dev/input/ ls dev/input/ event6 event5 event4 event3 event2 event1 event0 mice
Motorola Xoom の場合
$ ls dev/input/ ls dev/input/ event0 event1 event2 event3 event4 event5 event6 event7
両端末とも「eventX」と出力されました。
これでは何がなんだかわかりませんので、以下のコマンドでdevice名を出力してみました。
Nexus Sの場合
$ getevent getevent add device 1: /dev/input/event6 name: "compass" add device 2: /dev/input/event5 name: "cypress-touchkey" add device 3: /dev/input/event4 name: "lightsensor-level" add device 4: /dev/input/event3 name: "proximity" add device 5: /dev/input/event2 ←★ Volumeキーなどのハードキー name: "herring-keypad" add device 6: /dev/input/event1 name: "gyro" add device 7: /dev/input/event0 ←★ タッチパネル name: "mxt224_ts_input" could not get driver version for /dev/input/mice, Not a typewriter
Motorola Xoom の場合
$ getevent getevent add device 1: /dev/input/event7 ←★ Volumeキー name: "stingray-keypad" add device 2: /dev/input/event6 ←★ タッチパネル name: "qtouch-touchscreen" add device 3: /dev/input/event5 ←★ Powerキーー name: "cpcap-key" add device 4: /dev/input/event4 name: "barometer" add device 5: /dev/input/event3 name: "gyroscope" add device 6: /dev/input/event2 name: "max9635_als" add device 7: /dev/input/event1 name: "accelerometer" add device 8: /dev/input/event0 name: "compass"