From 96a74f0cdc8b3b5048b29c1ec02871726b712c86 Mon Sep 17 00:00:00 2001 From: chencheng31 Date: Thu, 7 Jul 2022 10:14:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AE=9A=E7=82=B9=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E9=99=90=E5=AE=9A=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chencheng31 --- include/key_parser.h | 3 ++- include/resource_data.h | 13 ++++++++++++- src/key_parser.cpp | 14 +++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/include/key_parser.h b/include/key_parser.h index a4cedaa..eb20d14 100644 --- a/include/key_parser.h +++ b/include/key_parser.h @@ -43,6 +43,7 @@ private: static bool ParseOrientation(const std::string &folderName, std::vector &keyparams); static bool ParseDeviceType(const std::string &folderName, std::vector &keyparams); static bool ParseNightMode(const std::string &folderName, std::vector &keyparams); + static bool ParseInputDevice(const std::string &folderName, std::vector &keyparams); static bool ParseResolution(const std::string &folderName, std::vector &keyparams); static void PushMccMnc(const std::string &folderName, KeyType type, std::vector &keyparams); @@ -57,4 +58,4 @@ private: } } } -#endif \ No newline at end of file +#endif diff --git a/include/resource_data.h b/include/resource_data.h index 92c3fee..f6e663c 100644 --- a/include/resource_data.h +++ b/include/resource_data.h @@ -32,7 +32,7 @@ const static std::string ID_DEFINED_FILE = "id_defined.json"; const static std::string RESOURCE_INDEX_FILE = "resources.index"; const static std::string SEPARATOR = "/"; const static int32_t VERSION_MAX_LEN = 128; -static const int8_t RESTOOL_VERSION[VERSION_MAX_LEN] = { "Restool 2.008" }; +static const int8_t RESTOOL_VERSION[VERSION_MAX_LEN] = { "Restool 2.009" }; const static int32_t TAG_LEN = 4; enum class KeyType { @@ -45,6 +45,8 @@ enum class KeyType { NIGHTMODE = 6, MCC = 7, MNC = 8, + // RESERVER 9 + INPUTDEVICE = 10, KEY_TYPE_MAX, }; @@ -125,6 +127,15 @@ const std::map g_nightModeMap = { { "light", NightMode::LIGHT }, }; +enum class InputDevice { + INPUTDEVICE_NOT_SET = -1, + INPUTDEVICE_POINTINGDEVICE = 0, +}; + +const std::map g_inputDeviceMap = { + { "pointingdevice", InputDevice::INPUTDEVICE_POINTINGDEVICE }, +}; + struct KeyParam { KeyType keyType; uint32_t value; diff --git a/src/key_parser.cpp b/src/key_parser.cpp index cb04113..5534186 100644 --- a/src/key_parser.cpp +++ b/src/key_parser.cpp @@ -41,6 +41,7 @@ bool KeyParser::Parse(const string &folderName, vector &keyparams) ParseOrientation, ParseDeviceType, ParseNightMode, + ParseInputDevice, ParseResolution, }; @@ -224,6 +225,17 @@ bool KeyParser::ParseNightMode(const string &folderName, vector &keypa return true; } +bool KeyParser::ParseInputDevice(const string &folderName, vector &keyparams) +{ + auto it = g_inputDeviceMap.find(folderName); + if (it == g_inputDeviceMap.end()) { + return false; + } + + PushValue(static_cast(it->second), KeyType::INPUTDEVICE, keyparams); + return true; +} + bool KeyParser::ParseResolution(const string &folderName, vector &keyparams) { auto it = g_resolutionMap.find(folderName); @@ -263,4 +275,4 @@ void KeyParser::PushValue(uint32_t value, KeyType type, vector &keypar } } } -} \ No newline at end of file +}