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}
84 [ -c /dev/fb0 ] || FB0DEV=i915
86 PREDEV=snd-hda-codec-realtek mii rfkill
96 SNDDEV="snd-sb16 isapnp=0 irq=5"
114 [ "$AUTO" = "1" ] && return
115 case "`cat /sys/class/dmi/id/uevent`" in
120 get_info=samsung_info
137 [ -n "$get_info" ] && $get_info && FOUND=1
140 find_network_dev_name()
143 rmline=`grep -n "#REMOVE FROM HERE" init.rc|cut -d':' -f1`
144 rmline=`expr $rmline + 1`
145 sed -i -e "$rmline,\$d" init.rc
146 for netdev in `ls /sys/class/net`; do
147 if [ $netdev = "lo" -o $netdev = "wmaster0" ]; then
150 w=/sys/class/net/$netdev
151 if [ -d $w/wireless -o -d $w/phy80211 ]; then
152 if [ $wififound -eq 0 ]; then
153 sed -i "s|\(^ *service wpa_supplicant .*\)\(-i.*\)\( -c.*$\)|\1-i $netdev\3|g" init.rc
157 echo "service dhcpcd$netdev /system/bin/dhcpcd $netdev" >> init.rc
158 echo " group system dhcp" >> init.rc
159 echo " disabled" >>init.rc
160 echo " oneshot" >> init.rc
166 if [ -n "$FOUND" ]; then
167 BTDEV="bnep rfcomm sco btusb"
168 for m in $PREDEV $EXTMOD $BTDEV; do
171 [ -n "$FB0DEV" -a -z "$UVESA_MODE" ] && modprobe $FB0DEV
172 [ -n "$LANDEV" ] && modprobe $LANDEV
173 [ -n "$WIFDEV" ] && modprobe $WIFDEV
174 [ -n "$SNDDEV" ] && modprobe $SNDDEV
175 [ -n "$CAMDEV" ] && modprobe $CAMDEV
181 [ -c /dev/video0 ] || modprobe vivi
182 [ -d /proc/asound/card0 ] || modprobe snd-dummy
183 [ -c /dev/fb0 ] || modprobe uvesafb mode_option=${UVESA_MODE:-800x600}-16 ${UVESA_OPTION:-mtrr=3 scroll=redraw}
184 find_network_dev_name