CameraITS: skip checking events if a sensor does not exist
The ITS test_sensor_events and test_unified_timestamps tests check for
accelerometer, compass and gyro events if camera reports real-time
timestamp support. However, some devices may not have certain sensors.
Skip the checking if the corresponding sensor does not exist.
Test: Run ITS on a board without a compass
Bug: 76122643
Change-Id: I9a689a47c92b65bd986a4d8e0c5e4024c1f63409
diff --git a/apps/CameraITS/pymodules/its/device.py b/apps/CameraITS/pymodules/its/device.py
index 9c56ea7..e3b1916 100644
--- a/apps/CameraITS/pymodules/its/device.py
+++ b/apps/CameraITS/pymodules/its/device.py
@@ -310,6 +310,20 @@
if data['tag'] != 'vibrationStarted':
raise its.error.Error('Invalid command response')
+ def get_sensors(self):
+ """Get all sensors on the device.
+
+ Returns:
+ A Python dictionary that returns keys and booleans for each sensor.
+ """
+ cmd = {}
+ cmd["cmdName"] = "checkSensorExistence"
+ self.sock.send(json.dumps(cmd) + "\n")
+ data,_ = self.__read_response_from_socket()
+ if data['tag'] != 'sensorExistence':
+ raise its.error.Error('Invalid command response')
+ return data['objValue']
+
def start_sensor_events(self):
"""Start collecting sensor events on the device.