X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=openpandora.oe.git;a=blobdiff_plain;f=recipes%2Fpandora-system%2Fwl1251-modules%2Frc.wl1251;h=ab0f43fad66248b49e50a452b4f75760bbdddd10;hp=30f8818f0c2f350239c06103616b8472b052e2ed;hb=67f9186e1b7bba2d4ba2a153baa15aea320ac157;hpb=39f2fac9c365c1a0d3f1a8822d0b2ba784133f8f diff --git a/recipes/pandora-system/wl1251-modules/rc.wl1251 b/recipes/pandora-system/wl1251-modules/rc.wl1251 index 30f8818..ab0f43f 100755 --- a/recipes/pandora-system/wl1251-modules/rc.wl1251 +++ b/recipes/pandora-system/wl1251-modules/rc.wl1251 @@ -1,32 +1,60 @@ #!/bin/sh - DESC="WL1251 MAC80211 Wireless LAN driver" NAME="wl1251" +sysfs_path="/sys/bus/mmc/devices/mmc2:0001/mmc2:0001:1" +ps_rate_threshold=30000 +use_fw_ps=Y + +if [ -f /etc/pandora/conf/wl1251 ]; then + . /etc/pandora/conf/wl1251 +fi + d_stop() { if `grep -q wl1251 /proc/modules` ; then - rmmod wl1251_sdio - rmmod wl1251 - # rmmod board-omap3pandora-wifi + ifconfig wlan0 down + rmmod board_omap3pandora_wifi wl1251_sdio wl1251 2> /dev/null fi } d_start() { - insmod $(busybox find /lib/modules/$(uname -r) -name "board-omap3pandora-wifi.ko") - insmod $(busybox find /lib/modules/$(uname -r) -name "arc4.ko") - insmod $(busybox find /lib/modules/$(uname -r) -name "ecb.ko") - insmod $(busybox find /lib/modules/$(uname -r) -name "pcbc.ko") - insmod $(busybox find /lib/modules/$(uname -r)/updates -name "compat.ko") - insmod $(busybox find /lib/modules/$(uname -r)/updates -name "rfkill_backport.ko") - insmod $(busybox find /lib/modules/$(uname -r)/updates -name "cfg80211.ko") - insmod $(busybox find /lib/modules/$(uname -r)/updates -name "mac80211.ko") - insmod $(busybox find /lib/modules/$(uname -r)/updates -name "lib80211.ko") - insmod $(busybox find /lib/modules/$(uname -r)/updates -name "lib80211_crypt_tkip.ko") - insmod $(busybox find /lib/modules/$(uname -r)/updates -name "lib80211_crypt_wep.ko") - insmod $(busybox find /lib/modules/$(uname -r)/updates -name "lib80211_crypt_ccmp.ko") - insmod $(busybox find /lib/modules/$(uname -r)/updates -name "wl1251.ko") - insmod $(busybox find /lib/modules/$(uname -r)/updates -name "wl1251_sdio.ko") - iwconfig wlan0 power off + wl1251_args="" + if modinfo wl1251 2> /dev/null | grep -q '\'; then + wl1251_args="use_fw_ps=$use_fw_ps" + fi + modprobe wl1251 $wl1251_args + modprobe wl1251_sdio + # this does not exist on newer kernels + modprobe board-omap3pandora-wifi 2> /dev/null + + # find our phy index, they change every time driver module is reinserted + # assume our interface is wlan0 + phy_idx=0 + for a in `seq 20` ; do + if [ -e /sys/class/net/wlan0 ] ; then + phy_idx=$(cat /sys/class/net/wlan0/phy80211/index) + break + else + sleep 0.2 + fi + done + + # restore phy related LED triggers (they come from mac80211.ko) + if [ -e /sys/class/leds/ ] ; then + for led in /sys/class/leds/* ; do + trigger=$(grep "$(basename $led)" /etc/default/leds | grep phy | \ + awk '{print $2}' | sed -e 's/.*phy[0-9]*\(.*\)/\1/') + if [ "x$trigger" != "x" ] ; then + echo "phy${phy_idx}$trigger" > "$led/trigger" + fi + done + fi + + # some driver configuration + if [ -d "$sysfs_path" ]; then + test -n "$ps_rate_threshold" && echo "$ps_rate_threshold" > $sysfs_path/ps_rate_threshold + test -n "$long_doze_mode" && echo "$long_doze_mode" > $sysfs_path/long_doze_mode + fi } case "$1" in