'Run the loop of the KeyboardRemote.'

def run(self):

    from evdev import categorize, ecodes
    if (self.dev is not None):
        self.dev.grab()
        _LOGGER.debug('Interface    started    for    %s', self.dev)
    while (not self.stopped.isSet()):
        time.sleep(0.1)
        if (self.dev is None):
            self.dev = self._get_keyboard_device()
            if (self.dev is not None):
                self.dev.grab()
                self.hass.bus.fire(KEYBOARD_REMOTE_CONNECTED)
                _LOGGER.debug('Keyboard    re-connected,    %s', self.device_id)
            else:
                continue
        try:
            event = self.dev.read_one()
        except IOError:
            self.dev = None
            self.hass.bus.fire(KEYBOARD_REMOTE_DISCONNECTED)
            _LOGGER.debug('Keyboard    disconnected,    %s', self.device_id)
            continue
        if (not event):
            continue
        if ((event.type is ecodes.EV_KEY) and (event.value is self.key_value)):
            _LOGGER.debug(categorize(event))
            self.hass.bus.fire(KEYBOARD_REMOTE_COMMAND_RECEIVED, {KEY_CODE: event.code})
