Are there any command line utilities that can capture joystick button presses?

Give jstest a try. This article discusses its use, titled: flightgear.org - Input device. Appears to be installed by default in most distros. Also, here's a link to the jstest man page.

Basically you have to determine what device the joystick is being assigned. Look in the dmesg log file after you plug it in to get this info. Might be something like /dev/input0.

$ dmesg | grep Joystick
input0: USB HID v1.00 Joystick [SAITEK CYBORG 3D USB] on usb2:3.0 

Then run this command:

$ jstest /dev/input0

This looks like a common problem with RetroPie/Emulation station.

They address it in the RetroPie-Setup Wiki: https://github.com/petrockblog/RetroPie-Setup/wiki/EmulationStation#my-emulator-wont-close-through-my-gamepad

It should just require editing your RetroArch config file to add a line:

input_exit_emulator_btn = “6″

Where "6" is the gamepad button identifier.


If you want to make it work with a key combination, you can instead add the following lines: (from http://forum.themaister.net/viewtopic.php?pid=1065#p1065)

input_enable_hotkey_btn = 1
input_exit_emulator_btn = 2

This makes it so that you need to press button 1 to "unlock" hotkeys, and press 2 at the same time to quit.