diff options
author | Badhri Jagan Sridharan <Badhri@google.com> | 2015-09-03 12:12:44 -0700 |
---|---|---|
committer | Badhri Jagan Sridharan <Badhri@google.com> | 2015-09-08 20:13:37 -0700 |
commit | a6c377b2f62175d6d5268c63885de3d882edbe2b (patch) | |
tree | 46b788a40e20b388a123e69e08b427f9b4a774e1 | |
parent | cdf094f667a251ddb03f95a4aa099e3acdaf9c4d (diff) | |
download | system_core-a6c377b2f62175d6d5268c63885de3d882edbe2b.zip system_core-a6c377b2f62175d6d5268c63885de3d882edbe2b.tar.gz system_core-a6c377b2f62175d6d5268c63885de3d882edbe2b.tar.bz2 |
init: usb: Add configfs commands for USB gadget
Adds init support for:
accessory
audio_source
midi
adb
rndis
Bug=23633457
Change-Id: I12e68e25969adafcf3170769f91ae939d08b7dbc
-rw-r--r-- | rootdir/init.usb.configfs.rc | 150 |
1 files changed, 134 insertions, 16 deletions
diff --git a/rootdir/init.usb.configfs.rc b/rootdir/init.usb.configfs.rc index 232c044..186384b 100644 --- a/rootdir/init.usb.configfs.rc +++ b/rootdir/init.usb.configfs.rc @@ -2,15 +2,27 @@ on property:sys.usb.config=none && property:sys.usb.configfs=1 write /config/usb_gadget/g1/UDC "none" stop adbd write /config/usb_gadget/g1/bDeviceClass 0 + write /config/usb_gadget/g1/bDeviceSubClass 0 + write /config/usb_gadget/g1/bDeviceProtocol 0 + setprop sys.usb.state ${sys.usb.config} + +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/configs/b.1/strings/0x409/configuration "adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} setprop sys.usb.state ${sys.usb.config} on property:sys.usb.config=mtp && property:sys.usb.configfs=1 - rmdir /config/usb_gadget/g1/configs/b.1 - mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell - mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ffs1" + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp" rm /config/usb_gadget/g1/configs/b.1/f1 rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1 write /config/usb_gadget/g1/UDC ${sys.usb.controller} setprop sys.usb.state ${sys.usb.config} @@ -19,24 +31,20 @@ on property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1 start adbd on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1 - rmdir /config/usb_gadget/g1/configs/b.1 - mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell - mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ffs1" + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_adb" rm /config/usb_gadget/g1/configs/b.1/f1 rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 write /config/usb_gadget/g1/UDC ${sys.usb.controller} setprop sys.usb.state ${sys.usb.config} on property:sys.usb.config=ptp && property:sys.usb.configfs=1 - rmdir /config/usb_gadget/g1/configs/b.1 - mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell - mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ffs1" + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp" rm /config/usb_gadget/g1/configs/b.1/f1 rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1 write /config/usb_gadget/g1/UDC ${sys.usb.controller} setprop sys.usb.state ${sys.usb.config} @@ -45,13 +53,123 @@ on property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1 start adbd on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1 - rmdir /config/usb_gadget/g1/configs/b.1 - mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell - mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell - write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ffs1" + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp_adb" rm /config/usb_gadget/g1/configs/b.1/f1 rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 write /config/usb_gadget/g1/UDC ${sys.usb.controller} setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=accessory && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "accessory" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "accessory_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=audio_source && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "audiosource" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/audio_source.gs2 /config/usb_gadget/g1/configs/b.1/f1 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "audiosource_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/audio_source.gs2 /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "accessory_audiosource" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "accessory_audiosource_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=midi && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "midi" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/midi.gs5 /config/usb_gadget/g1/configs/b.1/f1 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=midi,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "midi_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/midi.gs5 /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=rndis && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} |