SHARE
TWEET

Xperia acro HD (IS12S) init.usbmode.sh (6.0.D.0.274)

huhka_com Jun 29th, 2012 86 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 2010-2011 Sony Ericsson Mobile Communications AB.       *
  12. # * All rights, including trade secret rights, reserved.              *
  13. # *********************************************************************
  14. #
  15.  
  16. TAG="usb"
  17. USB_FUNC_TABLE="/system/etc/usbmode.table"
  18. COMMENT="#"
  19.  
  20. comp()
  21. {
  22.   case $1 in
  23.     $2)
  24.       return 0
  25.       ;;
  26.   esac
  27.   return 1
  28. }
  29.  
  30. ADB_PROP=$(/system/bin/getprop persist.service.adb.enable)
  31. ENG_PROP=$(/system/bin/getprop persist.usb.eng)
  32. RNDIS_PROP=$(/system/bin/getprop usb.rndis.enable)
  33. PCC_PROP=$(/system/bin/getprop usb.pcc.enable)
  34. USERSTORAGE_PROP=$(/system/bin/getprop ro.semc.product.user_storage)
  35.  
  36. PROP="${ADB_PROP:-0}${ENG_PROP:-0}${RNDIS_PROP:-0}${PCC_PROP:-0}"
  37. STORAGE_PROP="${USERSTORAGE_PROP:-emmc_only}"
  38.  
  39. while read LINE
  40. do
  41.  
  42.   set -- $LINE
  43.  
  44.   if comp $1 $COMMENT ; then
  45.     continue
  46.   fi
  47.  
  48.   if ! comp $1 $STORAGE_PROP ; then
  49.     continue
  50.   fi
  51.  
  52.   if ! comp $2 $PROP ; then
  53.     continue
  54.   fi
  55.  
  56.   RNDIS=$3
  57.   MSC=$4
  58.   MTP=$5
  59.   ADB=$6
  60.   MODEM=$7
  61.   NMEA=$8
  62.   DIAG=$9
  63.   DIAG_MDM=$10
  64.   USBSTATE=$11
  65.  
  66.   if comp $MODEM "1" ; then
  67.     /system/bin/start port-bridge
  68.   else
  69.     /system/bin/stop port-bridge
  70.   fi
  71.  
  72.   if comp $ADB "1" ; then
  73.     /system/bin/start adbd
  74.   else
  75.     /system/bin/stop adbd
  76.   fi
  77.  
  78.   echo $RNDIS > /sys/class/usb_composite/rndis/enable
  79.   if ! comp $MSC "0" ; then
  80.     echo "0" > /sys/class/usb_composite/usb_mass_storage/enable
  81.     echo $MSC > /sys/class/usb_composite/usb_mass_storage/mode
  82.   fi
  83.   echo $MSC > /sys/class/usb_composite/usb_mass_storage/enable
  84.   echo $MTP > /sys/class/usb_composite/mtp/enable
  85.   echo $MODEM > /sys/class/usb_composite/modem/enable
  86.   echo $NMEA > /sys/class/usb_composite/nmea/enable
  87.   echo $DIAG > /sys/class/usb_composite/diag/enable
  88.   echo $DIAG_MDM > /sys/class/usb_composite/diag_mdm/enable
  89.   echo "0" > /sys/class/usb_composite/accessory/enable
  90.  
  91.   /system/bin/log -t $TAG -p d "USB STATE: $USBSTATE"
  92.  
  93.   exit 0
  94.  
  95. done < $USB_FUNC_TABLE
  96.  
  97. /system/bin/log -t $TAG -p e "There is no matching USB mode:$PROP"
  98.  
  99. exit 1
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