2015-08-29 04:32:45 +02:00
|
|
|
on property:sys.usb.config=none && property:sys.usb.configfs=1
|
|
|
|
write /config/usb_gadget/g1/UDC "none"
|
|
|
|
stop adbd
|
init: usb: disable usb function switch until adbd is ready
In the case of adb enabled, When a usb function switch happens
e.g mtp,adb -> ptp,adb, framework will set sys.usb.config from
"mtp,adb" to "none" and stop adbd first.
At this time, the property "sys.usb.ffs.ready", which is set after
the ready of the perious start adbd, is still "1".
So , when framework goes on setting the sys.usb.config to "ptp,adb",
init.usb.configfs.rc will trigger actions to bind() f_fs without
waiting for adbd is actually ready.
This will produce some error messages:
------------
configfs-gadget ci_hdrc.0: failed to start g1: -19
init: write_file: Unable to write to '/config/usb_gadget/g1/UDC': No such device
------------
this error msg is caused by configFS start binding f_fs before adbd is ready.
Add setting the "sys.usb.ffs.ready" to "0" will help clear this error msg,
as the bind process in kernel gadget driver will wait for the set of
this property, which is the sign of adbd is ready.
Signed-off-by: Winter Wang <wente.wang@nxp.com>
2016-03-24 10:45:37 +01:00
|
|
|
setprop sys.usb.ffs.ready 0
|
2015-08-29 04:32:45 +02:00
|
|
|
write /config/usb_gadget/g1/bDeviceClass 0
|
2015-09-03 21:12:44 +02:00
|
|
|
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}
|
2015-08-29 04:32:45 +02:00
|
|
|
setprop sys.usb.state ${sys.usb.config}
|
|
|
|
|
|
|
|
on property:sys.usb.config=mtp && property:sys.usb.configfs=1
|
2015-09-03 21:12:44 +02:00
|
|
|
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp"
|
2015-08-29 04:32:45 +02:00
|
|
|
rm /config/usb_gadget/g1/configs/b.1/f1
|
|
|
|
rm /config/usb_gadget/g1/configs/b.1/f2
|
2015-09-03 21:12:44 +02:00
|
|
|
rm /config/usb_gadget/g1/configs/b.1/f3
|
2015-08-29 04:32:45 +02:00
|
|
|
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}
|
|
|
|
|
|
|
|
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
|
2015-09-03 21:12:44 +02:00
|
|
|
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_adb"
|
2015-08-29 04:32:45 +02:00
|
|
|
rm /config/usb_gadget/g1/configs/b.1/f1
|
|
|
|
rm /config/usb_gadget/g1/configs/b.1/f2
|
2015-09-03 21:12:44 +02:00
|
|
|
rm /config/usb_gadget/g1/configs/b.1/f3
|
2015-08-29 04:32:45 +02:00
|
|
|
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
|
2015-09-03 21:12:44 +02:00
|
|
|
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp"
|
2015-08-29 04:32:45 +02:00
|
|
|
rm /config/usb_gadget/g1/configs/b.1/f1
|
|
|
|
rm /config/usb_gadget/g1/configs/b.1/f2
|
2015-09-03 21:12:44 +02:00
|
|
|
rm /config/usb_gadget/g1/configs/b.1/f3
|
2015-08-29 04:32:45 +02:00
|
|
|
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}
|
|
|
|
|
|
|
|
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
|
2015-09-03 21:12:44 +02:00
|
|
|
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp_adb"
|
2015-08-29 04:32:45 +02:00
|
|
|
rm /config/usb_gadget/g1/configs/b.1/f1
|
|
|
|
rm /config/usb_gadget/g1/configs/b.1/f2
|
2015-09-03 21:12:44 +02:00
|
|
|
rm /config/usb_gadget/g1/configs/b.1/f3
|
2015-08-29 04:32:45 +02:00
|
|
|
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}
|
2015-09-03 21:12:44 +02:00
|
|
|
|
|
|
|
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}
|