diff options
| author | 2009-11-15 12:06:20 -0800 | |
|---|---|---|
| committer | 2009-11-15 12:06:23 -0800 | |
| commit | 478de466ce0504b9af639c3338b883893670a8e8 (patch) | |
| tree | 61aba455baf06a4821a65b82d1115929619b49bd /include/ui/EventHub.h | |
| parent | 2b63ff51d5202eb2b458e937d4b65b326238733e (diff) | |
| parent | 9db3d07b9620b4269ab33f78604a36327e536ce1 (diff) | |
merge from eclair
Diffstat (limited to 'include/ui/EventHub.h')
| -rw-r--r-- | include/ui/EventHub.h | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/include/ui/EventHub.h b/include/ui/EventHub.h index 3848d8c3bdc0..3b18c7774575 100644 --- a/include/ui/EventHub.h +++ b/include/ui/EventHub.h @@ -20,7 +20,10 @@ #include <utils/String8.h> #include <utils/threads.h> -#include <utils.h> +#include <utils/Log.h> +#include <utils/threads.h> +#include <utils/List.h> +#include <utils/Errors.h> #include <linux/input.h> @@ -52,7 +55,9 @@ public: CLASS_KEYBOARD = 0x00000001, CLASS_ALPHAKEY = 0x00000002, CLASS_TOUCHSCREEN = 0x00000004, - CLASS_TRACKBALL = 0x00000008 + CLASS_TRACKBALL = 0x00000008, + CLASS_TOUCHSCREEN_MT= 0x00000010, + CLASS_DPAD = 0x00000020 }; uint32_t getDeviceClasses(int32_t deviceId) const; @@ -70,6 +75,13 @@ public: int getKeycodeState(int key) const; int getKeycodeState(int32_t deviceId, int key) const; + status_t scancodeToKeycode(int32_t deviceId, int scancode, + int32_t* outKeycode, uint32_t* outFlags) const; + + // exclude a particular device from opening + // this can be used to ignore input devices for sensors + void addExcludedDevice(const char* deviceName); + // special type codes when devices are added/removed. enum { DEVICE_ADDED = 0x10000000, @@ -82,10 +94,9 @@ public: virtual bool getEvent(int32_t* outDeviceId, int32_t* outType, int32_t* outScancode, int32_t* outKeycode, uint32_t *outFlags, int32_t* outValue, nsecs_t* outWhen); - + protected: virtual ~EventHub(); - virtual void onFirstRef(); private: bool openPlatformInput(void); @@ -108,17 +119,18 @@ private: String8 keylayoutFilename; device_t* next; - device_t(int32_t _id, const char* _path); + device_t(int32_t _id, const char* _path, const char* name); ~device_t(); }; device_t* getDevice(int32_t deviceId) const; + bool hasKeycode(device_t* device, int keycode) const; // Protect all internal state. mutable Mutex mLock; bool mHaveFirstKeyboard; - int32_t mFirstKeyboardId; // the API is that the build in keyboard is id 0, so map it + int32_t mFirstKeyboardId; // the API is that the built-in keyboard is id 0, so map it struct device_ent { device_t* device; @@ -133,7 +145,10 @@ private: device_t **mDevices; struct pollfd *mFDs; int mFDCount; - + + bool mOpened; + List<String8> mExcludedDevices; + // device ids that report particular switches. #ifdef EV_SW int32_t mSwitches[SW_MAX+1]; |