How would you get a device's index?

With gamepad you have action.gamepad.
But how would you get the index of a mouse or a tablet?