Zvikomborero VIncent Zvikaramba | 566ec73 | 2016-08-19 02:18:45 -0400 | [diff] [blame] | 1 | #!/system/bin/sh |
| 2 | # Copyright (c) 2014, 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 met: |
| 6 | # * Redistributions of source code must retain the above copyright |
| 7 | # notice, this list of conditions and the following disclaimer. |
| 8 | # * Redistributions in binary form must reproduce the above copyright |
| 9 | # notice, this list of conditions and the following disclaimer in the |
| 10 | # documentation and/or other materials provided with the distribution. |
| 11 | # * Neither the name of The Linux Foundation nor |
| 12 | # the names of its contributors may be used to endorse or promote |
| 13 | # products derived from this software without specific prior written |
| 14 | # permission. |
| 15 | # |
| 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 19 | # NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 23 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 25 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 26 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | # |
| 28 | |
| 29 | target=`getprop ro.board.platform` |
| 30 | action=`getprop sys.usb_uicc.enabled` |
| 31 | |
| 32 | if [ -f /sys/devices/soc0/soc_id ]; then |
| 33 | soc_hwid=`cat /sys/devices/soc0/soc_id` |
| 34 | else |
| 35 | soc_hwid=`cat /sys/devices/system/soc/soc0/id` |
| 36 | fi |
| 37 | |
| 38 | # No path is set up at this point so we have to do it here. |
| 39 | PATH=/sbin:/system/sbin:/system/bin:/system/xbin |
| 40 | export PATH |
| 41 | |
| 42 | uicc_insert() |
| 43 | { |
| 44 | case $target in |
| 45 | "msm8916") |
| 46 | if [ $soc_hwid == "239" ] || [ $soc_hwid == "268" ] || [ $soc_hwid == "269" ] || [ $soc_hwid == "270" ] || [ $soc_hwid == "271" ]; then |
| 47 | echo Y > /sys/module/ehci_msm_uicc/parameters/uicc_card_present |
| 48 | echo 79c0000.qcom,ehci-host > /sys/bus/platform/drivers/msm_ehci_uicc/bind |
| 49 | elif [ $soc_hwid == "206" ]; then |
| 50 | echo Y > /sys/module/ice40_hcd/parameters/uicc_card_present |
| 51 | echo spi0.0 > /sys/bus/spi/drivers/ice40_spi/bind |
| 52 | else |
| 53 | echo "The TARGET ID is $target hw $soc_hwid" |
| 54 | fi |
| 55 | ;; |
| 56 | "msm8610") |
| 57 | insmod /system/lib/modules/ice40-hcd.ko |
| 58 | ;; |
| 59 | "msm8226") |
| 60 | echo 1 > /sys/bus/platform/devices/msm_smsc_hub/enable |
| 61 | ;; |
| 62 | "msm8974") |
| 63 | echo Y > /sys/module/ehci_hcd/parameters/uicc_card_present |
| 64 | echo msm_ehci_host > /sys/bus/platform/drivers/msm_ehci_host/bind |
| 65 | ;; |
| 66 | *) |
| 67 | echo "USB_UICC invalid target when insert uicc!" |
| 68 | ;; |
| 69 | esac |
| 70 | } |
| 71 | |
| 72 | uicc_remove() |
| 73 | { |
| 74 | case $target in |
| 75 | "msm8916") |
| 76 | if [ $soc_hwid == "239" ] || [ $soc_hwid == "268" ] || [ $soc_hwid == "269" ] || [ $soc_hwid == "270" ] || [ $soc_hwid == "271" ]; then |
| 77 | echo 79c0000.qcom,ehci-host > /sys/bus/platform/drivers/msm_ehci_uicc/unbind |
| 78 | echo N > /sys/module/ehci_msm_uicc/parameters/uicc_card_present |
| 79 | elif [ $soc_hwid == "206" ]; then |
| 80 | echo spi0.0 > /sys/bus/spi/drivers/ice40_spi/unbind |
| 81 | echo N > /sys/module/ice40_hcd/parameters/uicc_card_present |
| 82 | else |
| 83 | echo "The TARGET ID is $target hw $soc_hwid" |
| 84 | fi |
| 85 | ;; |
| 86 | "msm8610") |
| 87 | rmmod /system/lib/modules/ice40-hcd.ko |
| 88 | ;; |
| 89 | "msm8226") |
| 90 | echo 0 > /sys/bus/platform/devices/msm_smsc_hub/enable |
| 91 | ;; |
| 92 | "msm8974") |
| 93 | echo msm_ehci_host > /sys/bus/platform/drivers/msm_ehci_host/unbind |
| 94 | echo N > /sys/module/ehci_hcd/parameters/uicc_card_present |
| 95 | ;; |
| 96 | *) |
| 97 | echo "USB_UICC invalid target when remove uicc!" |
| 98 | ;; |
| 99 | esac |
| 100 | } |
| 101 | |
| 102 | case $action in |
| 103 | "1") |
| 104 | uicc_insert |
| 105 | setprop sys.usb_uicc.loading 1 |
| 106 | ;; |
| 107 | "0") |
| 108 | uicc_remove |
| 109 | setprop sys.usb_uicc.loading 1 |
| 110 | ;; |
| 111 | *) |
| 112 | echo "USB_UICC invalid action for uicc operation!" |
| 113 | ;; |
| 114 | esac |
| 115 | |