0

I'm porting an application that uses the Xbox controller to Linux. On windows, it essentially just uses XInputGetState() to read the state of the controller, so I'm looking for a replacement for that function on Linux.

I see that wine hasn't implemented XInputGetState(), but at the same time there are a large number of games supporting the Xbox controller on Linux, so it's doable.

Does anyone know what library can be used to interact with an Xbox controller on Linux?

Shahbaz
  • 46,337
  • 19
  • 116
  • 182

2 Answers2

4

You can either:

  1. use the SDL library
  2. use the functions in linux/joystick.h yourself
  3. find some other library which abstracts (3) for you like this or the one linked by user3716731.

The (1-2) solutions are mainly C, but so is the XInput API, so you probably can deal with it.

I would probably go with number 1, because that approach should have the best documentation.

smerlin
  • 6,446
  • 3
  • 35
  • 58
2

So I know its not pure C++ however there is a great addon for openFrameworks called ofxGamePad that is compatible with linux. I have had success using it with linux for a gamepad.

gdunstone
  • 101
  • 1
  • 7