OSDN Git Service

init.sh: check driver name instead of fb name
[android-x86/device-generic-common.git] / init.sh
diff --git a/init.sh b/init.sh
index d2c52ad..25f283b 100644 (file)
--- a/init.sh
+++ b/init.sh
@@ -36,7 +36,7 @@ function init_misc()
 
        # enable sdcardfs if /data is not mounted on tmpfs or 9p
        mount | grep /data\ | grep -qE 'tmpfs|9p'
-       [ $? -ne 0 ] && modprobe sdcardfs
+       [ $? -eq 0 ] && set_prop_if_empty ro.sys.sdcardfs false
 
        # remove wl if it's not used
        local wifi
@@ -66,13 +66,10 @@ function init_hal_audio()
                VirtualBox*|Bochs*)
                        [ -d /proc/asound/card0 ] || modprobe snd-sb16 isapnp=0 irq=5
                        ;;
-               *)
+               TS10*)
+                       set_prop_if_empty hal.audio.out pcmC0D2p
                        ;;
        esac
-
-       if grep -qi "IntelHDMI" /proc/asound/card0/id; then
-               [ -d /proc/asound/card1 ] || set_property ro.hardware.audio.primary hdmi
-       fi
 }
 
 function init_hal_bluetooth()
@@ -132,6 +129,9 @@ function init_hal_bluetooth()
 function init_hal_camera()
 {
        case "$UEVENT" in
+               *81EK*)
+                       set_prop_if_empty hal.camera.0 0,0
+                       ;;
                *e-tabPro*)
                        set_prop_if_empty hal.camera.0 0,270
                        set_prop_if_empty hal.camera.2 1,90
@@ -182,25 +182,25 @@ function init_uvesafb()
 
 function init_hal_gralloc()
 {
-       case "$(cat /proc/fb | head -1)" in
-               *virtiodrmfb)
-                       if [ "$HWACCEL" != "0" ]; then
-                               set_property ro.hardware.hwcomposer drm
-                               set_property ro.hardware.gralloc gbm
-                               set_property debug.drm.mode.force ${video:-1280x800}
-                       fi
-                       set_prop_if_empty sleep.state none
-                       ;;
-               0*inteldrmfb|0*radeondrmfb|0*nouveaufb|0*svgadrmfb|0*amdgpudrmfb)
+       [ "$VULKAN" = "1" ] && GRALLOC=gbm
+
+       case "$(readlink /sys/class/graphics/fb0/device/driver)" in
+               *virtio_gpu)
+                       HWC=${HWC:-drm}
+                       GRALLOC=${GRALLOC:-gbm}
+                       video=${video:-1280x768}
+                       ;&
+               *i915|*radeon|*nouveau|*vmwgfx|*amdgpu)
                        if [ "$HWACCEL" != "0" ]; then
-                               set_property ro.hardware.gralloc drm
+                               ${HWC:+set_property ro.hardware.hwcomposer $HWC}
+                               set_property ro.hardware.gralloc ${GRALLOC:-drm}
                                set_drm_mode
                        fi
                        ;;
                "")
                        init_uvesafb
                        ;&
-               0*)
+               *)
                        ;;
        esac
 
@@ -213,6 +213,20 @@ function init_hal_hwcomposer()
        return
 }
 
+function init_hal_vulkan()
+{
+       case "$(readlink /sys/class/graphics/fb0/device/driver)" in
+               *i915)
+                       set_property ro.hardware.vulkan android-x86
+                       ;;
+               *amdgpu)
+                       set_property ro.hardware.vulkan radv
+                       ;;
+               *)
+                       ;;
+       esac
+}
+
 function init_hal_lights()
 {
        chown 1000.1000 /sys/class/backlight/*/brightness
@@ -226,7 +240,7 @@ function init_hal_power()
 
        # TODO
        case "$PRODUCT" in
-               HP*Omni*|OEMB|Surface*3|T10*TA)
+               HP*Omni*|OEMB|Standard*PC*|Surface*3|T10*TA|VMware*)
                        set_prop_if_empty sleep.state none
                        ;;
                e-tab*Pro)
@@ -371,7 +385,7 @@ function init_tscal()
                *ST70416-6*)
                        modprobe gslx680_ts_acpi
                        ;&
-               *T91*|*T101*|*ET2002*|*74499FU*|*945GSE-ITE8712*|*CF-19[CDYFGKLP]*|*TECLAST:rntPAD*)
+               *81EK*|*T91**|*T101*|*ET2002*|*74499FU*|*945GSE-ITE8712*|*CF-19[CDYFGKLP]*|*TECLAST:rntPAD*)
                        create_pointercal
                        return
                        ;;
@@ -425,6 +439,7 @@ function do_init()
        init_hal_gps
        init_hal_gralloc
        init_hal_hwcomposer
+       init_hal_vulkan
        init_hal_lights
        init_hal_power
        init_hal_sensors
@@ -483,6 +498,9 @@ function do_bootcomplete()
                Surface*Go)
                        echo on > /sys/devices/pci0000:00/0000:00:15.1/i2c_designware.1/power/control
                        ;;
+               VMware*)
+                       pm disable com.android.bluetooth
+                       ;;
                X80*Power)
                        set_property power.nonboot-cpu-off 1
                        ;;
@@ -504,7 +522,7 @@ function do_bootcomplete()
                        alsa_amixer -c $c set Speaker 100%
                        alsa_amixer -c $c set Capture 80%
                        alsa_amixer -c $c set Capture cap
-                       alsa_amixer -c $c set PCM 100 unmute
+                       alsa_amixer -c $c set PCM 100% unmute
                        alsa_amixer -c $c set SPO unmute
                        alsa_amixer -c $c set IEC958 on
                        alsa_amixer -c $c set 'Mic Boost' 1