Skip to content

Instantly share code, notes, and snippets.

@olivierlemoal
Created December 28, 2021 20:34
Show Gist options
  • Save olivierlemoal/6f64b7d946006152c7b53cdb982f3610 to your computer and use it in GitHub Desktop.
Save olivierlemoal/6f64b7d946006152c7b53cdb982f3610 to your computer and use it in GitHub Desktop.
diff --git a/rootdir/etc/init.qcom.usb.rc b/rootdir/etc/init.qcom.usb.rc
index bb37a28..ccb5514 100644
--- a/rootdir/etc/init.qcom.usb.rc
+++ b/rootdir/etc/init.qcom.usb.rc
@@ -75,6 +75,7 @@ on boot
mkdir /config/usb_gadget/g1/functions/audio_source.gs3
mkdir /config/usb_gadget/g1/functions/midi.gs5
mkdir /config/usb_gadget/g1/functions/ffs.adb
+ mkdir /config/usb_gadget/g1/functions/diag.diag
mkdir /config/usb_gadget/g1/functions/gsi.rmnet
mkdir /config/usb_gadget/g1/functions/gsi.rndis
mkdir /config/usb_gadget/g1/functions/gsi.dpl
@@ -201,3 +202,39 @@ on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mass_storage,adb && p
symlink /config/usb_gadget/g1/functions/mass_storage.0 /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.ffs.ready=1 && property:sys.usb.config=diag,adb && property:sys.usb.configfs=1
+ write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_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
+ rm /config/usb_gadget/g1/configs/b.1/f4
+ rm /config/usb_gadget/g1/configs/b.1/f5
+ rm /config/usb_gadget/g1/configs/b.1/f6
+ rm /config/usb_gadget/g1/configs/b.1/f7
+ rm /config/usb_gadget/g1/configs/b.1/f8
+ rm /config/usb_gadget/g1/configs/b.1/f9
+ write /config/usb_gadget/g1/idVendor 0x05C6
+ write /config/usb_gadget/g1/idProduct 0x901D
+ symlink /config/usb_gadget/g1/functions/diag.diag /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=diag && property:sys.usb.configfs=1
+ write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag"
+ 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
+ rm /config/usb_gadget/g1/configs/b.1/f4
+ rm /config/usb_gadget/g1/configs/b.1/f5
+ rm /config/usb_gadget/g1/configs/b.1/f6
+ rm /config/usb_gadget/g1/configs/b.1/f7
+ rm /config/usb_gadget/g1/configs/b.1/f8
+ rm /config/usb_gadget/g1/configs/b.1/f9
+ write /config/usb_gadget/g1/idVendor 0x05C6
+ write /config/usb_gadget/g1/idProduct 0x901D
+ symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1
+ write /config/usb_gadget/g1/UDC ${sys.usb.controller}
+ setprop sys.usb.state ${sys.usb.config}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment