I try to retrieve the values of the gamepad axes with:
GLFWgamepadstate state;
glfwGetGamepadState(GLFW_JOYSTICK_1, &state);
float leftX = state.axes[GLFW_GAMEPAD_AXIS_LEFT_X];
float leftY = state.axes[GLFW_GAMEPAD_AXIS_LEFT_Y];
float rightX = state.axes[GLFW_GAMEPAD_AXIS_RIGHT_X];
float rightY = state.axes[GLFW_GAMEPAD_AXIS_RIGHT_Y];
By default all values are 0.0f (error: +/- 0.004f) and goes from -1.0f to 1.0f except for leftY.
For leftY, the value start at 0.58f (error of 0.08f?) and goes from 0.0f to 1.0f. Is it something expected ? Or is it a possible bug ?
Thank you.
I tested this morning and now, it works correctly !
Yesterday, my gamepad was identified as “03000000457500000401000011010000,SZMY Power DS4 Wired Controller”
Today, my gamepad is identified as “030000004c0500006802000011810000,PS3 Controller”
Here is the result of the udevadm command on my Linux:
greg@greg-desktop:~$ udevadm info -a /dev/input/js0 | grep -E 'id/|name'
ATTRS{id/bustype}=="0003"
ATTRS{id/product}=="0268"
ATTRS{id/vendor}=="054c"
ATTRS{id/version}=="8111"
ATTRS{name}=="SZMY-POWER CO.,LTD. PLAYSTATION(R)3 Controller"
From what I understand from ‘glfw/linux-joystick.c’, the identification of the wrong controller is directly related to what is returned by /dev/input/js0. So, I guess it is not a bug in GLFW itself.