Advertisement
t0mm13b

USB

Dec 6th, 2011
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. # Used to disable USB when switching states
  2. on property:sys.usb.config=none
  3. stop adbd
  4. write /sys/class/android_usb/android0/enable 0
  5. write /sys/class/android_usb/android0/bDeviceClass 0
  6. setprop sys.usb.state $sys.usb.config
  7.  
  8. # adb only USB configuration
  9. # This should only be used during device bringup
  10. # and as a fallback if the USB manager fails to set a standard configuration
  11. on property:sys.usb.config=adb
  12. write /sys/class/android_usb/android0/enable 0
  13. write /sys/class/android_usb/android0/idVendor 18d1
  14. write /sys/class/android_usb/android0/idProduct D002
  15. write /sys/class/android_usb/android0/functions $sys.usb.config
  16. write /sys/class/android_usb/android0/enable 1
  17. start adbd
  18. setprop sys.usb.state $sys.usb.config
  19.  
  20. # USB accessory configuration
  21. on property:sys.usb.config=accessory
  22. write /sys/class/android_usb/android0/enable 0
  23. write /sys/class/android_usb/android0/idVendor 18d1
  24. write /sys/class/android_usb/android0/idProduct 2d00
  25. write /sys/class/android_usb/android0/functions $sys.usb.config
  26. write /sys/class/android_usb/android0/enable 1
  27. setprop sys.usb.state $sys.usb.config
  28.  
  29. # USB accessory configuration, with adb
  30. on property:sys.usb.config=accessory,adb
  31. write /sys/class/android_usb/android0/enable 0
  32. write /sys/class/android_usb/android0/idVendor 18d1
  33. write /sys/class/android_usb/android0/idProduct 2d01
  34. write /sys/class/android_usb/android0/functions $sys.usb.config
  35. write /sys/class/android_usb/android0/enable 1
  36. start adbd
  37. setprop sys.usb.state $sys.usb.config
  38.  
  39. # Used to set USB configuration at boot and to switch the configuration
  40. # when changing the default configuration
  41. on property:persist.sys.usb.config=*
  42. setprop sys.usb.config $persist.sys.usb.config
  43.  
  44. # //--> Further on near the bottom ....
  45.  
  46. # This property trigger has added to imitiate the previous behavior of "adb root".
  47. # The adb gadget driver used to reset the USB bus when the adbd daemon exited,
  48. # and the host side adb relied on this behavior to force it to reconnect with the
  49. # new adbd instance after init relaunches it. So now we force the USB bus to reset
  50. # here when adbd sets the service.adb.root property to 1. We also restart adbd here
  51. # rather than waiting for init to notice its death and restarting it so the timing
  52. # of USB resetting and adb restarting more closely matches the previous behavior.
  53. on property:service.adb.root=1
  54. write /sys/class/android_usb/android0/enable 0
  55. restart adbd
  56. write /sys/class/android_usb/android0/enable 1
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement