code: def __check_state(self):
          
          state = self.__read_device()
          if not state:
              raise UnpluggedError(
                  "Gamepad %d is not connected" % self.__device_number)
          if state.packet_number != self.__last_state.packet_number:
              # state has changed, handle the change
              self.__handle_changed_state(state)
              self.__last_state = state
docs: On Windows, check the state and fill the event character device.