Skip to content

Commit

Permalink
Trying to fix MTP
Browse files Browse the repository at this point in the history
  • Loading branch information
NullCode1337 committed Dec 24, 2020
1 parent 270e6d3 commit 363b4ad
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 12 deletions.
4 changes: 3 additions & 1 deletion BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ TARGET_USERIMAGES_USE_F2FS := true
BOARD_SUPPRESS_SECURE_ERASE := true

# TWRP Configuration
TW_THEME := portrait_hdpi
TW_THEME := portrait_hdpi
TW_DEVICE_VERSION := 1_nullcode
TW_MTP_DEVICE := "/dev/mtp_usb"

TARGET_RECOVERY_PIXEL_FORMAT := "ABGR_8888"
TARGET_SCREEN_WIDTH := 720
Expand Down
20 changes: 20 additions & 0 deletions recovery/root/fstab.sc8830
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Android fstab file.
# PATH : android/device/sprd/scx35l/emmc/fstab_dt_otg.sc8830
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
# <src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>

/dev/block/platform/sdio_emmc/by-name/SYSTEM /system ext4 ro,errors=panic wait
/dev/block/platform/sdio_emmc/by-name/userdata /data ext4 nosuid,nodev,noatime,noauto_da_alloc,discard,journal_async_commit,errors=panic wait,check,encryptable=footer
/dev/block/platform/sdio_emmc/by-name/CACHE /cache ext4 nosuid,nodev,noatime,noauto_da_alloc,discard,journal_async_commit,errors=panic wait,check
/dev/block/platform/sdio_emmc/by-name/efs /efs ext4 nosuid,nodev,noatime,noauto_da_alloc,discard,journal_async_commit,errors=panic wait,check
/dev/block/platform/sdio_emmc/by-name/prodnv /productinfo ext4 nosuid,nodev,noatime,noauto_da_alloc,discard,journal_async_commit,errors=panic wait,check

# VOLD
/devices/sdio_sd/mmc_host/mmc1* auto auto default voldmanaged=extSdCard:auto,encryptable=userdata
/devices/20200000.usb/usb*sda auto auto default voldmanaged=UsbDriveA:auto
/devices/20200000.usb/usb*sdb auto auto default voldmanaged=UsbDriveB:auto
/devices/20200000.usb/usb*sdc auto auto default voldmanaged=UsbDriveC:auto
/devices/20200000.usb/usb*sdd auto auto default voldmanaged=UsbDriveD:auto
/devices/20200000.usb/usb*sde auto auto default voldmanaged=UsbDriveE:auto
/devices/20200000.usb/usb*sdf auto auto default voldmanaged=UsbDriveF:auto
72 changes: 72 additions & 0 deletions recovery/root/init.recovery.usb.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
on init
chown system system /sys/class/android_usb/android0/terminal_version
chmod 0660 /sys/class/android_usb/android0/terminal_version
chown system system /sys/devices/20200000.usb/gadget/lun0/file
chmod 0660 /sys/devices/20200000.usb/gadget/lun0/file

write /sys/class/android_usb/android0/iSerial ${ro.serialno}
write /sys/class/android_usb/android0/f_rndis/manufacturer Samsung
write /sys/class/android_usb/android0/f_rndis/vendorID 04E8
write /sys/class/android_usb/android0/f_rndis/wceis 1

# set up the usb mass storage lun
write /sys/devices/20200000.usb/gadget/lun0/cdrom 0
write /sys/devices/20200000.usb/gadget/lun0/nofua 0
write /sys/devices/20200000.usb/gadget/lun0/ro 0

on boot
setprop sys.usb.config none

write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
write /sys/class/android_usb/android0/iProduct ${ro.product.model}
write /sys/class/android_usb/android0/iSerial ${ro.serialno}
write /sys/class/android_usb/android0/bDeviceClass 0
write /sys/class/android_usb/android0/bDeviceSubClass 0
write /sys/class/android_usb/android0/bDeviceProtocol 0
write /sys/class/android_usb/f_mass_storage/inquiry_string "Samsung"

setprop sys.usb.config ${persist.sys.usb.config}

on fs
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
write /sys/class/android_usb/android0/f_ffs/aliases adb

on property:sys.usb.config=none
stop adbd
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 04E8
write /sys/class/android_usb/android0/idProduct 685E
write /sys/class/android_usb/android0/bDeviceClass 0
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=adb
stop adbd
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 04E8
write /sys/class/android_usb/android0/idProduct 685E
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable ${service.adb.root}
start adbd
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=mtp,adb
stop adbd
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 04E8
write /sys/class/android_usb/android0/idProduct 6860
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
start adbd
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=mass_storage,adb
stop adbd
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 04E8
write /sys/class/android_usb/android0/idProduct 685E
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
start adbd
setprop sys.usb.state ${sys.usb.config}
6 changes: 0 additions & 6 deletions recovery/root/ueventd.goldfish.rc

This file was deleted.

5 changes: 0 additions & 5 deletions recovery/root/ueventd.ranchu.rc

This file was deleted.

0 comments on commit 363b4ad

Please sign in to comment.