I did buy a new brand gamepad for 21€ in Amazon and connected to my Raspberry Pi. Dmesg didn’t report many details about it, just:
[ 3.342426] usb 1-1.2: new full-speed USB device number 4 using dwc_otg
[ 3.476789] usb 1-1.2: New USB device found, idVendor=044f, idProduct=b326
[ 3.502087] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3.529629] usb 1-1.2: Product: GPX Gamepad
[ 3.551359] usb 1-1.2: Manufacturer: Thrustmaster
[ 3.582106] usb 1-1.2: SerialNumber: 00000001
Well, at least it exists for the kernel.
Executing retroarch-joyconfig:
$ sudo retroarch-joyconfig
Cannot find joystick at index #0, only have 0 joystick(s) available ...
Oh, my God, my wife is going to kill me!!!
Don’t panic, maybe I need a driver or something. I had tried an old Joystick before and everything was ok but its lacking of buttons and axises and some calibration problems made me go for a new gamepad.
This is the Joystick:
This is a GP XID from Thrustmaster, and I had bought it with the promise of being XBox compatible, and I remembered something about XBox gamepads being compatible with retroarch. After some googling I found a driver for this devices:
http://pingus.seul.org/~grumbel/xboxdrv/
Developed by Ingo Ruhnke (thanks Ingo).
Installed with: apt-get install xboxdrv (it’t in raspbian repository, fortunately).
It has an user space part, so you have to run a command:
$ sudo xboxdrv
xboxdrv 0.8.4 - http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmx.de>
Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions; see the
file COPYING for details.
-- [ ERROR ] ------------------------------------------------------
No Xbox or Xbox360 controller found
Oh, no, I’m lost again!!!!
No, you have to RTFM. The FM is REALLY GOOD for this product, and you find some things like:
–device-by-id : force the driver to drive a device by vendor / productid
–type xbox360 : if you use the above parameter, you have to tell what kind of thing it is
–trigger-as-zaxis: it helped me to map the triggers, it tells the driver to manage the triggers as a Z axis instead of two independent axises.
So, with this command:
$ xboxdrv --silent --device-by-id 044f:b326 --type xbox360 --trigger-as-zaxis
xboxdrv 0.8.4 - http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmx.de>
Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions; see the
file COPYING for details.
Controller: unknown
Vendor/Product: 044f:b326
USB Path: 001:004
Controller Type: Xbox360
Your Xbox/Xbox360 controller should now be available as:
/dev/input/js0
/dev/input/event2
Press Ctrl-c to quit
Voila! It works, and now you can map the buttons and axises with retroarch-joyconfig. In my case, I obtained the following configuration:
# Defines axis threshold. Possible values are [0.0, 1.0]
# input_axis_threshold = 0.5
input_player1_joypad_index = "0"
input_player1_a_btn = "0"
input_player1_b_btn = "1"
input_player1_x_btn = "2"
input_player1_y_btn = "3"
input_player1_l_btn = "4"
input_player1_r_btn = "5"
input_player1_l2_axis = "-2"
input_player1_r2_axis = "+2"
input_player1_l3_axis = "-2"
input_player1_r3_axis = "+2"
input_player1_start_btn = "7"
input_exit_emulator_btn = "6" # Added my hand, found the button with jset-gtk
input_player1_select_btn = "8"
input_player1_left_btn = "h0left"
input_player1_up_btn = "h0up"
input_player1_right_btn = "h0right"
input_player1_down_btn = "h0down"
input_player1_l_x_plus_axis = "+0"
input_player1_l_y_plus_axis = "+1"
input_player1_l_x_minus_axis = "-0"
input_player1_l_y_minus_axis = "-1"
input_player1_r_x_plus_axis = "+3"
input_player1_r_y_plus_axis = "+4"
input_player1_r_x_minus_axis = "-3"
input_player1_r_y_minus_axis = "-4"
You can experiment with different –type parameters (please, RTFM).
In my case, I added the xboxdrv execution to:
/home/pi/.xbmc/addons/script.games.rom.collection.browser/applaunch.sh
So it gets executed only when I need it. At the end of the script, I kill (pkill) the xboxdrv process.
Good luck with your gamepads!!