aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnric Balletbo i Serra <enric.balletbo@collabora.com>2020-03-31 18:07:20 +0200
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>2020-03-31 18:15:12 +0200
commit78cc5674a1ea17ee91705cea7589645a5cd214f4 (patch)
tree1174560b16cc0b8da738816d472fa030f44d2638
parent38886ab31c78fba902c6236e77e26a6705e14757 (diff)
downloadcros-ec-tests-78cc5674a1ea17ee91705cea7589645a5cd214f4.tar.gz
test_cros_ec_accel: Check trigger attribute only when is available
Since kernel commit aa984f1ba4a4 ("iio: cros_ec: Register to cros_ec_sensorhub when EC supports FIFO") the trigger attribute for some sensors is only exposed when the FIFO feature is not supported. So only check that attribute when that feature is not supported and on kernels before that patch was introduced. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
-rw-r--r--cros/tests/cros_ec_accel.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/cros/tests/cros_ec_accel.py b/cros/tests/cros_ec_accel.py
index 8cdf3b1..ec063d1 100644
--- a/cros/tests/cros_ec_accel.py
+++ b/cros/tests/cros_ec_accel.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
+from cros.helpers.kernel import *
+from cros.helpers.mcu import *
from cros.helpers.sysfs import *
import math
import unittest
@@ -28,11 +30,21 @@ class TestCrosECAccel(unittest.TestCase):
"sampling_frequency_available",
"scale",
"scan_elements/",
- "trigger/",
]
sysfs_check_attributes_exists(
self, "/sys/bus/iio/devices", "cros-ec-accel", files, True
)
+ if kernel_greater_than(5, 6, 0):
+ if not is_feature_supported(EC_FEATURE_MOTION_SENSE_FIFO):
+ sysfs_check_attributes_exists(
+ self, "/sys/bus/iio/devices", "cros-ec-accel", [
+ "trigger"], True
+ )
+ else:
+ sysfs_check_attributes_exists(
+ self, "/sys/bus/iio/devices", "cros-ec-accel", [
+ "trigger"], True
+ )
def test_cros_ec_accel_iio_data_is_valid(self):
""" Validates accelerometer data by computing the magnitude. If the