Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wl1251-init: enable/disable wifi scripts
- Loading branch information
Showing
2 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
DESCRIPTION = "SysV style init scripts to support bringing up the TI WL1251 WiFi chip found on the OpenPandora" | ||
LICENSE = "MIT" | ||
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58" | ||
|
||
PR = "r2" | ||
PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
COMPATIBLE_MACHINE = "openpandora" | ||
|
||
# The assumption that the modules are built in the kernel config as modules is made | ||
# (or the scripts will have no driver to load) | ||
|
||
SRC_URI += " \ | ||
file://rc.wl1251 \ | ||
" | ||
|
||
inherit update-rc.d | ||
|
||
INITSCRIPT_NAME = "wl1251-init" | ||
INITSCRIPT_PARAMS = "start 30 5 2 . stop 40 0 1 6 ." | ||
|
||
do_install() { | ||
install -d ${D}${sysconfdir}/init.d/ | ||
install -m 0755 ${WORKDIR}/rc.wl1251 ${D}${sysconfdir}/init.d/wl1251-init | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/sh | ||
DESC="WL1251 MAC80211 Wireless LAN driver" | ||
NAME="wl1251" | ||
|
||
d_stop() { | ||
if `grep -q wl1251 /proc/modules` ; then | ||
rmmod wl1251_sdio | ||
rmmod wl1251 | ||
rmmod board-omap3pandora-wifi 2> /dev/null | ||
fi | ||
} | ||
|
||
d_start() { | ||
if ! lsmod | grep -q mac80211 ; then | ||
insmod $(busybox find /lib/modules/$(uname -r)/updates -name "rfkill_backport.ko") | ||
insmod $(busybox find /lib/modules/$(uname -r)/updates -name "compat.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 "compat_firmware_class.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) -name "arc4.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") | ||
fi | ||
modprobe wl1251 | ||
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 | ||
} | ||
|
||
case "$1" in | ||
start) | ||
echo -n "Starting $DESC: $NAME" | ||
d_start & | ||
echo "." | ||
;; | ||
stop) | ||
echo -n "Stopping $DESC: $NAME" | ||
d_stop | ||
echo "." | ||
;; | ||
restart|force-reload) | ||
echo -n "Restarting $DESC: $NAME" | ||
d_stop | ||
sleep 1 | ||
d_start | ||
echo "." | ||
;; | ||
*) | ||
echo "Usage: $0 {start|stop|restart|force-reload}" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
exit 0 |