I believe the onPerformed event uses a CallbackContext, which has many properties. One of which is action, which is a reference to the InputAction which it belongs to. The InputAction has a property called name which is the Action’s name. So you can try something like this:
It’s a C# event subscription. Do not put anything like this in an Update loop. You need to subscribe once (per receiving object) and you need to unsubscribe when you’re done (unless you truly need the subscription until the exit of the application).
It is about actions. So when you have a “Fire” action to shoot, and the player activate this action through the button/key you set for the action, this delegate will be invoked and the context will tell you what triggered the action.
This will not give you any arbitrary key- or button-presses outside of the scope of this action.
All this information is about one action (button press or joystick move or whatever).
If you only want to show the gamepad button presses, first, you need to restrict your action to the game pad OR you can read the used device through the control property of the context.