Loading include/input/InputDevice.h +9 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,15 @@ struct InputDeviceIdentifier { // is intended to be a minimum way to distinguish from other active devices and may // reuse values that are not associated with an input anymore. uint16_t nonce; /** * Return InputDeviceIdentifier.name that has been adjusted as follows: * - all characters besides alphanumerics, dash, * and underscore have been replaced with underscores. * This helps in situations where a file that matches the device name is needed, * while conforming to the filename limitations. */ std::string getCanonicalName() const; }; /* Loading libs/input/InputDevice.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,18 @@ std::string getInputDeviceConfigurationFilePathByName( return ""; } // --- InputDeviceIdentifier std::string InputDeviceIdentifier::getCanonicalName() const { std::string replacedName = name; for (char& ch : replacedName) { if (!isValidNameChar(ch)) { ch = '_'; } } return replacedName; } // --- InputDeviceInfo --- Loading services/inputflinger/EventHub.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -1617,7 +1617,7 @@ bool EventHub::loadVirtualKeyMapLocked(Device* device) { // The virtual key map is supplied by the kernel as a system board property file. std::string path; path += "/sys/board_properties/virtualkeys."; path += device->identifier.name; path += device->identifier.getCanonicalName(); if (access(path.c_str(), R_OK)) { return false; } Loading Loading
include/input/InputDevice.h +9 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,15 @@ struct InputDeviceIdentifier { // is intended to be a minimum way to distinguish from other active devices and may // reuse values that are not associated with an input anymore. uint16_t nonce; /** * Return InputDeviceIdentifier.name that has been adjusted as follows: * - all characters besides alphanumerics, dash, * and underscore have been replaced with underscores. * This helps in situations where a file that matches the device name is needed, * while conforming to the filename limitations. */ std::string getCanonicalName() const; }; /* Loading
libs/input/InputDevice.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,18 @@ std::string getInputDeviceConfigurationFilePathByName( return ""; } // --- InputDeviceIdentifier std::string InputDeviceIdentifier::getCanonicalName() const { std::string replacedName = name; for (char& ch : replacedName) { if (!isValidNameChar(ch)) { ch = '_'; } } return replacedName; } // --- InputDeviceInfo --- Loading
services/inputflinger/EventHub.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -1617,7 +1617,7 @@ bool EventHub::loadVirtualKeyMapLocked(Device* device) { // The virtual key map is supplied by the kernel as a system board property file. std::string path; path += "/sys/board_properties/virtualkeys."; path += device->identifier.name; path += device->identifier.getCanonicalName(); if (access(path.c_str(), R_OK)) { return false; } Loading