2 # By Chih-Wei Huang <cwhuang@linux.org.tw>
3 # Last updated 2009/08/14
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"
103 [ "$AUTO" = "1" ] && return
104 case "`cat /sys/class/dmi/id/uevent`" in
123 [ -n "$get_info" ] && $get_info && FOUND=1
126 find_network_dev_name()
129 rmline=`grep -n "#REMOVE FROM HERE" init.rc|cut -d':' -f1`
130 rmline=`expr $rmline + 1`
131 sed -i -e "$rmline,\$d" init.rc
132 for netdev in `ls /sys/class/net`; do
133 if [ $netdev = "lo" -o $netdev = "wmaster0" ]; then
136 w=/sys/class/net/$netdev
137 if [ -d $w/wireless -o -d $w/phy80211 ]; then
138 if [ $wififound -eq 0 ]; then
139 sed -i "s|\(^ *service wpa_supplicant .*\)\(-i.*\)\( -c.*$\)|\1-i $netdev\3|g" init.rc
143 echo "service dhcpcd$netdev /system/bin/dhcpcd $netdev" >> init.rc
144 echo " group system dhcp" >> init.rc
145 echo " disabled" >>init.rc
146 echo " oneshot" >> init.rc
152 if [ -n "$FOUND" ]; then
153 BTDEV="bnep rfcomm sco btusb"
154 for m in $BTDEV $PREDEV $EXTMOD; do
157 [ -n "$FB0DEV" -a -z "$UVESA_MODE" ] && modprobe $FB0DEV
158 [ -n "$LANDEV" ] && modprobe $LANDEV
159 [ -n "$WIFDEV" ] && modprobe $WIFDEV
160 [ -n "$SNDDEV" ] && modprobe $SNDDEV
161 [ -n "$CAMDEV" ] && modprobe $CAMDEV
167 [ -c /dev/video0 ] || modprobe vivi
168 [ -d /proc/asound/card0 ] || modprobe snd-dummy
169 [ -c /dev/fb0 ] || modprobe uvesafb mode_option=${UVESA_MODE:-800x600}-16 ${UVESA_OPTION:-mtrr=3 scroll=ywrap}
170 find_network_dev_name