From 6f2fba428ca5e77a26d991ad728e346cc47609ee Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Sat, 19 Feb 2011 01:08:02 -0800 Subject: 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 --- tools/validatekeymaps/Main.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'tools/validatekeymaps') 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 #include #include +#include #include #include @@ -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); -- cgit v1.1