I have a 1.5 year old Nexus 5 and its power button is somehow broken from the inside. The thing goes in a reboot loop whenever I either try to turn the phone on or put it on charging. Upon giving it a good smack, it somehow works and boots but it's only good for about a few minutes as whenever even a bit of pressure is applied on the power button, it goes in the reboot loop again.
So, I've been trying to completely remap the power button to Vol UP button and somehow completely disable that broke power button so the OS doesn't even consider its inputs. Here are some helpful links I came across, except the issue is the inability to push the changed keymap files back to /system without root.
I tried installing twrp but by doing going to bootloader via adb but then after I flash twrp and try to switch to newly installed recovery, the broke power button takes over and puts it into a reboot loop. If I try to get to recovery via
adb, it goes to stock recovery as it is somehow overwriting twrp during the boot process.
I wouldn't mind getting the stock Android source code and somehow disabling all those mappings and reflash the new ROM on the device but I have no idea what files I need to go to, for disabling the power button.
So, I'm kinda stuck right now. Any help or pointers would be appreciated! Thank you!