detect keypress during boot - Nexus 5 Q&A, Help & Troubleshooting

Hi,
Is there any way to detect the volume up/down presses during the boot?
Something similar to this: http://forum.xda-developers.com/gal...kernel-dual-boot-powered-boot-custom-t2204705
* Normal Boot -> No keys are pressed, cyan LED ->Find kernel in /data/media/boot/1st.img
* Recovery Boot -> Volume Up key pressed, green LED -> Go to recovery
* Custom Boot -> Volume Down key pressed, blue LED ->Find kernel in /data/media/boot/2nd.img
Thanks.

Xposed has a disable feature which can be triggered during boot by repetitively pressing random keys, so yes its possible, only after enough has started to be able to tell if they're pressed. LED too. But by the time it can tell if something is pressed, you'd already have to do a full reboot to do what you want it to do.
You won't be able to switch kernels like that since you'd HAVE to go into the bootloader to boot one (and you can't really script that on the phone itself) or have to reboot into recovery and reflash the kernel (maybe with a recovery script). No point in the way you want to boot into recovery either, since you can just go into the bootloader and enter recovery from there, rather than booting into Android, then rebooting again into recovery.
Maybe possible if you edit the kernels, ROM and the recovery (maybe even the bootloader - don't know if its possible, could be a brick), but its overkill. There's already an easy enough way to get into recovery. Just flash the kernel if you want to switch.

Lethargy said:
You won't be able to switch kernels like that since you'd HAVE to go into the bootloader to boot one (and you can't really script that on the phone itself) or have to reboot into recovery and reflash the kernel (maybe with a recovery script). No point in the way you want to boot into recovery either, since you can just go into the bootloader and enter recovery from there, rather than booting into Android, then rebooting again into recovery.
Maybe possible if you edit the kernels, ROM and the recovery (maybe even the bootloader - don't know if its possible, could be a brick), but its overkill. There's already an easy enough way to get into recovery. Just flash the kernel if you want to switch.
Click to expand...
Click to collapse
Thanks for answering. Indeed, simply flashing a kernel in recovery would definitely be the easiest.
You can boot another kernel from the current kernel using kexec_hardboot (implemented in many kernels) so probably a hook like Xposed that clals kexec_hardboot would work.
I believe (I haven't checked but I recall seeing somewhere) that Nexus 5 has actually two bootloader zones so you have a backup in case you mess one up. This, however, is useless since the bootloader is closed source.

wkwkwk said:
Thanks for answering. Indeed, simply flashing a kernel in recovery would definitely be the easiest.
You can boot another kernel from the current kernel using kexec_hardboot (implemented in many kernels) so probably a hook like Xposed that clals kexec_hardboot would work.
I believe (I haven't checked but I recall seeing somewhere) that Nexus 5 has actually two bootloader zones so you have a backup in case you mess one up. This, however, is useless since the bootloader is closed source.
Click to expand...
Click to collapse
Yeah, there's a secondary bootloader which "some" people have gotten into, but others couldn't. I still wouldn't attempt to mess with it either way.

Related

[Q]recovery and kernel ?!?!

Hi... i want to know if after auto-root, and after flashing a custom kernel, do i get a recovery ? or i shall flash a CWM ? thank you for help
CF auto-root? Not sure, check the thread, but it should be in the first post. Just boot your device into recovery mode and find out! For example, a samsung phone can be booted to recovery usually by volume up+power.
well then i have to try... thanks mate
try app Quick Boot (available in Google Play) if you don't know which keys to press. If you have recovery, you can directly boot into...
the thing is not in which keys to press.. all i wanted to know is that if custom kernels contain a recovery or not before trying to flash any of them... solved
custom (or stock, for that matter) kernels don't include a recovery.

[Q] Can't boot into recovery

Trying to install CyanogenMod for my razr maxx HD. Recently used RSDlite to install 183.46.10 after OTA KK update kept failing. Then used towelroot to root and motopocalype to unlock bootloader. Fastboot screen shows bootloader is unlocked with status code: 3.
I then followed the instructions on the CyanogenMod site to flash CWM 6.0.4.4 recovery using fastboot, and all appeared to work fine.
However, when I try to reboot into recovery, nothing happens. I get hung up on the motorola dual core flashscreen for about a minute or two, then the screen goes black, then the phone reboots normally.
I tried flashing a different copy of CWM, tried TRWP, and tried several third party apps from Google Play store to boot directly into recovery using software reboot instead of hardware keys - all with the same results. I even tried flashing custom CWM recovery using ROM Manager and Rashr, same result.
Do I have a corrupt recovery partition? Any suggestions for how to fix?
You need to install a recovery for that phone specifically.
http://androidhosting.org/Devs/Dhacker29/
Use the recovery files found here.
Edit: on the site I posted, browse to the msm8690 folder. There you will find the recovery files.
to make this even easier here
TWRP http://forum.xda-developers.com/showthread.php?t=2776515
CWM http://forum.xda-developers.com/showthread.php?t=2747535
next time be sure your flashing for this phone and bootloader
billycar11 said:
to make this even easier here
TWRP http://forum.xda-developers.com/showthread.php?t=2776515
CWM http://forum.xda-developers.com/showthread.php?t=2747535
next time be sure your flashing for this phone and bootloader
Click to expand...
Click to collapse
Thanks, guys, total noob mistake. I knew the recovery needed to be specific for the phone, but didn't realize it varied depending on the bootloader. Will try again with the right recovery!
billycar11 said:
to make this even easier here
TWRP http://forum.xda-developers.com/showthread.php?t=2776515
CWM http://forum.xda-developers.com/showthread.php?t=2747535
next time be sure your flashing for this phone and bootloader
Click to expand...
Click to collapse
Those recovery aren't sticking for me. Does anyone have a suggestion to fix that issue.
Pushing the buttons doesn't work.
The only thing that is working is place the phone in fastboot mode and flash the recovery to my device three time and then I will go straight in recovery and there it is.
Sent from my SM-N900V using Tapatalk
TheGman125 said:
Those recovery aren't sticking for me. Does anyone have a suggestion to fix that issue.
Pushing the buttons doesn't work.
The only thing that is working is place the phone in fastboot mode and flash the recovery to my device three time and then I will go straight in recovery and there it is.
Sent from my SM-N900V using Tapatalk
Click to expand...
Click to collapse
Your phone has been upgraded to Kit Kat and the bootloader unlocked, correct? The two recoveries linked to are for phones that already have already been upgraded to KK.
If so, power off your phone.
Then, hold down volume up and then press and hold power. After a few seconds, let go and the boot menu should come up.
Use Volume down to select "Recovery" and then hit "Volume Up". That should boot you into the custom recovery, depending on which one you flashed.
I prefer TWRP. CWM seemed buggy and it wouldn't always boot into it. A lot of times, I'd get a blank screen and would have to reflash it.
Another option is, when it's booted up, hooked up your phone to your pc and use adb to reboot it into recovery using "adb reboot recovery".
iBolski said:
Your phone has been upgraded to Kit Kat and the bootloader unlocked, correct? The two recoveries linked to are for phones that already have already been upgraded to KK.
If so, power off your phone.
Then, hold down volume up and then press and hold power. After a few seconds, let go and the boot menu should come up.
Use Volume down to select "Recovery" and then hit "Volume Up". That should boot you into the custom recovery, depending on which one you flashed.
I prefer TWRP. CWM seemed buggy and it wouldn't always boot into it. A lot of times, I'd get a blank screen and would have to reflash it.
Another option is, when it's booted up, hooked up your phone to your pc and use adb to reboot it into recovery using "adb reboot recovery".
Click to expand...
Click to collapse
Yep.. I had some issue with my devices. I tried the update well root and the devices didn't want to boot up anymore. So I had to RSD lite the devices back to health. So I do have the latest software for the devices. I guess. I am going to use Twrp since you say it boots fine from the boot menu.
TheGman125 said:
Yep.. I had some issue with my devices. I tried the update well root and the devices didn't want to boot up anymore. So I had to RSD lite the devices back to health. So I do have the latest software for the devices. I guess. I am going to use Twrp since you say it boots fine from the boot menu.
Click to expand...
Click to collapse
Is your bootloader unlocked? If not, that is your problem. You need to root, and then unlock the bootloader before you can flash TWRP and use CM.
iBolski said:
Is your bootloader unlocked? If not, that is your problem. You need to root, and then unlock the bootloader before you can flash TWRP and use CM.
Click to expand...
Click to collapse
Yes my bootloader is unlocked. Have code 3 on the devices.
try and unplug from USB when you reboot

[Q] Can't get to recovery after (successful) upgrade to KK.

Hi,
just got time to update my 2nd XT925 to KK (RSD'd back from CM11 JBBL to stock SFR rom, let the phone find its update and apply it, everything went fine).
But whatever KK recovery I try to flash, it gives me an exclamation mark and nothing else (I'm unlocked, yes).
Don't know what's happening here. Can someone helps please ?
Poursinet said:
Hi,
just got time to update my 2nd XT925 to KK (RSD'd back from CM11 JBBL to stock SFR rom, let the phone find its update and apply it, everything went fine).
But whatever KK recovery I try to flash, it gives me an exclamation mark and nothing else (I'm unlocked, yes).
Don't know what's happening here. Can someone helps please ?
Click to expand...
Click to collapse
Are you saying you are trying to flash a recovery or are you trying to GET to the stock recovery? If you are trying to get to the stock recovery, the key presses to get to it have changed.
Your best bet is to power off your phone. Then, press and hold power+vol up for a few seconds until you see the menu come up. Then, press vol down to highlight Recovery and then press the vol up button.
Eventually, you'll see the "Dead Andy". From there, press and hold vol down+vol up+power. You might have to do it a couple of times. Eventually, you'll be in the recovery but for the XT926, it's kind of hard to read because for some reason, they decided to make it dim.
No (but thanks anyway). What I tried to was only to install a KK recovery for CM11.
I successed but I had 2 problems mixed: the 1st one was that the Linux version of fastboot (or mfastboot) did'nt work with the new bootloader. Both were complaining about "(bootloader) Variable not supported! ". Had to find some old laptop with Windows installed to use it to flash the recovery without error.
But even then if I just let the phone reboot, I would'nt get the new recovery (just the stock one after the keypress you speak about). I had to go straight from bootloader screen to the recovery (by manually rebooting) to get it work. Looks like the standard boot just restored the stock recovery each time I tried.
Thanks anyway, it's working now.
Poursinet said:
No (but thanks anyway). What I tried to was only to install a KK recovery for CM11.
I successed but I had 2 problems mixed: the 1st one was that the Linux version of fastboot (or mfastboot) did'nt work with the new bootloader. Both were complaining about "(bootloader) Variable not supported! ". Had to find some old laptop with Windows installed to use it to flash the recovery without error.
But even then if I just let the phone reboot, I would'nt get the new recovery (just the stock one after the keypress you speak about). I had to go straight from bootloader screen to the recovery (by manually rebooting) to get it work. Looks like the standard boot just restored the stock recovery each time I tried.
Thanks anyway, it's working now.
Click to expand...
Click to collapse
Variable not supported comes up under some Windows, but it usually still works.
You never go straight to the bootloader when you reboot. You have to reboot the phone (or turn it off first) and then press and hold vol up+power. Then, from there, you use vol down to select recovery and then press vol up.
It never boots directly into the recovery unless you tell it to via an ADB command or from within a custom ROM that allows it.
Keep in mind, the stock recovery will override the custom recovery if you don't immediately boot back into recovery. Flash recovery, when that's done, press power to shutdown, and use the method Bolski described to boot into recovery.
Sent from my HTC6525LVW using Tapatalk
RikRong said:
Keep in mind, the stock recovery will override the custom recovery if you don't immediately boot back into recovery. Flash recovery, when that's done, press power to shutdown, and use the method Bolski described to boot into recovery.
Sent from my HTC6525LVW using Tapatalk
Click to expand...
Click to collapse
Let me see if i undestood.
You say that if you don't boot right into recovery, the stock one will overwrite CWM/TWRP. So i understand that, after very reboot you must reflash recovery if you want to use it again.
Or am I missing something?
Caliburno said:
Let me see if i undestood.
You say that if you don't boot right into recovery, the stock one will overwrite CWM/TWRP. So i understand that, after very reboot you must reflash recovery if you want to use it again.
Or am I missing something?
Click to expand...
Click to collapse
It won't reflash every time. You only need to boot straight into recovery the first time, so that the update binary completes. After the first time, you'll be good.
Sent from my HTC6525LVW using Tapatalk
RikRong said:
It won't reflash every time. You only need to boot straight into recovery the first time, so that the update binary completes. After the first time, you'll be good.
Sent from my HTC6525LVW using Tapatalk
Click to expand...
Click to collapse
I think this may be the problem I am having. I cant get my 926 to boot to recovery from fastboot after I load CWM recovery. Is there some trick?

Question samsung a536E stuck on bootloop

hello everyone, today i tried to flash twrp on my phone (rooted with magisk and running stock samsung rom), the flash was successful and i was able to boot into twrp but i coudnt access my storage or anything else, so i saw a guide saying to change the filesystem to ext2 then ext4, after i did that i could access most of the other folders but not the storage foldier as it still showed 0mb. i thought i just need to reboot my device to fix the issue but now im stuck on a bootloop. i cant poweroff the device since no button combination is currently working. is there anything i can do to power it off or do i have to wait a few days till the battery drains to 0?
[RECOVERY][UNOFFICIAL] TWRP for Galaxy A53 5G (Exynos)
Team Win Recovery Project 3.x, or twrp3 for short, is a custom recovery built with ease of use and customization in mind. Its a fully touch driven user interface no more volume rocker or power buttons to mash. The GUI is also fully XML driven and...
forum.xda-developers.com
this is the link i used to flash twrp except i didnt follow the wipe instructions because i dont want to use a custom os.
and if nothing else works and i have to wait a few days till it drains to 0, will i be able to boot back into samsung's recovery mode or is this device hard bricked?
help will be greatly appreciated.
This phone doesn't have the nice feature of holding the power button for force off so that is a negative here.
I don't think you should have edit:changed the partition types. If that was necessary it would be a ridiculous thing for other Android roms to have to do. Its all Android so should have worked without that.
Its unlikely that anything new will result from a cold boot verses a warm boot. Worth a shot I suppose but don't hold your breath. Expect nothing new.
If its stuck without Odin, fastboot, ADB, all buttons not doing anything, can't ingest and do something from sd card, can't show up via USB on computer, etc with nothing at all then its totally finished since nothing can be done. Consider it a loss and learn from it.
I'd like to also state that there are for some reason people who supposedly bring roms over to devices and they don't have the device so therefore don't really know if it works or not. You have to be careful about the guides you follow. I've seen someone try with a device that could not be unlocked ever for anyone and that person thought it would work. Live and learn.
sandsofmyst said:
This phone doesn't have the nice feature of holding the power button for force off so that is a negative here.
I don't think you should have edit:changed the partition types. If that was necessary it would be a ridiculous thing for other Android roms to have to do. Its all Android so should have worked without that.
Its unlikely that anything new will result from a cold boot verses a warm boot. Worth a shot I suppose but don't hold your breath. Expect nothing new.
If its stuck without Odin, fastboot, ADB, all buttons not doing anything, can't ingest and do something from sd card, can't show up via USB on computer, etc with nothing at all then its totally finished since nothing can be done. Consider it a loss and learn from it.
I'd like to also state that there are for some reason people who supposedly bring roms over to devices and they don't have the device so therefore don't really know if it works or not. You have to be careful about the guides you follow. I've seen someone try with a device that could not be unlocked ever for anyone and that person thought it would work. Live and learn.
Click to expand...
Click to collapse
hello, i was able to boot the phone into twrp and do a factory reset, i had to time the vol up + power button at exactly the time when the screen went black and it worked!. but now i have a question, if i want to get twrp again and i dont plan to flash a custom rom like it says in the guide, how do i get twrp to recognize my storage? and do you flash twrp before installing an os or after because ive done it after installing the os.
floppen22 said:
hello, i was able to boot the phone into twrp and do a factory reset, i had to time the vol up + power button at exactly the time when the screen went black and it worked!. but now i have a question, if i want to get twrp again and i dont plan to flash a custom rom like it says in the guide, how do i get twrp to recognize my storage? and do you flash twrp before installing an os or after because ive done it after installing the os.
Click to expand...
Click to collapse
yeah so it seems like the issue isnt with changing the file system or anything because i installed twrp again and tried rebooting and i got the same bootloop issue, but if i flash a rom then ill lose twrp like it happened last time so i dont understand what im supposed to do
you have to format data in twrp otherwise it won't see your storage folder.
once formatted reboot to twrp then reboot to system, it should reboot to stock rom and the set up pages.
beanbean50 said:
you have to format data in twrp otherwise it won't see your storage folder.
once formatted reboot to twrp then reboot to system, it should reboot to stock rom and the set up pages.
Click to expand...
Click to collapse
wipe>format data>type yes>reboot to recovery. i did that and still cant reboot to system bootloop issue persists
yes you did it correctly this time, is there anyway to undo your 'filesystem to ext2 then ext4'?
or maybe you have to flash the custom kernel to get it all up and running again
beanbean50 said:
or maybe you have to flash the custom kernel to get it all up and running again
Click to expand...
Click to collapse
how do i do that? the kernel folder in the guide doesnt have any tar or .img file to flash
floppen22 said:
how do i do that? the kernel folder in the guide doesnt have any tar or .img file to flash
Click to expand...
Click to collapse
it's a zip file so it should flash in twrp
beanbean50 said:
it's a zip file so it should flash in twrp
Click to expand...
Click to collapse
yes i was able to boot into my phone after flashing the kernel. thank you so much.
Try a different version of TWRP I remember this happened to me before and I installed a different version and it was fine

[SOLVED] TWRP not booting

I've been trying to flash TWRP onto my Galaxy S3 and my Galaxy S9 for a few days now, and every time I try to do so, it flashes successfully, but then boots into stock Samsung recovery when entering recovery mode. I've used Odin on Windows and Heimdall on Linux, but both have the same issue. I tried different versions of TWRP as well.
If it helps, I'm pretty sure both phones are OEM unlocked. The S9 has the option in developer options, and says it it unlocked in download mode. The S3 doesn't have any option for this, and doesn't say anything in download mode about it.
Even though the S3 might not be OEM unlocked, it still doesn't explain the issue with the S9.
I'm also dual booting, so all attempts were from the same computer. It might be some issue with my computer, but I really don't have access to another one right now, so I was wondering if anyone had any other ideas or thoughts on the issue. Any help would be appreciated.
Did you check this?
Note many devices will replace your custom recovery automatically during first boot. To prevent this, use Google to find the proper key combo to enter recovery. After typing fastboot reboot, hold the key combo and boot to TWRP. Once TWRP is booted, TWRP will patch the stock ROM to prevent the stock ROM from replacing TWRP. If you don't follow this step, you will have to repeat the install.
Click to expand...
Click to collapse
https://twrp.me/samsung/samsunggalaxys3internationalexynos.html
I think for S3 it's
Vol up + Home + Power
Basically:
1. Flashing
2. Reboot into Recovery by keep pressing Vol up + Home + Power
3. Allow TWRP to become permanent
Perhaps you want to check/re-ask here as well:
https://forum.xda-developers.com/c/samsung-galaxy-s-iii-i9300-i9305.1563/
SigmundDroid said:
Did you check this?
https://twrp.me/samsung/samsunggalaxys3internationalexynos.html
I think for S3 it's
Vol up + Home + Power
Basically:
1. Flashing
2. Reboot into Recovery by keep pressing Vol up + Home + Power
3. Allow TWRP to become permanent
Perhaps you want to check/re-ask here as well:
https://forum.xda-developers.com/c/samsung-galaxy-s-iii-i9300-i9305.1563/
Click to expand...
Click to collapse
Holding the given buttons just brings me to default recovery, so I'm not sure what the proper recovery is. I've also tried Volume Up + Down + Home + Power.
Hmm, didn't flash an S3 for quite some time but I vaguely remember that I had similar problems during
"After typing fastboot reboot, hold the key combo and boot to TWRP. Once TWRP is booted"
and often missed or was too clumsy, too late or both
Would in fastboot the command
fastboot reboot recovery
work for you? Or does it still end up in stock recovery?
Perhaps it's really time to check in the s3 threads for further advice?
SigmundDroid said:
Hmm, didn't flash an S3 for quite some time but I vaguely remember that I had similar problems during
"After typing fastboot reboot, hold the key combo and boot to TWRP. Once TWRP is booted"
and often missed or was too clumsy, too late or both
Would in fastboot the command
fastboot reboot recovery
work for you? Or does it still end up in stock recovery?
Perhaps it's really time to check in the s3 threads for further advice?
Click to expand...
Click to collapse
Okay so turns out I needed to boot into recovery immediately after flashing TWRP on both phones because when booting into the system, the recovery is replaced. After doing this, everything worked fine and I was able to get custom ROMs working! I appreciate your help though

Categories

Resources