summaryrefslogtreecommitdiffstats
path: root/include/input
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2013-10-17 17:35:53 -0700
committerMichael Wright <michaelwr@google.com>2014-03-03 13:59:35 -0800
commit962a108856767d6f5c17cf2854b13fef0315f8ca (patch)
treec8d578db376fad7d5924a7155ffe27b1fdf24a23 /include/input
parentd5a354c6b7f2ae0b93e018f3024a2fca5f6543a1 (diff)
downloadframeworks_native-962a108856767d6f5c17cf2854b13fef0315f8ca.zip
frameworks_native-962a108856767d6f5c17cf2854b13fef0315f8ca.tar.gz
frameworks_native-962a108856767d6f5c17cf2854b13fef0315f8ca.tar.bz2
Parse LED mappings in keylayout files. DO NOT MERGE
Change-Id: I2b34939cc0df256e6b872502ea93f2884b4c8334
Diffstat (limited to 'include/input')
-rw-r--r--include/input/Input.h25
-rw-r--r--include/input/KeyLayoutMap.h10
-rw-r--r--include/input/Keyboard.h10
-rw-r--r--include/input/KeycodeLabels.h22
4 files changed, 65 insertions, 2 deletions
diff --git a/include/input/Input.h b/include/input/Input.h
index be79c59..69977ca 100644
--- a/include/input/Input.h
+++ b/include/input/Input.h
@@ -65,6 +65,31 @@ enum {
AINPUT_SOURCE_SWITCH = 0x80000000,
};
+enum {
+ /**
+ * Constants for LEDs. Hidden from the API since we don't actually expose a way to interact
+ * with LEDs to developers
+ *
+ * NOTE: If you add LEDs here, you must also add them to KeycodeLabels.h
+ */
+
+ ALED_NUM_LOCK = 0x00,
+ ALED_CAPS_LOCK = 0x01,
+ ALED_SCROLL_LOCK = 0x02,
+ ALED_COMPOSE = 0x03,
+ ALED_KANA = 0x04,
+ ALED_SLEEP = 0x05,
+ ALED_SUSPEND = 0x06,
+ ALED_MUTE = 0x07,
+ ALED_MISC = 0x08,
+ ALED_MAIL = 0x09,
+ ALED_CHARGING = 0x0a,
+ ALED_CONTROLLER_1 = 0x10,
+ ALED_CONTROLLER_2 = 0x11,
+ ALED_CONTROLLER_3 = 0x12,
+ ALED_CONTROLLER_4 = 0x13,
+};
+
/*
* SystemUiVisibility constants from View.
*/
diff --git a/include/input/KeyLayoutMap.h b/include/input/KeyLayoutMap.h
index eec11cf..1e8de71 100644
--- a/include/input/KeyLayoutMap.h
+++ b/include/input/KeyLayoutMap.h
@@ -67,6 +67,8 @@ public:
status_t mapKey(int32_t scanCode, int32_t usageCode,
int32_t* outKeyCode, uint32_t* outFlags) const;
status_t findScanCodesForKey(int32_t keyCode, Vector<int32_t>* outScanCodes) const;
+ status_t findScanCodeForLed(int32_t ledCode, int32_t* outScanCode) const;
+ status_t findUsageCodeForLed(int32_t ledCode, int32_t* outUsageCode) const;
status_t mapAxis(int32_t scanCode, AxisInfo* outAxisInfo) const;
@@ -79,9 +81,16 @@ private:
uint32_t flags;
};
+ struct Led {
+ int32_t ledCode;
+ };
+
+
KeyedVector<int32_t, Key> mKeysByScanCode;
KeyedVector<int32_t, Key> mKeysByUsageCode;
KeyedVector<int32_t, AxisInfo> mAxes;
+ KeyedVector<int32_t, Led> mLedsByScanCode;
+ KeyedVector<int32_t, Led> mLedsByUsageCode;
KeyLayoutMap();
@@ -99,6 +108,7 @@ private:
private:
status_t parseKey();
status_t parseAxis();
+ status_t parseLed();
};
};
diff --git a/include/input/Keyboard.h b/include/input/Keyboard.h
index 846cb0c..25b2f07 100644
--- a/include/input/Keyboard.h
+++ b/include/input/Keyboard.h
@@ -94,18 +94,24 @@ extern int32_t getKeyCodeByLabel(const char* label);
extern uint32_t getKeyFlagByLabel(const char* label);
/**
- * Gets a axis by its short form label, eg. "X".
+ * Gets an axis by its short form label, eg. "X".
* Returns -1 if unknown.
*/
extern int32_t getAxisByLabel(const char* label);
/**
- * Gets a axis label by its id.
+ * Gets an axis label by its id.
* Returns NULL if unknown.
*/
extern const char* getAxisLabel(int32_t axisId);
/**
+ * Gets an LED by its short form label, eg. "CAPS_LOCK".
+ * Returns -1 if unknown.
+ */
+extern int32_t getLedByLabel(const char* label);
+
+/**
* Updates a meta state field when a key is pressed or released.
*/
extern int32_t updateMetaState(int32_t keyCode, bool down, int32_t oldMetaState);
diff --git a/include/input/KeycodeLabels.h b/include/input/KeycodeLabels.h
index c64c5d8..19582e9 100644
--- a/include/input/KeycodeLabels.h
+++ b/include/input/KeycodeLabels.h
@@ -319,4 +319,26 @@ static const KeycodeLabel AXES[] = {
{ NULL, -1 }
};
+static const KeycodeLabel LEDS[] = {
+ { "NUM_LOCK", 0x00 },
+ { "CAPS_LOCK", 0x01 },
+ { "SCROLL_LOCK", 0x02 },
+ { "COMPOSE", 0x03 },
+ { "KANA", 0x04 },
+ { "SLEEP", 0x05 },
+ { "SUSPEND", 0x06 },
+ { "MUTE", 0x07 },
+ { "MISC", 0x08 },
+ { "MAIL", 0x09 },
+ { "CHARGING", 0x0a },
+ { "CONTROLLER_1", 0x10 },
+ { "CONTROLLER_2", 0x11 },
+ { "CONTROLLER_3", 0x12 },
+ { "CONTROLLER_4", 0x13 },
+
+ // NOTE: If you add new LEDs here, you must also add them to Input.h
+
+ { NULL, -1 }
+};
+
#endif // _LIBINPUT_KEYCODE_LABELS_H