Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: X360 controller triggers on linux  (Read 2983 times)

0 Members and 2 Guests are viewing this topic.

bonsairobo

  • Newbie
  • *
  • Posts: 11
    • View Profile
X360 controller triggers on linux
« on: July 12, 2013, 10:56:17 pm »
I'm currently trying to figure out how the triggers on an X360 controller are defined in sf::Joystick. Running jstest-gtk shows that the triggers each belong to an axis. However, I don't think those axes are exposed to SFML. X and Y are used for the left analog stick, U and V for the right analog stick, and Z and R are not defined, according to sf::Joystick::hasAxis(0, sf::Joystick::Z/R). The only other option would be that they are interpreted as buttons, and I'm not sure which ones to check.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: X360 controller triggers on linux
« Reply #1 on: July 12, 2013, 11:01:00 pm »
SFML uses the mapping provided by the driver. So it should be similar to what you get with other joystick utilities.
Laurent Gomila - SFML developer

bonsairobo

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: X360 controller triggers on linux
« Reply #2 on: July 13, 2013, 04:02:04 am »
Then I'm out of luck? None of the sf::Joystick axes map to the triggers.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: X360 controller triggers on linux
« Reply #3 on: July 13, 2013, 08:51:23 am »
I have no idea, sorry. But you can investigate and submit a patch if you find something.
Laurent Gomila - SFML developer

CriticalThread

  • Guest
Re: X360 controller triggers on linux
« Reply #4 on: July 13, 2013, 10:55:02 am »
Hi there,
I'm using xboxdrv from http://pingus.seul.org/~grumbel/xboxdrv/ and it works like on windows with this command:

sudo xboxdrv --trigger-as-zaxis

to get the trigger as buttons use:

sudo xboxdrv --trigger-as-button

also see http://pingus.seul.org/~grumbel/xboxdrv/xboxdrv.html for all possible commands or type
xboxdrv -h
in your terminal

hope that helps :)

« Last Edit: July 13, 2013, 11:32:20 am by CriticalThread »

bonsairobo

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: X360 controller triggers on linux
« Reply #5 on: July 13, 2013, 07:50:53 pm »
Hey thanks! I actually just got it working with sudo xboxdrv --detach-kernel-driver --mimic-xpad. I don't own an X360 controller so I had to emulate one with my Dualshock 3. This way I was actually able to split the triggers between the Z and R axes.