OSDN Git Service

init.sh: add support of iio sensors
authorChih-Wei Huang <cwhuang@linux.org.tw>
Sat, 6 Jun 2015 00:39:30 +0000 (08:39 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 16 Jul 2015 18:56:50 +0000 (02:56 +0800)
device.mk
init.sh

index 1b80997..f60b5c4 100644 (file)
--- a/device.mk
+++ b/device.mk
@@ -54,11 +54,12 @@ PRODUCT_COPY_FILES += \
     frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml \
     frameworks/native/data/etc/android.hardware.location.xml:system/etc/permissions/android.hardware.location.xml \
     frameworks/native/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml \
-    frameworks/native/data/etc/android.hardware.sensor.proximity.xml:system/etc/permissions/android.hardware.sensor.proximity.xml \
-    frameworks/native/data/etc/android.hardware.sensor.light.xml:system/etc/permissions/android.hardware.sensor.light.xml \
-    frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:system/etc/permissions/android.hardware.sensor.gyroscope.xml \
-    frameworks/native/data/etc/android.hardware.sensor.barometer.xml:system/etc/permissions/android.hardware.sensor.barometer.xml \
     frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:system/etc/permissions/android.hardware.sensor.accelerometer.xml \
+    frameworks/native/data/etc/android.hardware.sensor.barometer.xml:system/etc/permissions/android.hardware.sensor.barometer.xml \
+    frameworks/native/data/etc/android.hardware.sensor.compass.xml:system/etc/permissions/android.hardware.sensor.compass.xml \
+    frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:system/etc/permissions/android.hardware.sensor.gyroscope.xml \
+    frameworks/native/data/etc/android.hardware.sensor.light.xml:system/etc/permissions/android.hardware.sensor.light.xml \
+    frameworks/native/data/etc/android.hardware.sensor.proximity.xml:system/etc/permissions/android.hardware.sensor.proximity.xml \
     frameworks/native/data/etc/android.hardware.touchscreen.multitouch.distinct.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.distinct.xml \
     frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \
     frameworks/native/data/etc/android.hardware.usb.accessory.xml:system/etc/permissions/android.hardware.usb.accessory.xml \
diff --git a/init.sh b/init.sh
index 906f081..8758717 100644 (file)
--- a/init.sh
+++ b/init.sh
@@ -20,6 +20,7 @@ function init_misc()
 
        case "$PRODUCT" in
                T10*TA)
+                       modprobe ak8975
                        ;;
                *)
                        ;;
@@ -206,11 +207,9 @@ function init_hal_sensors()
 
        # has sensor-hub?
        for i in /sys/bus/iio/devices/iio:device?; do
-               if [ -e $i/in_accel_scale ]; then
-                       busybox chown -R 1000.1000 /sys/bus/iio/devices/iio:device?/
-                       hal_sensors=hsb
-                       break
-               fi
+               busybox chown -R 1000.1000 /sys/bus/iio/devices/iio:device?/
+               lsmod | grep -q hid_sensor_accel_3d && hal_sensors=hsb || hal_sensors=iio
+               break
        done
 
        set_property ro.hardware.sensors $hal_sensors