diff options
| author | Ethan Chen <intervigil@gmail.com> | 2016-02-10 22:32:33 -0800 |
|---|---|---|
| committer | Ethan Chen <intervigil@gmail.com> | 2016-02-10 23:51:03 -0800 |
| commit | b77409ad194d1df764047f70bf9fbea933b12c7f (patch) | |
| tree | 86fde11929320d4696d9380fdcccba948c6dae78 | |
| parent | 0de9543cbf29199c7bb4f0f8cd4c383bbe8a2a6f (diff) | |
msm8960dt: Greatly simplify init.qcom.wifi.sh
* Convert to service
* Remove branches in control flow, this is always static for Moto 8960DT
Change-Id: I520460f000d5ef6156336875827eb980c158f77e
| -rw-r--r-- | rootdir/etc/init.qcom.rc | 8 | ||||
| -rwxr-xr-x | rootdir/etc/init.qcom.wifi.sh | 186 |
2 files changed, 24 insertions, 170 deletions
diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc index 83c6e29..9c8bcea 100644 --- a/rootdir/etc/init.qcom.rc +++ b/rootdir/etc/init.qcom.rc @@ -241,8 +241,6 @@ on early-boot setprop ro.sys.atvc_allow_ap_mot_log 0 setprop ro.sys.atvc_allow_simswap 0 - exec /system/bin/sh /system/etc/init.qcom.wifi.sh ${ro.board.platform} ${ro.serialno} - on boot # mount debugfs for systrace mount debugfs /sys/kernel/debug /sys/kernel/debug @@ -554,6 +552,12 @@ service time_daemon /system/bin/time_daemon user root group root +service wcnss_trigger /system/bin/sh /system/etc/init.qcom.wifi.sh ${ro.serialno} + class main + user root + group root + oneshot + # WPA service p2p_supplicant /system/bin/wpa_supplicant \ -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \ diff --git a/rootdir/etc/init.qcom.wifi.sh b/rootdir/etc/init.qcom.wifi.sh index c94068e..09358c2 100755 --- a/rootdir/etc/init.qcom.wifi.sh +++ b/rootdir/etc/init.qcom.wifi.sh @@ -35,10 +35,7 @@ # the Wifi) the script will load/unload the driver # This script will get called after post bootup. -target="$1" -serialno="$2" - -btsoc="" +serialno="$1" # No path is set up at this point so we have to do it here. PATH=/sbin:/system/sbin:/system/bin:/system/xbin @@ -52,176 +49,29 @@ trigger_wcnss() # driver knows that userspace is ready to handle firmware # download requests. - # See if an appropriately named device file is present - wcnssnode=`ls /dev/wcnss*` - case "$wcnssnode" in - *wcnss*) - # Before triggering wcnss, let it know that - # caldata is available at userspace. - if [ -e /data/misc/wifi/WCNSS_qcom_wlan_cal.bin ]; then - calparm=`ls /sys/module/wcnsscore/parameters/has_calibrated_data` - if [ -e $calparm ] && [ ! -e /data/misc/wifi/WCN_FACTORY ]; then - echo 1 > $calparm - fi - fi - # There is a device file. Write to the file - # so that the driver knows userspace is - # available for firmware download requests - echo 1 > $wcnssnode - ;; - - *) - # There is not a device file present, so - # the driver must not be available - echo "No WCNSS device node detected" - ;; - esac + echo 1 > /dev/wcnss_wlan # Plumb down the device serial number - if [ -f /sys/devices/*wcnss-wlan/serial_number ]; then - cd /sys/devices/*wcnss-wlan - echo $serialno > serial_number - cd / - elif [ -f /sys/devices/platform/wcnss_wlan.0/serial_number ]; then - echo $serialno > /sys/devices/platform/wcnss_wlan.0/serial_number - fi + echo $serialno > /sys/devices/platform/wcnss_wlan.0/serial_number } +# Populate the writable driver configuration file +if [ ! -e /data/misc/wifi/WCNSS_qcom_cfg.ini ]; then + if [ -f /persist/WCNSS_qcom_cfg.ini ]; then + cp /persist/WCNSS_qcom_cfg.ini /data/misc/wifi/WCNSS_qcom_cfg.ini + else + cp /system/etc/wifi/WCNSS_qcom_cfg.ini /data/misc/wifi/WCNSS_qcom_cfg.ini + fi + chown -h system:wifi /data/misc/wifi/WCNSS_qcom_cfg.ini + chmod -h 660 /data/misc/wifi/WCNSS_qcom_cfg.ini +fi -case "$target" in - msm8960*) - wlanchip="" - - if [ -f /system/etc/firmware/ath6k/AR6004/ar6004_wlan.conf ]; then - wlanchip=`cat /system/etc/firmware/ath6k/AR6004/ar6004_wlan.conf` - fi - - if [ "$wlanchip" == "" ]; then - # auto detect ar6004-usb card - # for ar6004-usb card, the vendor id and device id is as the following - # vendor id product id - # 0x0cf3 0x9374 - # 0x0cf3 0x9372 - device_ids=`ls /sys/bus/usb/devices/` - for id in $device_ids; do - if [ -f /sys/bus/usb/devices/$id/idVendor ]; then - vendor=`cat /sys/bus/usb/devices/$id/idVendor` - if [ $vendor = "0cf3" ]; then - if [ -f /sys/bus/usb/devices/$id/idProduct ]; then - product=`cat /sys/bus/usb/devices/$id/idProduct` - if [ $product = "9374" ] || [ $product = "9372" ]; then - echo "auto" > /sys/bus/usb/devices/$id/power/control - wlanchip="AR6004-USB" - break - fi - fi - fi - fi - done - # auto detect ar6004-usb card end - fi - - if [ "$wlanchip" == "" ]; then - # auto detect ar6004-sdio card - # for ar6004-sdio card, the vendor id and device id is as the following - # vendor id device id - # 0x0271 0x0400 - # 0x0271 0x0401 - sdio_vendors=`echo \`cat /sys/bus/mmc/devices/*/*/vendor\`` - sdio_devices=`echo \`cat /sys/bus/mmc/devices/*/*/device\`` - ven_idx=0 - - for vendor in $sdio_vendors; do - case "$vendor" in - "0x0271") - dev_idx=0 - for device in $sdio_devices; do - if [ $ven_idx -eq $dev_idx ]; then - case "$device" in - "0x0400" | "0x0401") - wlanchip="AR6004-SDIO" - ;; - *) - ;; - esac - fi - dev_idx=$(( $dev_idx + 1)) - done - ;; - *) - ;; - esac - ven_idx=$(( $ven_idx + 1)) - done - # auto detect ar6004-sdio card end - fi - - echo "The WLAN Chip ID is $wlanchip" - setprop wlan.driver.ath.wlanchip $wlanchip - case "$wlanchip" in - "AR6004-USB") - setprop wlan.driver.ath 2 - rm /system/lib/modules/wlan.ko - ln -s /system/lib/modules/ath6kl-3.5/ath6kl_usb.ko \ - /system/lib/modules/wlan.ko - rm /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin - rm /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin - ln -s /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin_usb \ - /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin - ln -s /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin_usb \ - /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin - rm /system/etc/firmware/ath6k/AR6004/hw3.0/bdata.bin - ln -s /system/etc/firmware/ath6k/AR6004/hw3.0/bdata.bin_usb \ - /system/etc/firmware/ath6k/AR6004/hw3.0/bdata.bin - ;; - "AR6004-SDIO") - setprop wlan.driver.ath 2 - setprop qcom.bluetooth.soc ath3k - btsoc="ath3k" - rm /system/lib/modules/wlan.ko - ln -s /system/lib/modules/ath6kl-3.5/ath6kl_sdio.ko \ - /system/lib/modules/wlan.ko - rm /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin - rm /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin - ln -s /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin_sdio \ - /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin - ln -s /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin_sdio \ - /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin - rm /system/etc/firmware/ath6k/AR6004/hw3.0/bdata.bin - ln -s /system/etc/firmware/ath6k/AR6004/hw3.0/bdata.bin_sdio \ - /system/etc/firmware/ath6k/AR6004/hw3.0/bdata.bin - ;; - *) - echo "*** WI-FI chip ID is not specified in /persist/wlan_chip_id **" - echo "*** Use the default WCN driver. **" - setprop wlan.driver.ath 0 - rm /system/lib/modules/wlan.ko - ln -s /system/lib/modules/prima/prima_wlan.ko /system/lib/modules/wlan.ko - ln -s /system/lib/modules/prima/cfg80211.ko /system/lib/modules/cfg80211.ko - # Populate the writable driver configuration file - if [ ! -e /data/misc/wifi/WCNSS_qcom_cfg.ini ]; then - if [ -f /persist/WCNSS_qcom_cfg.ini ]; then - cp /persist/WCNSS_qcom_cfg.ini /data/misc/wifi/WCNSS_qcom_cfg.ini - else - cp /system/etc/wifi/WCNSS_qcom_cfg.ini /data/misc/wifi/WCNSS_qcom_cfg.ini - fi - chown -h system:wifi /data/misc/wifi/WCNSS_qcom_cfg.ini - chmod -h 660 /data/misc/wifi/WCNSS_qcom_cfg.ini - fi - - # The property below is used in Qcom SDK for softap to determine - # the wifi driver config file - setprop wlan.driver.config /data/misc/wifi/WCNSS_qcom_cfg.ini - - # Trigger WCNSS platform driver - trigger_wcnss & - ;; - esac - ;; +# The property below is used in Qcom SDK for softap to determine +# the wifi driver config file +setprop wlan.driver.config /data/misc/wifi/WCNSS_qcom_cfg.ini - *) - ;; -esac +# Trigger WCNSS platform driver +trigger_wcnss ###### MOT added change - allow HW radio specific CAL select phone_hw_type=`getprop ro.hw.radio` |
