NonLinearity: don't try to load data if path unset

Previously, if no data file path was set in the gesture property, we'd
try to load a file called "None" (the default property value), and
(hopefully) that would fail. If there happened to be a file called
"None" in the current directory we'd try to load it as non-linearity
correction data. Otherwise, we'd log an error because of the file
loading failure even though we hadn't expected to find a data file.

BUG=b:314743031
TEST=unit tests; add the NonLinearityFilterInterpreter to the Touchpad2
     stack in gestures.cc, add a log line when attempting to load a
     file, and check the line doesn't appear a touchpad is connected

Change-Id: I010086adbf2b6ca69bda32c8c69fc00a239e5a20
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/gestures/+/5365863
Commit-Queue: Harry Cutts <hcutts@chromium.org>
Reviewed-by: Sean O'Brien <seobrien@chromium.org>
Tested-by: Harry Cutts <hcutts@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
diff --git a/src/non_linearity_filter_interpreter.cc b/src/non_linearity_filter_interpreter.cc
index df0e765..d871ba0 100644
--- a/src/non_linearity_filter_interpreter.cc
+++ b/src/non_linearity_filter_interpreter.cc
@@ -4,6 +4,8 @@
 
 #include "include/non_linearity_filter_interpreter.h"
 
+#include <cstring>
+
 #include <linux/in.h>
 
 namespace {
@@ -20,7 +22,7 @@
     : FilterInterpreter(nullptr, next, tracer, false),
       x_range_len_(0), y_range_len_(0), p_range_len_(0),
       enabled_(prop_reg, "Enable non-linearity correction", false),
-      data_location_(prop_reg, "Non-linearity correction data file", "None") {
+      data_location_(prop_reg, "Non-linearity correction data file", "") {
   InitName();
   LoadData();
 }
@@ -67,6 +69,9 @@
 }
 
 void NonLinearityFilterInterpreter::LoadData() {
+  if (strlen(data_location_.val_) == 0) {
+    return;
+  }
   FILE* data_fd = fopen(data_location_.val_, "rb");
   if (!data_fd) {
     Log("Unable to open non-linearity filter data '%s'", data_location_.val_);