# PS4 Controller axis behaving differently

**URL:** <https://discourse.glfw.org/t/ps4-controller-axis-behaving-differently/2162>\
**Category:** support\
**Created:** [October 1, 2022, 7:42pm UTC](https://discourse.glfw.org/t/ps4-controller-axis-behaving-differently/2162 "2022-10-01T19:42:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kivutar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/kivutar/32/215_2.png) [@kivutar](https://discourse.glfw.org/u/kivutar)\
**Post date:** [October 1, 2022, 7:42pm UTC](https://discourse.glfw.org/t/ps4-controller-axis-behaving-differently/2162/1 "2022-10-01T19:42:18Z")

</div>

Hello, I’m writing 2 GLFW programs that are supposed to behave exactly the same.  
One program is in C, the other one is in Go.  
On these 2 programs, the binding for my PS4 Controller is not doing the same thing.  
I’m testing both programs on the same laptop, Mac OSX arm64.  
I’m testing both programs with the exact same controller connected in Bluetooth.  
Both programs are using GLFW 7482de6071d21db77a7236155da44c172a7f6c9e (tag 3.3.8)  
Both programs are using the same SDL\_GameControllerDB.

Yet, axes[GLFW\_GAMEPAD\_AXIS\_RIGHT\_Y] reports wrong values in the C version.  
Also, glfwGetJoystickName is not reporting the same name in the C version.

In the Go program:

- the mappings are here [ludo/mappings.go at master · libretro/ludo · GitHub](https://github.com/libretro/ludo/blob/master/input/mappings.go)
- glfwGetJoystickName returns “PS4 Controller”
- GUID is 030000004c050000c405000000010000
- glfwJoystickPresent returns true
- This axis behaves correctly: GLFW\_GAMEPAD\_AXIS\_RIGHT\_Y value is 0, and varies between -1 and 1 when I move it.

In the C program:

- the mappings are here [rombundler/mappings.h at 55d6cefe7616aaa96c21ddc8ee06ce82dc8f5021 · kivutar/rombundler · GitHub](https://github.com/kivutar/rombundler/blob/55d6cefe7616aaa96c21ddc8ee06ce82dc8f5021/mappings.h)
- glfwGetJoystickName returns “DUALSHOCK 4 Wireless Controller”
- GUID is 030000004c050000c405000000010000
- glfwJoystickPresent returns true
- This axis behaves incorrectly: GLFW\_GAMEPAD\_AXIS\_RIGHT\_Y is -1, and it looks like GLFW\_GAMEPAD\_AXIS\_RIGHT\_TRIGGER is controlling the RIGHT\_Y axis.

Do you have any idea of what could be causing this difference in glfwGetJoystickName and mapping?

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [October 2, 2022, 2:22pm UTC](https://discourse.glfw.org/t/ps4-controller-axis-behaving-differently/2162/2 "2022-10-02T14:22:25Z")

</div>

Have you tried the [joysticks.c](https://github.com/glfw/glfw/blob/master/tests/joysticks.c) test included with the GLFW source with the default mappings and modified to load your own?

`030000004c050000c405000000010000` refers to a “PS4 Controller” in both mappings you link to, as does the default GLFW mapping.

I presume you’ve checked that you are using the same mappings. If you are getting differences they are either being loaded differently or referenced differently so debugging [glfwUpdateGamepadMappings](https://github.com/glfw/glfw/blob/3a60992a418aad88717db32353bec22e8bb7dab3/src/input.c#L1249-L1307) to check their loading (or adding printf’s to the source code).

I think the name from `glfwGetJoystickName` doesn’t use a mapping name but instead uses a system provided name, but the name from `glfwGetGamepadName` does. Is it possible Go is calling the `glfwGetGamepadName` function rather than `glfwGetJoystickName`?

---

<div class="post-metadata">

**Author:** ![kivutar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/kivutar/32/215_2.png) [@kivutar](https://discourse.glfw.org/u/kivutar)\
**Post date:** [October 3, 2022, 9:11am UTC](https://discourse.glfw.org/t/ps4-controller-axis-behaving-differently/2162/3 "2022-10-03T09:11:10Z")

</div>

I found what was causing the difference in behaviour.

I was using glfwGetJoystickAxes which returns the values for the axes at the kernel level.

I had to use pad.axes from glfwGetGamepadState(port, &pad) instead, this will return the value of the axes post mapping.

And you were right about glfwGetJoystickName vs glfwGetGamepadName. Thanks for the help.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [October 3, 2022, 9:34am UTC](https://discourse.glfw.org/t/ps4-controller-axis-behaving-differently/2162/4 "2022-10-03T09:34:04Z")

</div>

Excellent, glad you have resolved this.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [November 16, 2026, 4:13pm UTC](https://discourse.glfw.org/t/ps4-controller-axis-behaving-differently/2162/5 "2026-11-16T16:13:07Z")

</div>

Closed on November 16, 2026, 4:13pm UTC


