On Windows, you can register a callback function to react when a game or application sends rumble (vibration) or LED ring updates to the virtual gamepad. This is useful for synchronizing your own logic with the gamepad's state changes.
Callback Signature
Your callback must accept exactly 6 parameters:
my_callback(client, target, large_motor, small_motor, led_number, user_data)
client: ViGEm bus IDtarget: ViGEm device IDlarge_motor: Integer [0, 255]small_motor: Integer [0, 255]led_number: Integer [0, 255]user_data: Placeholder (do not use)
Registration
Use register_notification(callback_function=...) to start listening, and unregister_notification() to stop.
def my_callback(client, target, large_motor, small_motor, led_number, user_data):
print(f"Large motor: {large_motor}, Small motor: {small_motor}, LED: {led_number}")
gamepad.register_notification(callback_function=my_callback)
# ... later ...
gamepad.unregister_notification()