1 # Copyright (C) 2012 The Android Open Source Project 2 # 3 # USB configuration common for all android devices 4 # 5 6 on post-fs-data 7 chown system system /sys/class/android_usb/android0/f_mass_storage/lun/file 8 chmod 0660 /sys/class/android_usb/android0/f_mass_storage/lun/file 9 chown system system /sys/class/android_usb/android0/f_rndis/ethaddr 10 chmod 0660 /sys/class/android_usb/android0/f_rndis/ethaddr 11 12 # Used to disable USB when switching states 13 on property:sys.usb.config=none 14 stop adbd 15 write /sys/class/android_usb/android0/enable 0 16 write /sys/class/android_usb/android0/bDeviceClass 0 17 setprop sys.usb.state ${sys.usb.config} 18 19 # adb only USB configuration 20 # This should only be used during device bringup 21 # and as a fallback if the USB manager fails to set a standard configuration 22 on property:sys.usb.config=adb 23 write /sys/class/android_usb/android0/enable 0 24 write /sys/class/android_usb/android0/idVendor 18d1 25 write /sys/class/android_usb/android0/idProduct D002 26 write /sys/class/android_usb/android0/functions ${sys.usb.config} 27 write /sys/class/android_usb/android0/enable 1 28 start adbd 29 setprop sys.usb.state ${sys.usb.config} 30 31 # USB accessory configuration 32 on property:sys.usb.config=accessory 33 write /sys/class/android_usb/android0/enable 0 34 write /sys/class/android_usb/android0/idVendor 18d1 35 write /sys/class/android_usb/android0/idProduct 2d00 36 write /sys/class/android_usb/android0/functions ${sys.usb.config} 37 write /sys/class/android_usb/android0/enable 1 38 setprop sys.usb.state ${sys.usb.config} 39 40 # USB accessory configuration, with adb 41 on property:sys.usb.config=accessory,adb 42 write /sys/class/android_usb/android0/enable 0 43 write /sys/class/android_usb/android0/idVendor 18d1 44 write /sys/class/android_usb/android0/idProduct 2d01 45 write /sys/class/android_usb/android0/functions ${sys.usb.config} 46 write /sys/class/android_usb/android0/enable 1 47 start adbd 48 setprop sys.usb.state ${sys.usb.config} 49 50 # audio accessory configuration 51 on property:sys.usb.config=audio_source 52 write /sys/class/android_usb/android0/enable 0 53 write /sys/class/android_usb/android0/idVendor 18d1 54 write /sys/class/android_usb/android0/idProduct 2d02 55 write /sys/class/android_usb/android0/functions ${sys.usb.config} 56 write /sys/class/android_usb/android0/enable 1 57 setprop sys.usb.state ${sys.usb.config} 58 59 # audio accessory configuration, with adb 60 on property:sys.usb.config=audio_source,adb 61 write /sys/class/android_usb/android0/enable 0 62 write /sys/class/android_usb/android0/idVendor 18d1 63 write /sys/class/android_usb/android0/idProduct 2d03 64 write /sys/class/android_usb/android0/functions ${sys.usb.config} 65 write /sys/class/android_usb/android0/enable 1 66 start adbd 67 setprop sys.usb.state ${sys.usb.config} 68 69 # USB and audio accessory configuration 70 on property:sys.usb.config=accessory,audio_source 71 write /sys/class/android_usb/android0/enable 0 72 write /sys/class/android_usb/android0/idVendor 18d1 73 write /sys/class/android_usb/android0/idProduct 2d04 74 write /sys/class/android_usb/android0/functions ${sys.usb.config} 75 write /sys/class/android_usb/android0/enable 1 76 setprop sys.usb.state ${sys.usb.config} 77 78 # USB and audio accessory configuration, with adb 79 on property:sys.usb.config=accessory,audio_source,adb 80 write /sys/class/android_usb/android0/enable 0 81 write /sys/class/android_usb/android0/idVendor 18d1 82 write /sys/class/android_usb/android0/idProduct 2d05 83 write /sys/class/android_usb/android0/functions ${sys.usb.config} 84 write /sys/class/android_usb/android0/enable 1 85 start adbd 86 setprop sys.usb.state ${sys.usb.config} 87 88 # Used to set USB configuration at boot and to switch the configuration 89 # when changing the default configuration 90 on property:persist.sys.usb.config=* 91 setprop sys.usb.config ${persist.sys.usb.config} 92