Advertisement
Guest User

Untitled

a guest
Jul 29th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.63 KB | None | 0 0
  1. #!/system/bin/sh
  2. # Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
  3. #
  4. # Redistribution and use in source and binary forms, with or without
  5. # modification, are permitted provided that the following conditions are
  6. # met:
  7. #     * Redistributions of source code must retain the above copyright
  8. #       notice, this list of conditions and the following disclaimer.
  9. #     * Redistributions in binary form must reproduce the above
  10. #       copyright notice, this list of conditions and the following
  11. #       disclaimer in the documentation and/or other materials provided
  12. #       with the distribution.
  13. #     * Neither the name of The Linux Foundation nor the names of its
  14. #       contributors may be used to endorse or promote products derived
  15. #       from this software without specific prior written permission.
  16. #
  17. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
  18. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  19. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
  20. # ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  21. # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  22. # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  23. # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  24. # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  25. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  26. # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  27. # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. #
  29. # This script will load and unload the wifi driver to put the wifi in
  30. # in deep sleep mode so that there won't be voltage leakage.
  31. # Loading/Unloading the driver only incase if the Wifi GUI is not going
  32. # to Turn ON the Wifi. In the Script if the wlan driver status is
  33. # ok(GUI loaded the driver) or loading(GUI is loading the driver) then
  34. # the script won't do anything. Otherwise (GUI is not going to Turn On
  35. # the Wifi) the script will load/unload the driver
  36. # This script will get called after post bootup.
  37.  
  38. target="$1"
  39. serialno="$2"
  40.  
  41. btsoc=""
  42.  
  43. # No path is set up at this point so we have to do it here.
  44. PATH=/sbin:/system/sbin:/system/bin:/system/xbin
  45. export PATH
  46.  
  47. # Trigger WCNSS platform driver
  48. trigger_wcnss()
  49. {
  50.     # We need to trigger WCNSS platform driver, WCNSS driver
  51.     # will export a file which we must touch so that the
  52.     # driver knows that userspace is ready to handle firmware
  53.     # download requests.
  54.  
  55.     # See if an appropriately named device file is present
  56.     wcnssnode=`ls /dev/wcnss*`
  57.     case "$wcnssnode" in
  58.         *wcnss*)
  59.             # Before triggering wcnss, let it know that
  60.             # caldata is available at userspace.
  61.             if [ -e /data/misc/wifi/WCNSS_qcom_wlan_cal.bin ]; then
  62.                 calparm=`ls /sys/module/wcnsscore/parameters/has_calibrated_data`
  63.                 if [ -e $calparm ] && [ ! -e /data/misc/wifi/WCN_FACTORY ]; then
  64.                     echo 1 > $calparm
  65.                 fi
  66.             fi
  67.             # There is a device file.  Write to the file
  68.             # so that the driver knows userspace is
  69.             # available for firmware download requests
  70.             echo 1 > $wcnssnode
  71.             ;;
  72.  
  73.         *)
  74.             # There is not a device file present, so
  75.             # the driver must not be available
  76.             echo "No WCNSS device node detected"
  77.             ;;
  78.     esac
  79.  
  80.     # Plumb down the device serial number
  81.     if [ -f /sys/devices/*wcnss-wlan/serial_number ]; then
  82.         cd /sys/devices/*wcnss-wlan
  83.         echo $serialno > serial_number
  84.         cd /
  85.     elif [ -f /sys/devices/platform/wcnss_wlan.0/serial_number ]; then
  86.         echo $serialno > /sys/devices/platform/wcnss_wlan.0/serial_number
  87.     fi
  88. }
  89.  
  90. #case "$target" in
  91. #    msm8974* | msm8226* | msm8610*)
  92.  
  93.     wlanchip=""
  94.  
  95.       echo "The WLAN Chip ID is $wlanchip"
  96. #      case "$wlanchip" in
  97.  
  98. #      *)
  99.       echo "*** WI-FI chip ID is not specified in /persist/wlan_chip_id **"
  100.       echo "*** Use the default WCN driver.                             **"
  101.       setprop wlan.driver.ath 0
  102.       rm  /system/lib/modules/wlan.ko
  103.       ln -s /system/lib/modules/pronto/pronto_wlan.ko \
  104.         /system/lib/modules/wlan.ko
  105.        
  106.       # Populate the writable driver configuration file
  107.       #if [ ! -e /data/misc/wifi/WCNSS_qcom_cfg.ini ]; then
  108.           rm /data/misc/wifi/WCNSS_qcom_cfg.ini
  109.           cp /system/etc/wifi/WCNSS_qcom_cfg.ini \
  110.         /data/misc/wifi/WCNSS_qcom_cfg.ini
  111.           chown system:wifi /data/misc/wifi/WCNSS_qcom_cfg.ini
  112.           chmod 660 /data/misc/wifi/WCNSS_qcom_cfg.ini
  113.       #fi
  114.           rm /data/misc/wifi/WCNSS_qcom_wlan_nv.bin
  115.           cp /system/etc/wifi/WCNSS_qcom_wlan_nv.bin \
  116.         /data/misc/wifi/WCNSS_qcom_wlan_nv.bin
  117.           chown system:wifi /data/misc/wifi/WCNSS_qcom_wlan_nv.bin
  118.           chmod 660 /data/misc/wifi/WCNSS_qcom_wlan_nv.bin
  119.  
  120.  
  121.       # The property below is used in Qcom SDK for softap to determine
  122.       # the wifi driver config file
  123.       setprop wlan.driver.config /data/misc/wifi/WCNSS_qcom_cfg.ini
  124.  
  125.       rm /etc/firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin
  126.       ln -s /data/misc/wifi/WCNSS_qcom_wlan_nv.bin \
  127.                 /etc/firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin
  128.  
  129.       rm /etc/firmware/wlan/prima/WCNSS_qcom_cfg.ini
  130.       ln -s /data/misc/wifi/WCNSS_qcom_cfg.ini \
  131.                 /etc/firmware/wlan/prima/WCNSS_qcom_cfg.ini
  132.  
  133.       # Trigger WCNSS platform driver
  134.       trigger_wcnss &
  135. #      ;;
  136. #      esac
  137. #      ;;
  138. #    *)
  139. #      ;;
  140. #esac
  141.  
  142. # Run audio init script
  143. /system/bin/sh /system/etc/init.zetaw.audio.sh "$target" "$btsoc"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement