Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b632185b authored by Harry Cutts's avatar Harry Cutts
Browse files

InputDevice: warn if a potential IDC file can't be opened

When probing for IDC files, we expect to get "File not found" errors,
but any other error could indicate a deeper problem (such as the
permissions issue that appears to be behind b/365593937). In that case,
it would be useful to have a warning log even if DEBUG_PROBE isn't set.

Test: remove the read permissions for everyone on an IDC file, then
      watch logcat for the InputDevice tag while connecting the
      corresponding device
Bug: 365593937
Flag: EXEMPT logging change
Change-Id: I022ec383f0c0b22a66524341530c055a69e05f0b
parent f20b6ba6
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -122,6 +122,10 @@ std::string getInputDeviceConfigurationFilePathByName(
            LOG_IF(INFO, DEBUG_PROBE)
                    << "Found system-provided input device configuration file at " << path;
            return path;
        } else if (errno != ENOENT) {
            LOG(WARNING) << "Couldn't find a system-provided input device configuration file at "
                         << path << " due to error " << errno << " (" << strerror(errno)
                         << "); there may be an IDC file there that cannot be loaded.";
        } else {
            LOG_IF(ERROR, DEBUG_PROBE)
                    << "Didn't find system-provided input device configuration file at " << path
@@ -142,6 +146,10 @@ std::string getInputDeviceConfigurationFilePathByName(
        LOG_IF(INFO, DEBUG_PROBE) << "Found system user input device configuration file at "
                                  << path;
        return path;
    } else if (errno != ENOENT) {
        LOG(WARNING) << "Couldn't find a system user input device configuration file at " << path
                     << " due to error " << errno << " (" << strerror(errno)
                     << "); there may be an IDC file there that cannot be loaded.";
    } else {
        LOG_IF(ERROR, DEBUG_PROBE) << "Didn't find system user input device configuration file at "
                                   << path << ": " << strerror(errno);