summaryrefslogtreecommitdiffstats
path: root/tools/validatekeymaps
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-02-19 01:08:02 -0800
committerJeff Brown <jeffbrown@google.com>2011-02-19 05:23:10 -0800
commit6f2fba428ca5e77a26d991ad728e346cc47609ee (patch)
tree5dd07c24bd9b474ccfbcba4f63e078598fbd2b50 /tools/validatekeymaps
parentb1bdb64d641ac63097619e5ef08d5a25bfdc61bb (diff)
downloadframeworks_base-6f2fba428ca5e77a26d991ad728e346cc47609ee.zip
frameworks_base-6f2fba428ca5e77a26d991ad728e346cc47609ee.tar.gz
frameworks_base-6f2fba428ca5e77a26d991ad728e346cc47609ee.tar.bz2
Add new axes for joysticks and mouse wheels.
Added API on InputDevice to query the set of axes available. Added API on KeyEvent and MotionEvent to convert keycodes and axes to symbolic name strings for diagnostic purposes. Added API on KeyEvent to query if a given key code is a gamepad button. Added a new "axis" element to key layout files to specify the mapping between raw absolute axis values and motion axis ids. Expanded the axis bitfield to 64bits to allow for future growth. Modified the Makefile for keyboard prebuilts to run the keymap validation tool during the build. Added layouts for two game controllers. Added default actions for game pad button keys. Added more tests. Fixed a bunch of bugs. Change-Id: I73f9166c3b3c5bcf4970845b58088ad467525525
Diffstat (limited to 'tools/validatekeymaps')
-rw-r--r--tools/validatekeymaps/Main.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/tools/validatekeymaps/Main.cpp b/tools/validatekeymaps/Main.cpp
index 097b109..8ab9b6a 100644
--- a/tools/validatekeymaps/Main.cpp
+++ b/tools/validatekeymaps/Main.cpp
@@ -17,6 +17,7 @@
#include <ui/KeyCharacterMap.h>
#include <ui/KeyLayoutMap.h>
#include <ui/VirtualKeyMap.h>
+#include <utils/PropertyMap.h>
#include <utils/String8.h>
#include <stdio.h>
@@ -32,6 +33,7 @@ enum FileType {
FILETYPE_KEYLAYOUT,
FILETYPE_KEYCHARACTERMAP,
FILETYPE_VIRTUALKEYDEFINITION,
+ FILETYPE_INPUTDEVICECONFIGURATION,
};
@@ -39,9 +41,9 @@ static void usage() {
fprintf(stderr, "Keymap Validation Tool\n\n");
fprintf(stderr, "Usage:\n");
fprintf(stderr,
- " %s [*.kl] [*.kcm] [virtualkeys.*] [...]\n"
- " Validates the specified key layouts, key character maps \n"
- " or virtual key definitions.\n\n",
+ " %s [*.kl] [*.kcm] [*.idc] [virtualkeys.*] [...]\n"
+ " Validates the specified key layouts, key character maps, \n"
+ " input device configurations, or virtual key definitions.\n\n",
gProgName);
}
@@ -54,6 +56,9 @@ static FileType getFileType(const char* filename) {
if (strcmp(extension, ".kcm") == 0) {
return FILETYPE_KEYCHARACTERMAP;
}
+ if (strcmp(extension, ".idc") == 0) {
+ return FILETYPE_INPUTDEVICECONFIGURATION;
+ }
}
if (strstr(filename, "virtualkeys.")) {
@@ -92,6 +97,16 @@ static bool validateFile(const char* filename) {
break;
}
+ case FILETYPE_INPUTDEVICECONFIGURATION: {
+ PropertyMap* map;
+ status_t status = PropertyMap::load(String8(filename), &map);
+ if (status) {
+ fprintf(stderr, "Error %d parsing input device configuration file.\n\n", status);
+ return false;
+ }
+ break;
+ }
+
case FILETYPE_VIRTUALKEYDEFINITION: {
VirtualKeyMap* map;
status_t status = VirtualKeyMap::load(String8(filename), &map);