Originally Posted by domg73
I was investigating the problem and I think I found the cause and the solution.
According to my findings the bad dismount while deep sleeping is caused by the C3* state (Power Collapse) which is the deepest sleep state.
While in this state the sdcard check routine timeouts and a bad dismount occurs.
The solution (root required):
When I had the Nexus4 I remember the C3 state was off by default and enabling it caused issues in some cases...
So I tried to disable it on the GPad and this cured the bad dismount.
This may lead to a little higher battery drain while in standby.... the device deep sleeps just fine anyway.
Attached to this post you'll find the script (remove the .zip extension after the download) you need to place in system/etc/init.d (if your kernel supports init.d... stock one doesn't)... alternatively you may use Script Manager and execute the script with ROOT privileges.
I tested this on my GPad running Mahdi 2.9 ROM (KK) and mani.Kernel... It SHOULD work on any ROM/KERNEL combinations....
* Infos about C-States may be found here.
Using what you said (and a helpful kernel tuning utility) I've done the following.
1. revert to stock 4.4.2
3. install sdcard monitor app
4. using Faux123 Kernel Enhancement Pro disable c3 and set it to always disable this state on boot.
And now I'm waiting to see if stock will crap out again with this change. What you wrote above makes more sense than any of the other theories on this issue that I've read and I knew it was somehow related to sleep and/or power. I never thought to disable one of the sleep states. Thanks for pointing me in a new direction!
-- Added stuff here later --
Okay your script will error out on the stock kernel however you can simply comment out the lines that cause errors and then it does work. This does cause battery drain while the tablet is idle, however it does seem to stop the sdcard from having a bad removal. If you must run stock this would solve the issue, although you would still need to root and run the script after each boot (either manually or via some tool).
The modified script should simply comment out the lines for cpu1-cpu3 as shown below:
echo "$C3" > /sys/module/pm_8x60/modes/cpu0/power_collapse/idle_enabled
#echo "$C3" > /sys/module/pm_8x60/modes/cpu1/power_collapse/idle_enabled
#echo "$C3" > /sys/module/pm_8x60/modes/cpu2/power_collapse/idle_enabled
#echo "$C3" > /sys/module/pm_8x60/modes/cpu3/power_collapse/idle_enabled
leave the rest of the script as is...
idle_enabled does not seem to exist for cpu1-cpu3 in that directory.