if (strstr(quirks_buf, "spotty"))
sensor[s].quirks |= QUIRK_SPOTTY;
+ if (strstr(quirks_buf, "no-event"))
+ sensor[s].quirks |= QUIRK_NO_EVENT_MODE;
+
+ if (strstr(quirks_buf, "no-trig"))
+ sensor[s].quirks |= QUIRK_NO_TRIG_MODE;
+
+ if (strstr(quirks_buf, "no-poll"))
+ sensor[s].quirks |= QUIRK_NO_POLL_MODE;
+
sensor[s].quirks |= QUIRK_ALREADY_DECODED;
}
#define QUIRK_NOISY 0x10 /* High noise level on readings */
#define QUIRK_FORCE_CONTINUOUS 0x20 /* Force usage of continuous trigger */
#define QUIRK_BIASED 0x40 /* Biased sensor, requires compensation */
-#define QUIRK_SPOTTY 0x80 /* Driver may lose events */
+#define QUIRK_SPOTTY 0x80 /* Driver may lose events */
+#define QUIRK_NO_EVENT_MODE 0x100 /* Disable event mode */
+#define QUIRK_NO_TRIG_MODE 0x200 /* Disable trigger mode */
+#define QUIRK_NO_POLL_MODE 0x400 /* Disable poll mode */
#ifdef __LP64__
typedef uint64_t flag_t;
}
-static void add_sensor (int dev_num, int catalog_index, int mode)
+static int add_sensor (int dev_num, int catalog_index, int mode)
{
int s;
int sensor_type;
if (sensor_count == MAX_SENSORS) {
ALOGE("Too many sensors!\n");
- return;
+ return -1;
}
sensor_type = sensor_catalog[catalog_index].type;
else
sensor[s].num_channels = num_channels;
+ /* Populate the quirks array */
+ sensor_get_quirks(s);
+
+ /* Reject interfaces that may have been disabled through a quirk for this driver */
+ if ((mode == MODE_EVENT && (sensor[s].quirks & QUIRK_NO_EVENT_MODE)) ||
+ (mode == MODE_TRIGGER && (sensor[s].quirks & QUIRK_NO_TRIG_MODE )) ||
+ (mode == MODE_POLL && (sensor[s].quirks & QUIRK_NO_POLL_MODE ))) {
+ memset(&sensor[s], 0, sizeof(sensor[0]));
+ return -1;
+ }
+
prefix = sensor_catalog[catalog_index].tag;
/*
populate_descriptors(s, sensor_type);
- /* Populate the quirks array */
- sensor_get_quirks(s);
-
if (sensor[s].internal_name[0] == '\0') {
/*
* In case the kernel-mode driver doesn't expose a name for
sensor[s].needs_enable = get_needs_enable(dev_num, sensor_catalog[catalog_index].tag);
sensor_count++;
+ return 0;
}
static void virtual_sensors_check (void)
discover_sensors(dev_num, EVENTS_PATH, event_sensors, check_event_sensors);
for (i=0; i<catalog_size; i++) {
- if (event_sensors[i]) {
- add_sensor(dev_num, i, MODE_EVENT);
+ /* Try using events interface */
+ if (event_sensors[i] && !add_sensor(dev_num, i, MODE_EVENT))
continue;
- }
- if (trig_sensors[i]) {
- add_sensor(dev_num, i, MODE_TRIGGER);
+
+ /* Then trigger */
+ if (trig_sensors[i] && !add_sensor(dev_num, i, MODE_TRIGGER)) {
trig_found = 1;
continue;
}
- if (poll_sensors[i]) {
+
+ /* Try polling otherwise */
+ if (poll_sensors[i])
add_sensor(dev_num, i, MODE_POLL);
- continue;
- }
}
if (trig_found)
init-rate : set sampling rate at 10 Hz after enabling that sensor
biased : the sensor has unusually high bias ; engage high bias detection and compensation routines
spotty : the sensor may have gaps in its events sequence ; adjust timestamps accordingly
+no-poll : specifically disable the iio polling (sysfs) way of getting data from this driver, even if it's seemingly available
+no-trig : specifically disable the iio trigger way of getting data from this driver, even if it's seemingly available
+no-event : specifically disable the iio event way of getting data from this driver, even if it's seemingly available
FILTERING