device/generic/common
Revision | f356d114daed148133e80daa0783ad0ff20db2d2 (tree) |
---|---|
Time | 2018-01-12 18:41:15 |
Author | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
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.
@@ -273,13 +273,16 @@ function init_hal_sensors() | ||
273 | 273 | # has iio sensor-hub? |
274 | 274 | if [ -n "`ls /sys/bus/iio/devices/iio:device* 2> /dev/null`" ]; then |
275 | 275 | busybox chown -R 1000.1000 /sys/bus/iio/devices/iio:device*/ |
276 | + [ -n "`ls /sys/bus/iio/devices/iio:device*/in_accel_x_raw 2> /dev/null`" ] && has_sensors=true | |
276 | 277 | hal_sensors=iio |
277 | 278 | elif lsmod | grep -q lis3lv02d_i2c; then |
278 | 279 | hal_sensors=hdaps |
280 | + has_sensors=true | |
281 | + elif [ "$hal_sensors" != "kbd" ]; then | |
282 | + has_sensors=${HAS_SENSORS:-true} | |
279 | 283 | fi |
280 | 284 | |
281 | 285 | set_property ro.hardware.sensors $hal_sensors |
282 | - [ "$hal_sensors" != "kbd" ] && has_sensors=true | |
283 | 286 | set_property config.override_forced_orient $has_sensors |
284 | 287 | } |
285 | 288 |