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
diff --git a/libs/input/InputDevice.cpp b/libs/input/InputDevice.cpp
index 962ce09..c903031 100644
--- a/libs/input/InputDevice.cpp
+++ b/libs/input/InputDevice.cpp
@@ -122,6 +122,10 @@
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 @@
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);