From f356d114daed148133e80daa0783ad0ff20db2d2 Mon Sep 17 00:00:00 2001 From: Chih-Wei Huang Date: Fri, 12 Jan 2018 17:41:15 +0800 Subject: [PATCH] init.sh: refine the rule of has_sensors Allow to set has_sensors variable via cmdline HAS_SENSORS=true/false. For sensors of iio type, if there is no acceleration sensors, treat it as no sensors. --- init.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init.sh b/init.sh index c77d483..07d463e 100644 --- a/init.sh +++ b/init.sh @@ -273,13 +273,16 @@ function init_hal_sensors() # has iio sensor-hub? if [ -n "`ls /sys/bus/iio/devices/iio:device* 2> /dev/null`" ]; then busybox chown -R 1000.1000 /sys/bus/iio/devices/iio:device*/ + [ -n "`ls /sys/bus/iio/devices/iio:device*/in_accel_x_raw 2> /dev/null`" ] && has_sensors=true hal_sensors=iio elif lsmod | grep -q lis3lv02d_i2c; then hal_sensors=hdaps + has_sensors=true + elif [ "$hal_sensors" != "kbd" ]; then + has_sensors=${HAS_SENSORS:-true} fi set_property ro.hardware.sensors $hal_sensors - [ "$hal_sensors" != "kbd" ] && has_sensors=true set_property config.override_forced_orient $has_sensors } -- 2.11.0