SHARE
TWEET

Xperia acro HD (IS12S) init.usbmode.sh (6.1.D.0.170)

huhka_com Jul 31st, 2012 195 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/system/bin/sh
  2. # *********************************************************************
  3. # *  ____                      _____      _                           *
  4. # * / ___|  ___  _ __  _   _  | ____|_ __(_) ___ ___ ___  ___  _ __   *
  5. # * \___ \ / _ \| '_ \| | | | |  _| | '__| |/ __/ __/ __|/ _ \| '_ \  *
  6. # *  ___) | (_) | | | | |_| | | |___| |  | | (__\__ \__ \ (_) | | | | *
  7. # * |____/ \___/|_| |_|\__, | |_____|_|  |_|\___|___/___/\___/|_| |_| *
  8. # *                    |___/                                          *
  9. # *                                                                   *
  10. # *********************************************************************
  11. # * Copyright 2011 Sony Ericsson Mobile Communications AB.            *
  12. # * Copyright 2012 Sony Mobile Communications AB.                     *
  13. # * All rights, including trade secret rights, reserved.              *
  14. # *********************************************************************
  15. #
  16.  
  17. TAG="usb"
  18. VENDOR_ID=0FCE
  19. PID_PREFIX=0
  20.  
  21. get_pid_prefix()
  22. {
  23.   case $1 in
  24.     "mass_storage")
  25.       PID_PREFIX=E
  26.       ;;
  27.  
  28.     "mass_storage,adb")
  29.       PID_PREFIX=6
  30.       ;;
  31.  
  32.     "mtp")
  33.       PID_PREFIX=0
  34.       ;;
  35.  
  36.     "mtp,adb")
  37.       PID_PREFIX=5
  38.       ;;
  39.  
  40.     "mtp,cdrom")
  41.       PID_PREFIX=4
  42.       ;;
  43.  
  44.     "mtp,cdrom,adb")
  45.       PID_PREFIX=4
  46. # workaround for ICS framework. Don't enable ADB for PCC mode.
  47.       USB_FUNCTION="mtp,cdrom"
  48.       ;;
  49.  
  50.     "rndis")
  51.       PID_PREFIX=7
  52.       ;;
  53.  
  54.     "rndis,adb")
  55.       PID_PREFIX=8
  56.       ;;
  57.  
  58.     *)
  59.       /system/bin/log -t ${TAG} -p e "unsupported composition: $1"
  60.       return 1
  61.       ;;
  62.   esac
  63.  
  64.   return 0
  65. }
  66.  
  67. set_engpid()
  68. {
  69.   case ${PID_SUFFIX_PROP} in
  70.     "177") # products which have MDM
  71.       case $1 in
  72.         "mass_storage,adb") PID_PREFIX=A ;;
  73.         "mtp,adb") PID_PREFIX=B ;;
  74.         *)
  75.           /system/bin/log -t ${TAG} -p i "No eng PID for: $1"
  76.           return 1
  77.           ;;
  78.       esac
  79.       DIAG_FUNC="diag,diag_mdm"
  80.       SERIAL_FUNC="sdio,tty"
  81.       ;;
  82.     *)
  83.       case $1 in
  84.         "mass_storage,adb") PID_PREFIX=6 ;;
  85.         "mtp,adb") PID_PREFIX=5 ;;
  86.         *)
  87.           /system/bin/log -t ${TAG} -p i "No eng PID for: $1"
  88.           return 1
  89.           ;;
  90.       esac
  91.       DIAG_FUNC="diag"
  92.       SERIAL_FUNC="smd,tty"
  93.       ;;
  94.   esac
  95.  
  96.   PID=${PID_PREFIX}146
  97.   USB_FUNCTION=${1},serial,diag
  98.   echo ${DIAG_FUNC} > /sys/class/android_usb/android0/f_diag/clients
  99.   echo ${SERIAL_FUNC} > /sys/class/android_usb/android0/f_serial/transports
  100.  
  101.   return 0
  102. }
  103.  
  104. PID_SUFFIX_PROP=$(/system/bin/getprop ro.usb.pid_suffix)
  105. USB_FUNCTION=$(/system/bin/getprop sys.usb.config)
  106. ENG_PROP=$(/system/bin/getprop persist.usb.eng)
  107.  
  108. get_pid_prefix ${USB_FUNCTION}
  109. if [ $? -eq 1 ] ; then
  110.   exit 1
  111. fi
  112.  
  113. PID=${PID_PREFIX}${PID_SUFFIX_PROP}
  114.  
  115. echo 0 > /sys/class/android_usb/android0/enable
  116. echo ${VENDOR_ID} > /sys/class/android_usb/android0/idVendor
  117.  
  118. if [ ${ENG_PROP} -eq 1 ] ; then
  119.   set_engpid ${USB_FUNCTION}
  120. fi
  121.  
  122. echo ${PID} > /sys/class/android_usb/android0/idProduct
  123. /system/bin/log -t ${TAG} -p i "usb product id: ${PID}"
  124.  
  125. echo ${USB_FUNCTION} > /sys/class/android_usb/android0/functions
  126. /system/bin/log -t ${TAG} -p i "enabled usb functions: ${USB_FUNCTION}"
  127.  
  128. echo 1 > /sys/class/android_usb/android0/enable
  129.  
  130. exit 0
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top