Detecting controllers total button count

I have been writing a controller class to interpret controller input into my game, but I can’t find any reference to getting the current controllers total button count. The reason I require this is so one every tick I can loop through the controller buttons and check their states.

Any advice?

See the documentation for glfwGetJoystickButtons. The variable pointed to by count will be modified to contain the number of button states returned for that joystick.