Found an easy way to get whether last input was keyboard or gamepad

What if when using the same node I always get that the player is using gamepad when keyboard and mouse are actually being used?