2 # By Chih-Wei Huang <cwhuang@linux.org.tw>
3 # Last updated 2009/07/18
5 # License: GNU Public License
6 # We explicitely grant the right to use the scripts
7 # with Android-x86 project.
10 # An auto detect function provided by kinneko
14 echo 'dev2mod() { while read dev; do case $dev in' > $tmp
15 sort -r /lib/modules/`uname -r`/modules.alias | \
16 sed -n 's/^alias *\([^ ]*\) *\(.*\)/\1)modprobe \2;;/p' >> $tmp
17 echo 'esac; done; }' >> $tmp
19 cat /sys/bus/*/devices/*/modalias | dev2mod
22 # FB0DEV: framebuffer driver
25 # SNDDEV: sound driver
26 # CAMDEV: camera driver
27 # PREDEV: any module the drivers depend on but can't be loaded automatically
28 # EXTMOD: any other module
32 # common for all Eee PC models
33 [ -c /dev/fb0 ] || FB0DEV=i915
35 PREDEV=snd-hda-codec-realtek
39 board=`cat /sys/class/dmi/id/product_name`
40 # assume Eee PC models
60 UVESA_MODE=${UVESA_MODE:-1366x768}
66 UVESA_MODE=${UVESA_MODE:-1024x600}
85 SNDDEV="snd-sb16 isapnp=0 irq=5"
102 grep -q "$1" /sys/class/dmi/id/uevent
107 check_product ASUSTeK && get_asus_info && return 0
108 check_product Acer.*AO && get_ao_info && return 0
109 check_product VirtualBox && get_vbox_info && return 0
110 check_product QEMU && get_qemu_info && return 0
111 check_product VMware && get_vmware_info && return 0
116 for wifi in `ls /sys/class/net`; do
117 w=/sys/class/net/$wifi
118 if [ -d $w/wireless -o -d $w/phy80211 ]; then
119 sed -i "s|\(^ *service wpa_supplicant .*\)\(-i.*\)\( -c.*$\)|\1-i $wifi\3|g; \
120 s|\(^ *service dhcpcd /system/bin/dhcpcd \)\(.*\)$|\1$wifi|g" init.rc
128 [ -z "$AUTO" ] && detect_hardware
129 if [ $? -eq 0 ]; then
130 for m in $PREDEV $EXTMOD; do
133 [ -n "$FB0DEV" -a -z "$UVESA_MODE" ] && modprobe $FB0DEV
134 [ -n "$LANDEV" ] && modprobe $LANDEV
135 [ -n "$WIFDEV" ] && modprobe $WIFDEV
136 [ -n "$SNDDEV" ] && modprobe $SNDDEV
137 [ -n "$CAMDEV" ] && modprobe $CAMDEV
143 [ -d /proc/asound/card0 ] || modprobe snd-dummy
144 [ -c /dev/fb0 ] || modprobe uvesafb mode_option=${UVESA_MODE:-800x600}-16 ${UVESA_OPTION:-mtrr=3 scroll=ywrap}