Rename the semi-mt specific handling with the single-pressure

Since the new kernel driver reports the data with MT-B format on Cr48, we don't
need the extra manipulations for semi-mt properties such as ABS_PRESSURE.
However, we still keep the single-pressure handling for other semi-mt devices
if it applies.

BUG=chromium-os:32681
TEST=on device, the touchpad still works correctly.

Change-Id: I9db4b4427c84de3e87717eb9c498eacdac4cd42d
Reviewed-on: https://gerrit.chromium.org/gerrit/28162
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Commit-Ready: Chung-yih Wang <cywang@chromium.org>
Reviewed-by: Chung-yih Wang <cywang@chromium.org>
Tested-by: Chung-yih Wang <cywang@chromium.org>
diff --git a/include/libevdev/libevdev.h b/include/libevdev/libevdev.h
index 21d4ad5..1cfe36c 100644
--- a/include/libevdev/libevdev.h
+++ b/include/libevdev/libevdev.h
@@ -62,5 +62,6 @@
 int EvdevProbeMTSlot(EvdevPtr device, MTSlotInfoPtr req);
 int EvdevProbeKeyState(EvdevPtr device);
 int EvdevEnableMonotonic(EvdevPtr device);
+int EvdevIsSinglePressureDevice(EvdevPtr device);
 
 #endif
diff --git a/src/libevdev.c b/src/libevdev.c
index 877a4bf..45914c9 100644
--- a/src/libevdev.c
+++ b/src/libevdev.c
@@ -210,6 +210,16 @@
   }
 }
 
+/*
+ * Check if the device is a single-pressure one which reports ABS_PRESSURE only.
+ */
+int EvdevIsSinglePressureDevice(EvdevPtr device) {
+    EvdevInfoPtr info = &device->info;
+
+    return (!TestBit(ABS_MT_PRESSURE, info->bitmask) &&
+            TestBit(ABS_PRESSURE, info->bitmask));
+}
+
 int EvdevProbeMTSlot(EvdevPtr device, MTSlotInfoPtr req) {
   if (ioctl(device->fd, EVIOCGMTSLOTS((sizeof(*req))), req) < 0) {
       LOG_ERROR(device, "ioctl EVIOCGMTSLOTS(req.code=%d) failed: %s\n",
diff --git a/src/libevdev_event.c b/src/libevdev_event.c
index 5100d07..464f72d 100644
--- a/src/libevdev_event.c
+++ b/src/libevdev_event.c
@@ -42,7 +42,7 @@
 
 static void Event_Abs(EvdevPtr, struct input_event*);
 static void Event_Abs_MT(EvdevPtr, struct input_event*);
-static void SemiMtSetAbsPressure(EvdevPtr, struct input_event*);
+static void Event_Abs_Update_Pressure(EvdevPtr, struct input_event*);
 
 static void Event_Get_Time(struct timeval*, bool);
 
@@ -335,14 +335,12 @@
 
     EvdevProbeKeyState(device);
 
-    /* Get current pressure information for semi_mt device */
-    if (Event_Get_Semi_MT(device)) {
-        if (EvdevProbeAbsinfo(device, ABS_PRESSURE) == Success) {
-            struct input_event ev;
-            ev.code = ABS_PRESSURE;
-            ev.value = device->info.absinfo[ABS_PRESSURE].value;
-            SemiMtSetAbsPressure(device, &ev);
-        }
+    /* Get current pressure information for single-pressure device */
+    if (EvdevIsSinglePressureDevice(device) == Success) {
+        struct input_event ev;
+        ev.code = ABS_PRESSURE;
+        ev.value = device->info.absinfo[ABS_PRESSURE].value;
+        Event_Abs_Update_Pressure(device, &ev);
     }
 
     /* TODO(cywang): Sync all ABS_ states for completeness */
@@ -524,11 +522,11 @@
 }
 
 static void
-SemiMtSetAbsPressure(EvdevPtr device, struct input_event* ev)
+Event_Abs_Update_Pressure(EvdevPtr device, struct input_event* ev)
 {
     /*
      * Update all active slots with the same ABS_PRESSURE value if it is a
-     * semi-mt device.
+     * single-pressure device.
      */
     EventStatePtr evstate = device->evstate;
 
@@ -545,8 +543,8 @@
         MT_Slot_Set(device, ev->value);
     else if (IS_ABS_MT(ev->code))
         Event_Abs_MT(device, ev);
-    else if ((ev->code == ABS_PRESSURE) && Event_Get_Semi_MT(device))
-        SemiMtSetAbsPressure(device, ev);
+    else if ((ev->code == ABS_PRESSURE) && EvdevIsSinglePressureDevice(device))
+        Event_Abs_Update_Pressure(device, ev);
 }
 
 static void