2 # Copyright (C) 2013 The Android-x86 Open Source Project
4 # License: GNU Public License v2 or later
7 function set_property()
9 # this must be run before post-fs stage
10 echo $1=$2 >> /x86.prop
15 # a hack for USB modem
16 lsusb | grep 1a8d:1000 && eject
18 # in case no cpu governor driver autoloads
19 [ -d /sys/devices/system/cpu/cpu0/cpufreq ] || modprobe acpi-cpufreq
23 echo on > /sys/bus/platform/drivers/sdhci-acpi/INT33BB:00/power/control
30 function init_hal_audio()
34 [ -d /proc/asound/card0 ] || modprobe snd-sb16 isapnp=0 irq=5
41 function init_hal_bluetooth()
43 for r in /sys/class/rfkill/*; do
45 [ "$type" = "wlan" -o "$type" = "bluetooth" ] && echo 1 > $r/state
48 # these modules are incompatible with bluedroid
54 function init_hal_camera()
56 [ -c /dev/video0 ] || modprobe vivi
59 function init_hal_gps()
65 function set_drm_mode()
75 [ -n "$drm_mode" ] && set_property debug.drm.mode.force $drm_mode
78 function init_uvesafb()
82 UVESA_MODE=${UVESA_MODE:-1280x800}
85 UVESA_MODE=${UVESA_MODE:-1600x900}
88 UVESA_MODE=${UVESA_MODE:-1024x600}
91 UVESA_MODE=${UVESA_MODE:-1024x768}
97 modprobe uvesafb mode_option=${UVESA_MODE:-800x600}-16 ${UVESA_OPTION:-mtrr=3 scroll=redraw}
100 function init_hal_gralloc()
102 case "$(cat /proc/fb | head -1)" in
103 0*inteldrmfb|0*radeondrmfb)
104 set_property ro.hardware.gralloc drm
113 [ "$HWACCEL" = "1" ] || set_property debug.egl.hw 0
118 function init_hal_hwcomposer()
124 function init_hal_lights()
126 chown 1000.1000 /sys/class/backlight/*/brightness
129 function init_hal_power()
131 for p in /sys/class/rtc/*; do
132 echo disabled > $p/device/power/wakeup
142 function init_hal_sensors()
144 case "$(cat $DMIPATH/uevent)" in
147 modprobe industrialio-triggered-buffer
148 modprobe hid-sensor-hub
149 modprobe hid-sensor-iio-common
150 modprobe hid-sensor-trigger
151 modprobe hid-sensor-accel-3d
152 modprobe hid-sensor-gyro-3d
153 modprobe hid-sensor-als
154 modprobe hid-sensor-magn-3d
155 sleep 1; busybox chown -R 1000.1000 /sys/bus/iio/devices/iio:device?/
156 set_property ro.hardware.sensors hsb
159 set_property ro.ignore_atkbd 1
160 set_property ro.hardware.sensors hdaps
163 set_property ro.hardware.sensors w500
166 set_property ro.hardware.sensors s103t
171 set_property ro.ignore_atkbd 1
172 set_property ro.hardware.sensors kbd
173 set_property hal.sensors.kbd.type 2
175 *TEGA*|*2010:svnIntel:*)
176 set_property ro.ignore_atkbd 1
177 set_property ro.hardware.sensors kbd
178 set_property hal.sensors.kbd.type 1
185 set_property ro.hardware.sensors kbd
186 set_property hal.sensors.kbd.type 6
187 set_property poweroff.doubleclick 0
188 set_property qemu.hw.mainkeys 1
191 set_property ro.ignore_atkbd 1
192 set_property poweroff.doubleclick 0
195 modprobe lis3lv02d_i2c
196 set_property ro.hardware.sensors hdaps
197 echo -n "enabled" > /sys/class/thermal/thermal_zone0/mode
201 set_property ro.hardware.sensors hdaps
204 set_property ro.hardware.sensors kbd
209 function create_pointercal()
211 if [ ! -e /data/misc/tscal/pointercal ]; then
212 mkdir -p /data/misc/tscal
213 touch /data/misc/tscal/pointercal
214 chown 1000.1000 /data/misc/tscal /data/misc/tscal/*
215 chmod 775 /data/misc/tscal
216 chmod 664 /data/misc/tscal/pointercal
220 function init_tscal()
223 T91|T101|ET2002|74499FU|945GSE-ITE8712)
231 for usbts in $(lsusb | awk '{ print $6 }'); do
245 case "$(cat $DMIPATH/uevent)" in
246 *TEGA*|*2010:svnIntel:*|*Lucid-MWE*)
247 set_property rild.libpath /system/lib/libhuaweigeneric-ril.so
248 set_property rild.libargs "-d /dev/ttyUSB2 -v /dev/ttyUSB1"
251 set_property rild.libpath /system/lib/libreference-ril.so
252 set_property rild.libargs "-d /dev/ttyUSB2"
257 function init_cpu_governor()
259 governor=$(getprop cpu.governor)
262 for cpu in $(ls -d /sys/devices/system/cpu/cpu?); do
263 echo $governor > $cpu/cpufreq/scaling_governor || return 1
286 function do_netconsole()
288 modprobe netconsole netconsole="@/,@$(getprop dhcp.eth0.gateway)/"
291 function do_bootcomplete()
295 [ -z "$(getprop persist.sys.root_access)" ] && setprop persist.sys.root_access 3
297 # FIXME: autosleep works better on i965?
298 [ "$(getprop debug.mesa.driver)" = "i965" ] && setprop debug.autosleep 1
300 for bt in $(lsusb -v | awk ' /Class:.E0/ { print $9 } '); do
301 chown 1002.1002 $bt && chmod 660 $bt
305 1866???|1867???|1869???) # ThinkPad X41 Tablet
316 6363???|6364???|6366???) # ThinkPad X60 Tablet
318 7762???|7763???|7767???) # ThinkPad X61 Tablet
329 7448???|7449???|7450???|7453???) # ThinkPad X200 Tablet
332 setkeycodes 0xe012 158
340 # [ -d /proc/asound/card0 ] || modprobe snd-dummy
341 for c in $(grep '\[.*\]' /proc/asound/cards | awk '{print $1}'); do
342 f=/system/etc/alsa/$(cat /proc/asound/card$c/id).state
344 alsa_ctl -f $f restore $c
347 alsa_amixer -c $c set Master on
348 alsa_amixer -c $c set Master 100%
349 alsa_amixer -c $c set Headphone on
350 alsa_amixer -c $c set Headphone 100%
351 alsa_amixer -c $c set Speaker 100%
352 alsa_amixer -c $c set Capture 100%
353 alsa_amixer -c $c set Capture cap
354 alsa_amixer -c $c set PCM 100 unmute
355 alsa_amixer -c $c set 'Mic Boost' 3
356 alsa_amixer -c $c set 'Internal Mic Boost' 3
361 PATH=/system/bin:/system/xbin
363 DMIPATH=/sys/class/dmi/id
364 BOARD=$(cat $DMIPATH/board_name)
365 PRODUCT=$(cat $DMIPATH/product_name)
367 # import cmdline variables
368 for c in `cat /proc/cmdline`; do
370 androidboot.hardware=*)
378 [ -n "$DEBUG" ] && set -x || exec &> /dev/null
380 # import the vendor specific script
381 hw_sh=/vendor/etc/init.sh
382 [ -e $hw_sh ] && source $hw_sh
386 [ -n "$DEBUG" ] && do_netconsole