OSDN Git Service

IRDA-2056: Remove a superfluous check
authorPatrick Porlan <patrick.porlan@intel.com>
Wed, 15 Oct 2014 12:22:02 +0000 (14:22 +0200)
committerViorel Suman <viorel.suman@intel.com>
Thu, 23 Oct 2014 12:59:06 +0000 (15:59 +0300)
We don't really have to check whether or not a sensor type is
defined as continuous by Android when we encounter a motion
trigger for the associated sensor. Simply record the name, and
we'll decide later if, and when, it has to be selected.

Change-Id: Ibc77470db1d66cc67f5e799f0db454e3157f3945
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Reviewed-on: https://android.intel.com:443/289217

enumeration.c

index 0db6c8b..25703fe 100644 (file)
@@ -513,33 +513,6 @@ static void orientation_sensor_check(void)
                        }
 }
 
-static int is_continuous (int s)
-{
-       /* Is sensor s of the continous trigger type kind? */
-
-       int catalog_index = sensor_info[s].catalog_index;
-       int sensor_type = sensor_catalog[catalog_index].type;
-
-       switch (sensor_type) {
-               case SENSOR_TYPE_ACCELEROMETER:
-               case SENSOR_TYPE_MAGNETIC_FIELD:
-               case SENSOR_TYPE_ORIENTATION:
-               case SENSOR_TYPE_GYROSCOPE:
-               case SENSOR_TYPE_PRESSURE:
-               case SENSOR_TYPE_GRAVITY:
-               case SENSOR_TYPE_LINEAR_ACCELERATION:
-               case SENSOR_TYPE_ROTATION_VECTOR:
-               case SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED:
-               case SENSOR_TYPE_GYROSCOPE_UNCALIBRATED:
-               case SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR:
-                       return 1;
-
-               default:
-                       return 0;
-       }
-}
-
-
 static void propose_new_trigger (int s, char trigger_name[MAX_NAME_SIZE],
                                 int sensor_name_len)
 {
@@ -555,19 +528,18 @@ static void propose_new_trigger (int s, char trigger_name[MAX_NAME_SIZE],
        if (!memcmp(suffix, "dev", 3))
                return;
 
-       /*
-        * If we found any-motion trigger, record it and force the sensor to
-        * automatic intermediate event generation mode, at least if it is of a
-        * continuously firing sensor type.
-        */
+       /* If we found any-motion trigger, record it */
 
-       if (!memcmp(suffix, "any-motion-", 11) && is_continuous(s)) {
-               /* Update the any-motion trigger name to use for this sensor */
+       if (!memcmp(suffix, "any-motion-", 11)) {
                strcpy(sensor_info[s].motion_trigger_name, trigger_name);
                return;
        }
 
-       /* Update the initial trigger name to use for this sensor */
+       /*
+        * It's neither the default "dev" nor an "any-motion" one. Make sure we
+        * use this though, as we may not have any other indication of the name
+        * of the trigger to use with this sensor.
+        */
        strcpy(sensor_info[s].init_trigger_name, trigger_name);
 }