How can I use a button on my bluetooth gamepad to execute a shell script on my rpi 3 in raspbian?
Ahh yes, I may be able to help you.
When I installed RetroPie I was working on keymapping a Wii remote. Wii remotes are Bluetooth, so I linked my Pi to my remote. I failed to keymap the entire thing except for the D-Pad (directional pad). The D-pad were acting as the up, down, left, and right arrows of the keyboard.
If you made another script listening for the key press of a key like that, it could react, and activate the script. Except with your Gamepad it could be different.
Try pairing them and try the key presses in a keymapping tool.
Hope this helps, Dallin
I used xbindkeys_config which is a seperate package than just the standard xbindkeys. It uses a gui instead of configuring a text file. Also my bluetooth controller had a switch on the back to change from gamepad mode to keyboard mode, which I originally had on gamepad. When switched to keyboard the xbindkeys config easily recognized the buttons and gave me no problems. In the gui I also set the command to run a shell script which was very easy as well. So if your having issues with your keycodes give xbindkeys a try. Thanks for pointing me in the right direction Dallin.