Well, here is the thing. You can modify init.rc and have mass storage always on, but this is a bad choice because if you're mounted to your PC while doing a backup, you potentially have two separate devices reading/writing to the same memory at the same time. Now, with that being said, if you could get MTP to work, that would potentially be less hazardous, but not all that better. My biggest question is how to you activate mass storage in the new TWRP without the mount as USB button in the GUI?
I'm not sure how you would activate mass storage without it.
On the kernel I was building that had lag, I had the button and it mounted reliably.
On the old prebuilt kernel I don't have the button by defualt, but I get it once I force the persist usb config setting. Though, the button then does nothing for me. Not sure why.
They remove the option to mount as usb on boot-up if it can't find your lun*/file. On the old kernel it's in the location they expect by default
From variabls.h
[HIGH]#ifndef CUSTOM_LUN_FILE
#define CUSTOM_LUN_FILE "/sys/devices/platform/usb_mass_storage/lun%d/file"
#endif[/HIGH]
If you're building from the current iproj kernel repo it's a seperate location so you have to overide it in BoardConfig.mk
I ended up also having to add the line about emmc shares to get it to mount correctly. Not 100% sure what that emmc shares does though, I saw it in another boardconfig with a custom lun path, so I gave it a try.
[HIGH]
# Vold
BOARD_VOLD_EMMC_SHARES_DEV_MAJOR := true
TARGET_USE_CUSTOM_LUN_FILE_PATH := /sys/devices/platform/msm_hsusb/gadget/lun0/file
BOARD_UMS_LUNFILE := /sys/devices/platform/msm_hsusb/gadget/lun0/file
[/HIGH]
I've tried to recompile the current kernel every which way in the video settings. Half the time though the build fails with errors around framebuffer memory definitions. (which is funny since I'm pretty sure it's a framebuffer problem causing the lag)
I'm pretty sure this bit of code here is what's disabling usb storage over here in data.cpp in the twrp source (2.5 branch)
[HIGH]#ifdef TW_NO_USB_STORAGE
printf("TW_NO_USB_STORAGE := true\n");
mConstValues.insert(make_pair(TW_HAS_USB_STORAGE, "0"));
#else
char lun_file[255];
string Lun_File_str = CUSTOM_LUN_FILE;
size_t found = Lun_File_str.find("%");
if (found != string::npos) {
sprintf(lun_file, CUSTOM_LUN_FILE, 0);
Lun_File_str = lun_file;
}
if (!TWFunc:
ath_Exists(Lun_File_str)) {
LOGINFO("Lun file '%s' does not exist, USB storage mode disabled\n", Lun_File_str.c_str());
mConstValues.insert(make_pair(TW_HAS_USB_STORAGE, "0"));
} else {
LOGINFO("Lun file '%s'\n", Lun_File_str.c_str());
mConstValues.insert(make_pair(TW_HAS_USB_STORAGE, "1"));
}
#endif[/HIGH]
I haven't really dug through much more than that. I've been busy trying to figure out what all has changed between the old kernel and new kernel for video.