android: pass kernel input event /dev/input/event* to java
how can I create java even开发者_开发技巧ts from an new input device on an android device?
Events will come from input device handlers to kernal handler , then to java input events....
events device file will be /dev/input/eventX
... for keypad X-0,touch X-1 . please follow below link
http://cjix.info/blog/misc/internal-input-event-handling-in-the-linux-kernel-and-the-android-userspace/
u see, there is a big difference between C and java programming: class libraries vs C API. In java, you don't access the virtual device drivers directly, but instead uses the standard class libraries provided by Java, where the low level libraries accessing the hardware have all been written for you.
http://developer.android.com/reference/android/view/InputEvent.html
http://developer.android.com/reference/android/view/KeyEvent.html
and start navigating around looking for samples.
These low level libraries are in turn written in C, and communicate with Java via JNI / NDK:
http://developer.android.com/sdk/ndk/overview.html
精彩评论