After a card swap (or the first insertion after startup) on Windows the auto-equip looped forever: "card inserted, initializing" / "card gone during initialization", with no "retry 2/3" lines. An equip with the card still present produced no card (app.card None), and that branch reported "card gone" and returned True - a no-op success - so the three retries never ran and the watchdog re-armed every ~5 s. - The card-gone no-op is now only for a real removal (card_present False); a card-present init that produced no card raises a failure. - Any failed attempt marks the transport stale, so the next attempt rebuilds the PC/SC link (a Windows swap can leave the old link unable to connect; _ensure_transport releases the old link before building the new one, so the 2026-09-24 stale-handle bug cannot recur). - The error pySim swallowed (cmd2) is printed as "AUTO-EQUIP: init output:" with its traceback - the failure is diagnosable from the log. - Docs: the READMEs' troubleshooting bullet. - Version strings + the PWA cache bumped together (simple-v460). Tests: a card-present init without a card is a failure, a mid-init removal stays a silent no-op, any failure marks the transport, the stale-handle traceback reaches the log, and an end-to-end retry: a failed init, the old link released, a fresh one built, the retry succeeds. 1012 Python + 953 frontend green.
This commit is contained in:
+1
-1
@@ -783,7 +783,7 @@ pysim-simple-server --http-port 8080
|
||||
- **"Failed to establish context: Access denied"** — `pcscd` не запущен или нет прав: `sudo systemctl enable --now pcscd && sudo usermod -a -G pcscd $USER`.
|
||||
- **"device file /dev/ttyUSB0 does not exist"** — нет serial-ридера; подключите USB-ридер или укажите `-d`. Сервер всё равно стартует без ридера.
|
||||
- **"Service not available" (0x8010001D) / ридер пропал после перезапуска `pcscd`** — сервер восстанавливается сам: сторож перезапускает монитор присутствия pyscard, а следующий equip (автоматически после повторной вставки карты или кнопкой **Equip**) пересоздаёт транспорт PC/SC (сначала освобождая старый линк). Перезапуск сервера не нужен.
|
||||
- **Ошибки "Card was removed" / equip не срабатывает после смены карты** — обычная смена карты переподключается на существующем транспорте (карточные ошибки PC/SC больше не вызывают пересоздание транспорта), неудавшийся авто-equip повторяется до 3 раз, а сторож перезапускает его каждые 5 с, пока карта в ридере. Снятие карты теперь полностью очищает состояние, поэтому обработчики отвечают «нет карты», а не шлют APDU мёртвой карте.
|
||||
- **Ошибки "Card was removed" / equip не срабатывает после смены карты** — авто-equip повторяется до 3 раз, и **каждая неудачная попытка пересоздаёт транспорт PC/SC** перед следующей: после смены карты в Windows старое соединение может остаться неспособным подключиться, из-за чего раньше все повторы падали, а сторож перезапускал попытки бесконечно. Проглоченная ошибка инициализации (с трассировкой) теперь печатается как `AUTO-EQUIP: init output:`, а «карта есть, но карта не создана» — это ошибка, а не тихое «карта пропала». Сторож повторяет с удвоением задержки (5 с … 60 с), пока карта в ридере; снятие карты полностью очищает состояние, поэтому обработчики отвечают «нет карты», а не шлют APDU мёртвой карте.
|
||||
|
||||
### Справочник API
|
||||
|
||||
|
||||
Reference in New Issue
Block a user