def _on_reader(self, watcher, reader, lock=None):
        if reader:
            if self._reader is None:
                self._reader = reader
                self._creds = []
                if is_minimized(self._app.window):
                    self._needs_read = True
                else:
                    ccid_dev = watcher.open()
                    if ccid_dev:
                        std = YubiOathCcid(ccid_dev)
                        self._app.worker.post_fg((self._init_std, std))
                    else:
                        self._needs_read = True
            elif self._needs_read:
                self.refresh_codes(self.timer.time)
        else:
            self._reader = None
            self._creds = None
            self.refreshed.emit()