Fix broken Nexus S power button
Most Google Nexus S phones seem to have a flimsy power button that gets defective after a while of use. This seems to be a hardware issue and only way to fix is to either take it to Samsung and get it repaired for a cost or remap one of your existing buttons (Volume up or Volume down) to act like a power button.
To remap you should have a rooted phone to be able to edit the config file "/usr/system/keylayout/herring-keypad.kl" To edit the file install "Terminal Emulator" and "BusyBox" application. Now using your favourite editor.
In the file change the line
key 115 VOLUME_UP WAKEto
key 115 POWER WAKE
If you are not sure how to edit. Use the following:
vi /usr/system/keylayout/herring-keypad.klInside vi type in the following
:s/115 VOLUME_UP/115 POWER/g :wq
And reboot your phone.
This would make your Volume Up button the power button.
To change volume
Now you would not be able to use the button to increase volume, but you can use the volume down button to reduce the volume that brings up a slider on the touch screen that you can slide up to increase the volume.
To boot phone
This however still only works after the android OS boots up. So for turning the phone on after shutdown, I usually take out the battery and put it back, and it comes right back on. I am still unsure what to do if the battery drains.21 Jun, 2013