al_get_haptic_from_joystick man page
al_get_haptic_from_joystick — Allegro 5 API
#include <allegro5/allegro.h> ALLEGRO_HAPTIC *al_get_haptic_from_joystick(ALLEGRO_JOYSTICK *dev)
If the joystick has haptic capabilities, returns the associated haptic device handle. Otherwise returns NULL. It's neccesary to call this again every time the joystick configuration changes, such as through hot plugging. In that case, the old haptic device must be released using al_release_haptic(3).
[Unstable API]: Perhaps could be simplified due to limited support for all the exposed features across all of the platforms. Awaiting feedback from users.