blob: 4221035059eb1e18ebfb8c3c9cda243254ee6d18 [file] [log] [blame]
on init
mount configfs none /config
mkdir /config/usb_gadget/g1
mkdir /config/usb_gadget/g1/strings/0x409
mkdir /config/usb_gadget/g1/configs/b.1
mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409
mkdir /config/usb_gadget/g1/functions/mtp.0
mkdir /config/usb_gadget/g1/functions/ptp.0
mkdir /config/usb_gadget/g1/functions/acm.0
mkdir /config/usb_gadget/g1/functions/uts.0
mkdir /config/usb_gadget/g1/functions/dm.0
mkdir /config/usb_gadget/g1/functions/rndis.0
mkdir /config/usb_gadget/g1/functions/conn_gadget.0
mkdir /config/usb_gadget/g1/functions/midi.0
mkdir /config/usb_gadget/g1/functions/accessory.0
mkdir /config/usb_gadget/g1/functions/audio_source.0
mkdir /config/usb_gadget/g1/functions/ncm.0
mkdir /config/usb_gadget/g1/functions/mass_storage.0
mkdir /config/usb_gadget/g1/functions/ffs.adb 0770 shell shell
mkdir /dev/usb-ffs 0770 shell shell
mkdir /dev/usb-ffs/adb 0770 shell shell
mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
restorecon_recursive /dev/usb-ffs/adb
on charger && property:ro.debuggable=1
write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.vendor.manufacturer}
write /config/usb_gadget/g1/strings/0x409/product ${ro.product.vendor.model}
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "Conf 1"
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/ffs.adb
setprop sys.usb.configfs 1
setprop sys.usb.config adb
on boot
write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.vendor.manufacturer}
write /config/usb_gadget/g1/strings/0x409/product ${ro.product.vendor.model}
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "Conf 1"
write /config/usb_gadget/g1/configs/b.1/MaxPower 0x1f4
symlink /config/usb_gadget/g1/functions/mtp.0 /config/usb_gadget/g1/configs/b.1/mtp.0
symlink /config/usb_gadget/g1/functions/ptp.0 /config/usb_gadget/g1/configs/b.1/ptp.0
symlink /config/usb_gadget/g1/functions/acm.0 /config/usb_gadget/g1/configs/b.1/acm.0
symlink /config/usb_gadget/g1/functions/uts.0 /config/usb_gadget/g1/configs/b.1/uts.0
symlink /config/usb_gadget/g1/functions/rndis.0 /config/usb_gadget/g1/configs/b.1/rndis.0
symlink /config/usb_gadget/g1/functions/dm.0 /config/usb_gadget/g1/configs/b.1/dm.0
symlink /config/usb_gadget/g1/functions/conn_gadget.0 /config/usb_gadget/g1/configs/b.1/conn_gadget.0
symlink /config/usb_gadget/g1/functions/midi.0 /config/usb_gadget/g1/configs/b.1/midi.0
symlink /config/usb_gadget/g1/functions/accessory.0 /config/usb_gadget/g1/configs/b.1/accessory.0
symlink /config/usb_gadget/g1/functions/audio_source.0 /config/usb_gadget/g1/configs/b.1/audio_source.0
symlink /config/usb_gadget/g1/functions/ncm.0 /config/usb_gadget/g1/configs/b.1/ncm.0
symlink /config/usb_gadget/g1/functions/mass_storage.0 /config/usb_gadget/g1/configs/b.1/mass_storage.0
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/ffs.adb
chown system system /config/usb_gadget/g1/functions/mass_storage.0/lun.0/file
chmod 0660 /config/usb_gadget/g1/functions/mass_storage.0/lun.0/file
chown system system /dev/dun
chown system system /dev/dun2
setprop sys.usb.configfs 1
# ss_conn_daemon2 service
on property:sys.usb.config=none
stop ss_conn_daemon2_service
on property:sys.usb.config=mtp
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x6860
write /sys/class/android_usb/android0/functions mtp,acm
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=mtp,adb
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x6860
write /sys/class/android_usb/android0/functions mtp,acm,adb
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=mtp,acm,adb
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,acm,adb
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x6860
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
#[For Smart MTP CHN
on property:sys.usb.config=mtp,categories
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x6860
write /sys/class/android_usb/android0/functions mtp,acm
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=mtp,categories,adb
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,categories,adb
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x6860
write /sys/class/android_usb/android0/functions mtp,acm,adb
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=mtp,categories,acm,adb
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,categories,acm,adb
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x6860
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
#]
on property:sys.usb.config=rndis
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x6863
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=rndis,adb
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x6864
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=ptp
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x6865
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=ptp,adb
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idProduct 0x6866
write /config/usb_gadget/g1/idVendor 0x04E8
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=rndis,dm
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x6862
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=rndis,acm,dm
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x6862
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=rndis,acm,dm,adb
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,acm,dm,adb
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idProduct 0x6862
write /config/usb_gadget/g1/idVendor 0x04E8
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=rndis,acm,dm,uts
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idProduct 0x6862
write /config/usb_gadget/g1/idVendor 0x04E8
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=rndis,acm,dm,uts,adb
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,acm,dm,uts,adb
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idProduct 0x6862
write /config/usb_gadget/g1/idVendor 0x04E8
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=acm,dm
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x685D
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=acm,dm,adb
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=acm,dm,adb
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x685D
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=acm,dm,uts
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idProduct 0x685D
write /config/usb_gadget/g1/idVendor 0x04E8
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=acm,dm,uts,adb
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=acm,dm,uts,adb
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idProduct 0x685D
write /config/usb_gadget/g1/idVendor 0x04E8
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=dm,acm
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x685D
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=dm,acm,adb
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=dm,acm,adb
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x685D
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=dm,acm,uts
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idProduct 0x685D
write /config/usb_gadget/g1/idVendor 0x04E8
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=dm,acm,uts,adb
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=dm,acm,uts,adb
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idProduct 0x685D
write /config/usb_gadget/g1/idVendor 0x04E8
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=sec_charging
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x6860
write /sys/class/android_usb/android0/functions mtp
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=sec_charging,adb
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=sec_charging,adb
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x6860
write /sys/class/android_usb/android0/functions mtp,adb
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=mass_storage
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x685B
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=mass_storage,adb
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mass_storage,adb
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x685E
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=mass_storage,acm
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x685E
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=mtp,conn_gadget
start ss_conn_daemon2_service
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x6860
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/bDeviceClass 0
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=mtp,conn_gadget,adb && property:sys.usb.configfs=1
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,conn_gadget,adb
start ss_conn_daemon2_service
write /sys/class/android_usb/android0/enable 0
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x6860
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /config/usb_gadget/g1/bDeviceClass 0
write /config/usb_gadget/g1/UDC "13200000.dwc3"
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
# adb only USB configuration For VTS Test
# This is the fallback configuration if the
# USB manager fails to set a standard configuration
on property:sys.usb.config=adb && property:sys.usb.configfs=1
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idVendor 0x04E8
write /config/usb_gadget/g1/idProduct 0x685D
setprop sys.usb.state ${sys.usb.config}