Joystick axis and buttons are now named to standard values, this allows interfacing multiple different controllers (only DS3 is supported) Add ioctl calls for userspace to set joystick player leds and rumble Only use DS3 code paths when we detect that the attached device is actually an DS3 controller update test-joystick program to the new interface and add support to control rumble and player leds
61 lines
803 B
C++
61 lines
803 B
C++
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
namespace LibInput
|
|
{
|
|
|
|
enum JoystickButton
|
|
{
|
|
JSB_DPAD_UP,
|
|
JSB_DPAD_DOWN,
|
|
JSB_DPAD_LEFT,
|
|
JSB_DPAD_RIGHT,
|
|
|
|
JSB_FACE_UP,
|
|
JSB_FACE_DOWN,
|
|
JSB_FACE_LEFT,
|
|
JSB_FACE_RIGHT,
|
|
|
|
JSB_STICK_LEFT,
|
|
JSB_STICK_RIGHT,
|
|
|
|
JSB_SHOULDER_LEFT,
|
|
JSB_SHOULDER_RIGHT,
|
|
|
|
JSB_MENU,
|
|
JSB_START,
|
|
JSB_SELECT,
|
|
|
|
JSB_COUNT,
|
|
};
|
|
|
|
enum JoystickAxis
|
|
{
|
|
JSA_STICK_LEFT_X,
|
|
JSA_STICK_LEFT_Y,
|
|
JSA_STICK_RIGHT_X,
|
|
JSA_STICK_RIGHT_Y,
|
|
|
|
JSA_TRIGGER_LEFT,
|
|
JSA_TRIGGER_RIGHT,
|
|
|
|
JSA_COUNT,
|
|
};
|
|
|
|
// TODO: not used but exists if we ever make controller
|
|
// support generating events instead of being polled
|
|
struct JoystickEvent
|
|
{
|
|
|
|
};
|
|
|
|
struct JoystickState
|
|
{
|
|
// axis are mapped to range [-32767, +32767]
|
|
int16_t axis[JSA_COUNT];
|
|
bool buttons[JSB_COUNT];
|
|
};
|
|
|
|
}
|