yashsingh1/xdaforums huggingface dataset:
[Moto G 2015 Q&A, Help & Troubleshooting] mrdoug:
Just to make sure we are on the same page... Solid Explorer works, with the caveat that it won't delete files. It will create, rename, move, etc.. Same as the builtin file explorer.
[Moto G 2015 Q&A, Help & Troubleshooting] Soonam shreya:
Hey. I recently bought a MOTO g3 ... from flipkart. It got updated to Marashmallow as well. Now that i want to transfer data to pc as the memory is full as well as my memory card .

i connected my USB cable to Desktop CPU and to the MOto g3 Phone but the Desktop didt detect anything neither there was any pop up as soon as i connected the USB to Desktop PC and MObile Moto 3g .

How do i transfer??? Kindly Help please.

thank you .
[Moto G 2015 Q&A, Help & Troubleshooting] acejavelin:
This thread is about OTG access (accessing external USB peripherals) not MPT (USB file access from computer), very different things... A quick Google search would get your answer, it's well documented and easily fixed.

Disconnect USB cable, and go to Settings, Apps, and Show System Apps, then find External Storage and Media Storage and clear data and cache on each one and reboot your device. After it is fully booted, wait 5 min for media databases to rebuild and connect USB cable and go to the pull-down menu and select MTP access. Should be good to go.
[Moto G 2015 Q&A, Help & Troubleshooting] mrdoug:
Not to further hijack the thread, especially since I'm one of those with a external USB issue, but one additional point... Make sure, in developers options, under select USB configuration, MTP (media transfer protocol) is selected. I've found that many times my moto g switches to charging only or one of the other options. This will give you issues, if you don't have the right one set.
[Moto G 2015 Q&A, Help & Troubleshooting] sabarishsab:
Nice Point made!.May be dev shud try 2 fix this atleast in custom roms almost most of us facing this issue.
[Moto G 2015 Q&A, Help & Troubleshooting] rl_2015:
Fixing this in a custom ROM is one option, but I'm sure that everyone is hoping that Motorola will fix it in the official firmware. Not everyone (including myself) wants to install a custom ROM. I will try to post this issue in Motorola's support forum. Let's see if we get any help there because there doesn't seem to be much movement on this issue here. Maybe that is because it's an issue that doesn't affect everyone (depends on your model and firmware revision).
[Moto G 2015 Q&A, Help & Troubleshooting] Ddayanandm:
Exactly the same issue, BUT NOW RESOLVED!!!

Hi, I had faced the exact same issue... I was even worried if this was a hardware issue... But this is what I did to solve it... I was using a 3rd party launcher... I disabled the launcher and use the default GOOGLE LAUNCHER, and volla ISSUE RESOLVED...

This worked for me... Please let me know if it helps you as well...

---------- Post added at 05:34 AM ---------- Previous post was at 05:30 AM ----------

I just had to disable the 3rd party launcher and it immediately worked...

Might sound silly, but it helps....
[Moto G 2015 Q&A, Help & Troubleshooting] mikesergienko:
High current is needed to work with OTG flash drives, indeed

My XT1540 also refused to recognize a USB 3.0 flash drive when the battery level was below 60% or so. I got worried that my usb flash drive (the micro-usb connector) got broken. But when I fully charged it - it started reading from and writing to the flash drive again :)
[Moto G 2015 Q&A, Help & Troubleshooting] XSAMA:
Lets play a little with a USB Voltmeter

5.11V OTG (nothing connected)

Let's try with a simple usb memory

0V (it's off.... really off come on 0Volts)

now testing with a powered otg cable and wsb memory

4.94V (and memory its On and working)

now testing with USB keyboard/mouse and simple OTG (not powered)

5.11V (and working fine)

So yep it's a problem with current next time i'll test how many mAh i can get from it. i just know its maybe lower than 10mA
[Moto G 2015 Q&A, Help & Troubleshooting] Nomesh:
Same problem is facing by me too in moto g 3rd gen....plz help..... it mounts and unmounts again nd again
[Moto G 2015 Q&A, Help & Troubleshooting] legendracer:
i replaced my mobile 4 times. and the 4th piece i received , reads otg well.
[Moto G 2015 Q&A, Help & Troubleshooting] Afreen naaz:
I am also facing same problem with moto g3, USB OTG pendrive compatibility. Please update me about the solution regarding this issue
[Moto G 2015 Q&A, Help & Troubleshooting] maxsteel1947:
This is the solution if your device doesnt recognize a USB Connected

Use ES Filemanager with root persmissions locate the following folder /system/etc/permissions

To enable USB host API support you should add a file named android.hardware.usb.host.xml

and containing the following lines:

<permissions>

<feature name="android.hardware.usb.host"/>

</permissions>

in the same permissions folder find file named handheld_core_hardware.xml or tablet_core_hardware.xml

and add <feature name="android.hardware.usb.host"/> into <permissions> section

Reboot your device. Usb host api should work.

Tested on MOTO G 3 (2015) Running on CyanogenMOD 13 and Resurrection Remix
[Moto G 2015 Q&A, Help & Troubleshooting] Spaceminer:
I have 2 Moto G3's, both are xt1548 Virgin US. One can read USB OTG, and the other does not. The files, partitions, firmware, EVERYTHING is exactly the same in both. What I have found is that for some Moto G3's, the external USB power is enabled on the board, and for others it is not. This tells me its a motherboard BIOS problem. I think it's related to the gpt.bin file in the factory firmware. I'm able to fastboot flash this on the one that USB OTG works, but not on the one with OTG disabled. It'll fail every time. The rest of the firmware flashes just fine. If we can mess with the board bios, we can fix it. If not, we're just screwed.
[Moto G 2015 Q&A, Help & Troubleshooting] acejavelin:
You might be barking up the right tree, but looking on the wrong side... gpt.bin is just the partition table.

Phones don't have a "bios", they use a simple start pointer to execute the bootloader, which in turn starts the boot.img (kernel).
[Moto G 2015 Q&A, Help & Troubleshooting] Spaceminer:
I know what the gpt.bin is, what I'm saying is, I think the two things are related. On the device where USB OTG works, I can flash this without error every time. On the one where it does not work, I can never flash the gpt.bin successfully. As this is the only thing that won't flash, there must be a reason for it, and I suspect it's related to the USB problem. Completely did not know that snapdragons do not have a BIOS. They can, its possible, they typically don't though. (This prompted a lot of reading on Qualcomm's developwebsite.) They use byte codes instead of BIOS to make things power on in different states. And it would also be a byte code that decides external voltage... This is probably the saddest thing I've realized about this phone. It would be cheaper and easier to just get a newer Moto, than to buy the tools to mess with that.
[Moto G 2015 Q&A, Help & Troubleshooting] drfre:
bump

Hey everyone,

I bumped into this thread because my stupid ass bought an Insta360 air without properly checking the requirements (Qualcomm 600 Series or 800 Series i/o 410 like ours).

But reading this thread gave me hope and I started searching for more info. I'm using a rooted custom rom (LineageOS).

Apparantly, some other smartphones (also Qualcomm 400 series) can be triggered to deliver the right voltage for OTG to work (as mentioned on https://xdaforums.com/galaxy-s3-neo/accessories/otg-y-cable-t3422573). The phone needs to be rooted for this and the /sys partition needs to be writeable.

Writing "1" to /sys/kernel/debug/regulator/8226_smbbp_otg/enable did the trick for them.

echo "1" >> /sys/kernel/debug/regulator/8226_smbbp_otg/enable

I couldn't find the same file to write the value "1" to, but I DID find /sys/kernel/debug/regulator/fan54046_otg_vreg/enable. It's only folder that mentions otg. This is where I got stuck...

If I plug in the peripheral, I can't overwrite the "0" value present in that file. But if unplug it, the value becomes "1"... it's like it's enabled by default but when it needs to activate, it's disabled by some other system (kernel?).

If anyone is still interested in looking into this, I'm all ears.
[ZenFone 2 General] OfficerJimLahey:
WHY THIS GUIDE?:

As users try out different ROM's, or otherwise back up their devices for the purposes of (if it comes to that) restoring them at a later time, it is important to have a proper backup. A lot of it is common sense, but there is a quirk that is buried in the TWRP thread that if not followed could provide headaches, and a factory reset, in the long run.

BACKGROUND:

As CM 12.1 has been released, I have been trying my hand at building CarbonROM. I had two successful builds at that point, but neither get to to the setup screen (first stuck at "Starting apps", the other, froze at the splash screen). Naturally, I would want to go back to SuperZen using my backup-of-the-day. The first time I restored, the system started up fine, but something funny was happening. I couldn't get the SIM card to detect. Looking around online, I found that the only way around it is to factory reset, then take the time to set everything back up (I didn't TiBu, so that made the process even longer).

After explaining the problem to [MENTION=2388665]TheSSJ[/MENTION], he opened up some more backup options in TWRP so the next time I tried my ROM, I did a little trial-and-error to know which partition was needed to restore and thus what needs to be backed up at least.

THE HOWTO:

First, you need TheSSJ's TWRP v20 or higher. (I never tried this with official TWRP, maybe someone can let me know if it has the same backup options?)

Reboot to TWRP. This can be done a few ways:

From ADB shell or Terminal Emulator, gain SU and type "reboot recovery" (without the quotes).

Select Reboot form the power menu. When the screen goes black, hold down Vol-Up until you get to fastboot mode. From there, press Vol-Dn twice (until "Recovery" is displayed), and press the Power button.

Use an app or Xposed module to do this for you.

Once in TWRP, select Backup. You will be presented with nine or so backup options:

Boot

Cache

config

Data

Misc

Recovery

Splashscreen

System

System Image

A minimal, effective backup should consist of:

Boot

config

Data

System

...but you can select as many partitions as you like. Cache is a good idea as well, and is typical in a backup. Remember, when you restore, you can pick and choose which partitions you want.

Personally, I back up everything but System Image and restore all of what was backed up except recovery.

Set the Backup Name, to something friendly (if desired) and change the backup destination to MicroSD (hope you got one, especially if you have one of the 16GB models).

When ready, swipe to backup. That's all there is to it! :cowboy:

CREDITS:

I would like to thank TheSSJ for all his hard work bringing over TWRP to our device and troubleshooting when things don't work as expected. :)
[G4 Q&A, Help & Troubleshooting] carlinleos:
Hello, Yesterday I rooted succesfully my H815P and I wanted to add viper4android but whenever I open it, it asks me to instal drivers, but they never get installed, what should I do? by the way I installed ROOT with low efort
[G4 Q&A, Help & Troubleshooting] mythos234:
Not sure, but didn't V4A require SELinux to be Permissive? In that case V4A would only run on a custom kernel or if you built an own stock kernel with permissive. But I'm not sure if it's needed, not really using Viper
[G4 Q&A, Help & Troubleshooting] GUGUITOMTG4:
SELinuxModeChanger from Play store may do the dirty job.
[G4 Q&A, Help & Troubleshooting] mythos234:
Apps like this probably won't work on Android 5 though
[G4 Q&A, Help & Troubleshooting] GUGUITOMTG4:
It was banned from play as I jut saw, but it does work on my G4 h811 look it up on xda
[G4 Q&A, Help & Troubleshooting] mythos234:
It still works? Good to hear, on Samsung those apps no longer work, thats where I'm coming from - It's a different world there hahaha
[G4 Q&A, Help & Troubleshooting] Usraek:
http://xdaforums.com/showpost.php?p=62107040&postcount=109
[Android General] Primokorn:
HOW TO EDIT YOUR BUILD.PROP

If you want to modify your build.prop or add new lines then follow those steps.

1. Create a new .sh file (e.g build_prop.sh)

2. To modify specific lines:

sed -i 's/original_value/new_value/g' /system/build.prop;

3. To add new lines:

echo "your_value" >> /system/build.prop;

4. In your build_prop.sh file copy this

#!/sbin/sh

Then add your sed and echo lines

Copy your script into your flashable zip (system folder). That's it for the .sh script.

5. Now you have to create your updater-script into your flashable zip (see OP if you don't know how to do that).

Here is what you need to put:

ui_print("+--------BUILD-PROP-EDITION----------+");
run_program("/sbin/busybox", "umount", "/system");
run_program("/sbin/busybox", "mount", "/system");
show_progress(8.800000, 5);
package_extract_dir("system", "/system/");
ui_print("***Fixing permissions***");
set_perm(0, 0, 0777, "/system/build_prop.sh");
run_program("/sbin/sh", "system/build_prop.sh");
show_progress(8.800000, 5);
delete_recursive(
"/system/build_prop.sh"
);
run_program("/sbin/busybox", "umount", "/system");
ui_print(" ");
ui_print("Completed.");

What does it do? This will extract your build_prop.sh file into /system partition, set the permissions and delete your script.

6. Create your flashable zip and sign it as explained in the previous post.

7. Reboot into TWRP and flash! :)

I have attached a compressed file as an example.
[Android General] raimopeku:
Thank you! Will try this later :)

---------- Post added at 04:34 PM ---------- Previous post was at 03:45 PM ----------

Im so newbie with this kind of stuff, that i have to ask for specific info.

As i told in another topic, i need to keep my /system/app/Calculator/Calculator.apk when im flashing my rom update.

If i understand correctly, it can be done with addon.d script automatically, without flashing any zips?
[Android General] Primokorn:
Exactly. You can only create a .sh file into addon.d folder.

Use the following at the beginning:

list_files() {
cat <<EOF
app/Calculator/Calculator.apk
EOF
}
[Android General] mixtapes08:
i remove some of the addons on your updater script.

because i only want the bloatware removal scripts. Can you check if this is correct.

ui_print("+-------------------------------------+");

ui_print("| bloatware removal script |");

ui_print("| |");

ui_print("| !!!BYE BYE!!! |");

ui_print("+-------------------------------------+");

run_program("/sbin/busybox", "umount", "/system");

run_program("/sbin/busybox", "mount", "/system");

ui_print(" ");

ui_print("***Deleting bloatwares***");

delete_recursive(

"/system/priv-app/Launcher3",

"/system/priv-app/MusicFX"

);

run_program("/sbin/busybox", "unmount", "/system");

ui_print(" ");

ui_print("Completed.");

ui_print("Enjoy!");
[Android General] Primokorn:
It should work BUT Launcher3 is stored into /system/app/. Moreover you need a launcher to reach a homescreen. In other words, if you remove Launcher3 after a clean flash then you have to install another launcher.

I forgot to explain how to sign the final zip. I'll add this in the coming hours.
[Android General] mixtapes08:
On pure nexus its located on system/priv-app and I have a novalauncher.zip that i will install after flashing. I have a installer.zip here. Can i copy my modified updater-script there?

Sent from my Nexus 5
[Android General] Primokorn:
Of course. Do not forget to remove run_program lines if you already have them in the other file :good:
[Android General] mixtapes08:
Thanks. Man.

Sent from my Nexus 5
[Android General] Primokorn:
PART 3 added to create and sign your flashable zip.
[Android General] raimopeku:
So, i created that file in /system/addon.d/myfile.sh

And now when i updated my rom (euphoria), my old calculator was gone, and i had to manually it back?
[Android General] Primokorn:
Can you post your whole script? Are you using other scripts?
[Android General] Primokorn:
Your myfile.sh file is not complete. You have to use the whole code (just remove my custom lines: apps that I remove and audio_policy at the end).

Try this:

#!/sbin/sh
#
#

. /tmp/backuptool.functions

list_files() {
cat <<EOF
app/Calculator/Calculator.apk
EOF
}

case "$1" in
backup)
list_files | while read FILE DUMMY; do
backup_file $S/"$FILE"
done
;;
restore)
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
done
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# Stub
;;
esac
[Android General] raimopeku:
Ok, thanks m8! I updated my script, after next rom update ill report if it works :)
[Android General] Primokorn:
*** NEW ***

How to edit your build.prop in post 2.
[Android General] blowtorch:
The "Template" (MEGA) download link in the OP is dead. Please re-upload, thanks.
[Android General] Primokorn:
I've uploaded my latest custom scripts. I also updated OP.
[Android General] maxmotos:
I was wondering if there is any way you can help me with a flashable zip i am working on cant seem to get it to flash correctly I get the following error each time;

Updater process ended with signal:11
[Android General] Primokorn:
Share your files and I'll have a look as soon as I can.
[Android General] Primokorn:
[MENTION=7378910]maxmotos[/MENTION]

Try with this updater-script:

ui_print("+-------------------------------------+");
ui_print("| App/Apn Installer |");
ui_print("+-------------------------------------+");
run_program("/sbin/busybox", "umount", "/system");
run_program("/sbin/busybox", "mount", "/system");
delete_recursive(
"/system/app/Chrome"
);
ui_print("Installing apps");
show_progress(8.800000, 5);
package_extract_dir("system", "/system/");
ui_print("***Fixing permissions***");
set_perm(0, 0, 0644, "/system/app/cleartalkv3.apk");
set_perm(0, 0, 0644, "/system/app/LauncherConfig.apk");
set_perm(0, 0, 0644, "/system/etc/apns-conf.xml");
show_progress(8.800000, 5);
run_program("/sbin/busybox", "umount", "/system");
ui_print(" ");
ui_print("Completed.");
ui_print("Enjoy!");

2 mistakes:

1. no comma at the end of the latest removed app so "/system/app/Chrome"

2. "); at the end of the lines where you set the permissions.

I also added umount and mount commands at the beginning.

Remove /system/lib folder since it's empty.
[Android General] SuperKenzoUser:
Thanks for the guide!

But I'm not sure I understand it carefully..

If you can make flash-zip that do this:

https://forums.oneplus.net/threads/fixed-for-good-microphone-issue.222059/

And I will check the code :)
[Android General] Primokorn:
I've never tried to modify a xml file. Did you at least try what I explain in #post 2?
[Android General] SuperKenzoUser:
Yeah I did read it too.. hope I understand is good..

But I need the xml file too.

If I can't modify the file, maybe I can replace it with another file (with the change)..

What you think?

Thanks
[Android General] Primokorn:
Yes it's easier but it depends on the file. If it's something that can change with each ROM update then you have to find a way to only modify the line.
[Android General] Primokorn:
OP updated

:
[Android General] roshan2989:
is it possible to create a script like open gapps.?where can i learn ?
[Android General] Primokorn:
I don't use GApps. What are the differences with their script?
[Android General] mangkon:
Hi,

I do not own the topic device but your guide should be considered universal.

I am able to grasp 99% of your tutorial but troubled with these minute details.

Question:

Q1. I have seen these headers "#!/system/bin/sh" and "#!/sbin/sh" on sh file scripts.

Q2. Also seen these "[un]mount" and "

mount" codes in updater-scripts.

Q3. And these, "set_metadata" vs "set_perm".

What are their differences, can you lead me to these queries?

Thanks!
[Android General] Primokorn:
1. You have to provide the path of the binary you are going to use

2. Only umount is used in my scripts. Where did you see unmout?

3. Where did you see set_metadata?
[Android General] mangkon:
Yes, I did notice your usage of "

mount" and "fix_perm" in your updater-script.

Actually, I was asking and like to know why others used "[un]mount" and "set_metadata", for example addonsu-14.1-arm-signed.zip in their updater-script?

ui_print("Installing su addon...");

ifelse(is_mounted("/system"), unmount("/system"));

package_extract_file("mount-system.sh", "/tmp/mount-system.sh");

set_metadata("/tmp/mount-system.sh", "uid", 0, "gid", 0, "mode", 0755);

[...]

I presume they have the same end commands but why?

Thanks.
[Android General] Primokorn:
AFAIK the right command is umount:

http://www.linfo.org/umount.html

https://linux.die.net/man/8/umount

set_metadata seems to be used to set the permissions and the user & group.

root (0) is the default value and I never need to define something else in my scripts.
[Android General] rickysidhu_:
Thank you for this, it worked wonderfully! Managed to add in my own bootanimation, emoji font, some ui sounds, and remove some system apps.

A couple of things:

1. In your "Notes" section, you mention the following:

"your flashable zip has to be installed after a clean flash (or after wiping /system partition)."

I did not clean flash, or wipe system and it still worked for me. I'm assuming it's because of the nature of things I added/removed? I had previously manually removed those system apps, so to get them back, I simply dirty flashed my ROM, then flashed the zip I created to remove them again (to see if my zip worked), and it did! I also dirty flashed my ROM again to see if my addon.d script works, and that was also a success. I guess more than anything, I'm just confused as to how it worked even though I didn't clean flash/wipe system. Just curious, that's all!

2. This second one is where I need a bit of help...

I am thinking of adding in a separate zip file I use to change the splash screen on boot (I have attached it for your reference). I simply copied the commands from the updater-script from that zip to my own. Where I get confused is what I should add in the addon.d script to ensure it survives dirty flashes going forward.

Thanks again for this great guide, I don't consider myself anywhere near an expert in these things and I still managed to get this to work, so that says a lot about this guide! Any information on (1) and help on (2) would be greatly appreciated, thank you!!
[Android General] Primokorn:
[MENTION=7381251]rickysidhu_[/MENTION] Glad to know that this guide helped another person :good:

1/ The idea is just to get a clean and original system partition before trying the scripts. For instance, how could you know if all system apps are properly removed if you already did it manually?

2/ There's no need to have a backup script. AFAIK CyanogenMod was the only custom ROM that installed a custom splash screen when flashing the ROM zip. Once a custom splash screen is installed there's nothing else to do.
[Android General] rickysidhu_:
Thanks for the response!

1. Ahh, makes sense. I suppose I essentially did the same thing by dirty flashing my ROM and bringing the system apps back (that I wanted to remove with my newly created zip).

2. I am running PureFusion OS on my OnePlus 5, and the splash screen does get replaced with the stock (just tested it now). I tried copying the text from the script I sent you, into my own zip's script, but ended up getting an error (something like mount() expects 4 arg, got 5). I played around with this for a while but could not get it to work, so I ended up giving up on it.

Thanks again for this great guide, I never thought that after switching to Android, I would go as far as creating my own flashable zips! :highfive: