[Hardware Hacking General] xCaldazar:
Progress so far:

First I figured I need to find what the key code is.

I opened up my terminal emulator and was happy to find the command 'showkey' available. Only 'showkey -a' seems to work, the -s and -k options gave me errors. Once I ran the command I was able to get all of my key presses to ouput their key code. But the hardware buttons (home/menu/back/vol up/ vol down) would not register.

Since that was unsuccessful I decided to try the key test that is built into the cwm recovery. This was far more successful. I got the following ouput for my Galaxy S3:

Volume Up = 114

Volume Down = 115

Lock Screen =116

Menu = 139

Home = 172

Just to confirm these can be different from one phone to the next I tested my Droid and a Galaxy Nexus.

Galaxy Nexus:

Volume Up =115

Volume Down =114

Lock Screen =166

For my OG Droid:

Volume Up = 114

Volume Down = 115

Lock Screen = 107

Home/Menu/Back/Search = no output

Thanks to my droid I was able to check if these hardware buttons had direct correlation to the software ascii counterparts. They did not appear to, the hardware buttons for the droid keyboard Started at Q=16 and continued to count by one as I went across the keyboard. (ie Q=16 W=17 E=18...)

On the Arduino Side of things I am working with this hardware:

https://www.olimex.com/Products/Duino/AVR/OLIMEXINO-328/

http://www.seeedstudio.com/wiki/index.php?title=Bluetooth_Shield

To read the bluetooth data coming in I found Bluetooth SPP in the Google Play store. I like that it allowed to change the view to either hex or ascii data. https://play.google.com/store/apps/details?id=mobi.dzs.android.BluetoothSPP&hl=en

I used the 'slave' code listed on the Bluetooth Shield page. For starters I just altered the contents of the if statment that check if the bluetoothSerial is available, which is within the void loop(). Anyways I set the code to just output whatever was input to it to make a simple echo.

void loop()
{
char recvChar;
while(1){
if(blueToothSerial.available()){//check if there's any data sent from the remote bluetooth shield
recvChar = blueToothSerial.read();
Serial.print(recvChar);
blueToothSerial.print(recvChar);

Later on I made an if statement to output data to my choosing. I had started with blueToothSerial.print, but found even with the BIN/HEX/OCT options it was still outputting ascii. blueToothSerial.write output the raw data that I wanted. So if I put blueToothSerial.write(172) it was going to send the binary equivalent 10101100, or hex equivalent AC.

void loop()
{
char recvChar;
char m = 'm';
while(1){
if(blueToothSerial.available()){//check if there's any data sent from the remote bluetooth shield
recvChar = blueToothSerial.read();
Serial.print(recvChar);
//blueToothSerial.print(recvChar);
if(recvChar == m){
blueToothSerial.write(172);
}

As expected sending 172 does not just magically show up as a key press and open my menu button. I don't like to overlook the overly simple attempts until they are at least tried. Plus it gave me time to familiarize with arduino.

I can now send whatever data I feel like using arduino, I just need to figure out how to make it appear as a hardware button press. It might be time for me to dig through android source code to understand the bluetooth interaction to the rest of the system.