aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnric Balletbo i Serra <enric.balletbo@collabora.com>2020-03-31 18:11:17 +0200
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>2020-03-31 18:15:12 +0200
commitb344c17c0f6b9afeb2dd441984cc734c51b9d751 (patch)
treec5d460819b3c4f89a40a8e062faaa876a67ca824
parent78cc5674a1ea17ee91705cea7589645a5cd214f4 (diff)
downloadcros-ec-tests-b344c17c0f6b9afeb2dd441984cc734c51b9d751.tar.gz
test_cros_ec_gyro: 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_gyro.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/cros/tests/cros_ec_gyro.py b/cros/tests/cros_ec_gyro.py
index 1fcf243..c63741f 100644
--- a/cros/tests/cros_ec_gyro.py
+++ b/cros/tests/cros_ec_gyro.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 unittest
@@ -27,8 +29,17 @@ class TestCrosECGyro(unittest.TestCase):
"sampling_frequency_available",
"scale",
"scan_elements/",
- "trigger/",
]
sysfs_check_attributes_exists(
self, "/sys/bus/iio/devices", "cros-ec-gyro", 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-gyro", [
+ "trigger"], True
+ )
+ else:
+ sysfs_check_attributes_exists(
+ self, "/sys/bus/iio/devices", "cros-ec-gyro", ["trigger"], True
+ )