+ char filter_buf[MAX_NAME_SIZE];
+
+ /* By default, don't apply filtering */
+ sensor[s].filter_type = FILTER_TYPE_NONE;
+
+ /* If noisy, start with default filter for sensor type */
+ if (sensor[s].quirks & QUIRK_NOISY)
+ switch (sensor[s].type) {
+ case SENSOR_TYPE_GYROSCOPE:
+ sensor[s].filter_type = FILTER_TYPE_MEDIAN;
+ break;
+
+ case SENSOR_TYPE_MAGNETIC_FIELD:
+ sensor[s].filter_type = FILTER_TYPE_MOVING_AVERAGE;
+ break;
+ }
+
+ /* Use whatever was specified if there's an explicit configuration choice for this sensor */
+
+ filter_buf[0] = '\0';
+ sensor_get_st_prop(s, "filter", filter_buf);
+
+ if (strstr(filter_buf, "median"))
+ sensor[s].filter_type = FILTER_TYPE_MEDIAN;
+
+ if (strstr(filter_buf, "average"))
+ sensor[s].filter_type = FILTER_TYPE_MOVING_AVERAGE;
+
+ switch (sensor[s].filter_type) {
+ case FILTER_TYPE_MEDIAN: