Skip to content

Commit

Permalink
MTP: use FFS_MTP
Browse files Browse the repository at this point in the history
Since all new samsung devices have FFS_MTP support
built in the kernel we can simply enable it in usb
config so that we have again working mtp connection
in twrp without breaking mtp connection on samsung roms

Thx to bigdiff for add FFS_MTP support on twrp 3.3.0

Signed-off-by: geiti94 <[email protected]>
Signed-off-by: corsicanu <[email protected]>
  • Loading branch information
geiti94 authored and corsicanu committed May 13, 2020
1 parent 234e0b4 commit 8a3da5e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions recovery/root/init.recovery.usb.rc
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ on init
mkdir /sys/kernel/config/usb_gadget/g1/strings/0x409 0770 shell shell
mkdir /sys/kernel/config/usb_gadget/g1/configs/c.1 0770 shell shell
mkdir /sys/kernel/config/usb_gadget/g1/configs/c.1/strings/0x409 0770 shell shell
mkdir /sys/kernel/config/usb_gadget/g1/functions/mtp.0 0770 shell shell
mkdir /sys/kernel/config/usb_gadget/g1/functions/ffs.mtp 0770 shell shell
mkdir /sys/kernel/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
mkdir /dev/usb-ffs/mtp 0770 mtp mtp
mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
mount functionfs mtp /dev/usb-ffs/mtp uid=2000,gid=2000

on boot
write /sys/kernel/config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
write /sys/kernel/config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
write /sys/kernel/config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
write /sys/kernel/config/usb_gadget/g1/configs/c.1/strings/0x409/configuration "Conf 1"
write /sys/kernel/config/usb_gadget/g1/configs/c.1/MaxPower 0x3f
symlink /sys/kernel/config/usb_gadget/g1/functions/mtp.0 /sys/kernel/config/usb_gadget/g1/configs/c.1/mtp.0
symlink /sys/kernel/config/usb_gadget/g1/functions/ffs.mtp /sys/kernel/config/usb_gadget/g1/configs/c.1/ffs.mtp
symlink /sys/kernel/config/usb_gadget/g1/functions/ffs.adb /sys/kernel/config/usb_gadget/g1/configs/c.1/ffs.adb
setprop sys.usb.configfs 1
setprop sys.usb.controller 10c00000.dwc3
Expand Down

0 comments on commit 8a3da5e

Please sign in to comment.