}
}
-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)
{
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);
}