Fix events log parsing on ARM platform

The patch mainly fixes the bug of parsing the additional evdev info
(bitmasks) in the event log file on ARM platform where the size of
long is 4 bytes instead of 8 bytes on x86_64 machines. Therefore,
extra remaining bytes in the line should be read and skipped.

BUG=chromium:236282
TEST=run_remote_test --remote daisy_ip platform_GesturesRegressionTest

Change-Id: I5f5a239da209b172b6d0768c279311977479bc9f
Reviewed-on: https://gerrit.chromium.org/gerrit/49458
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Queue: Chung-yih Wang <cywang@chromium.org>
Tested-by: Chung-yih Wang <cywang@chromium.org>
diff --git a/src/libevdev.c b/src/libevdev.c
index ed76cdf..0bf71bd 100644
--- a/src/libevdev.c
+++ b/src/libevdev.c
@@ -404,8 +404,8 @@
   int ret;
   char name[64];
 
-  ret = fscanf(fp, "# %64s:", name);
-  if (ret <= 0 || strcmp(name, expected_name) == 0)
+  ret = fscanf(fp, "# %63[^:]:", name);
+  if (ret <= 0 || strcmp(name, expected_name))
     return ret;
   for (int i = 0; i < num_bytes; ++i) {
     unsigned int tmp;
@@ -415,7 +415,12 @@
     else
       bytes[i] = (unsigned char)tmp;
   }
-  ret = fscanf(fp, "\n");
+  // size(in bytes) of bitmask array may differs per platform, try to read
+  // remaining bytes if exists
+  do {
+    if (fgets(name, sizeof(name), fp) == NULL)
+      return -1;
+  } while (name[strlen(name) - 1] != '\n');
   return 1;
 }