From 25787017e54cf832aa764badabced48e163a0123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD=20=D0=A2=D1=80=D0=BE=D1=88?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Sat, 12 Sep 2026 12:43:43 +0300 Subject: [PATCH] server: make reset-free fast init the default; add --full-pysim-init Fast init (fastinit.py) is now the default for startup and equip: all profile probes run on one connection, RuntimeState uses a software reset and only explicit equip/reset reconnect the card. Measured on the reference reader: equip 1729ms vs 9850ms and zero RESET events vs 7-8. --full-pysim-init restores pysim's stock init_card/equip for compatibility/debugging; the former --fast-init flag is kept as a hidden no-op alias so existing command lines keep parsing. Docs updated. --- README.md | 2 +- README_RUS.md | 2 +- pysim_otaman_server/__main__.py | 6 ++++-- pysim_otaman_server/fastinit.py | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ef5d174..ea1e2a4 100644 --- a/README.md +++ b/README.md @@ -627,7 +627,7 @@ pysim-otaman-server --http-port 8080 | `--sms-oa` / `--sms-sm-sc` | SMS-DELIVER originating address / SM-SC for PoR-in-submit | | `--terminal-profile` | TERMINAL PROFILE payload hex (default 10-byte GSM profile) | | `--poll-interval` | Idle interval before automatic STATUS polling (default 30s; `0` disables polling) | -| `--fast-init` | Init/equip without redundant card resets (only explicit equip/reset resets the card) | +| `--full-pysim-init` | Use pysim's stock init/equip (redundant card resets). The default init/equip is reset-free — only explicit equip/reset reconnect the card | | `--menu-timeout` | Auto-answer a paused STK command with a timeout TERMINAL RESPONSE (default 60s; `0` disables) | | `--timing` | Log phase durations, card resets and APDU counters with elapsed timestamps | diff --git a/README_RUS.md b/README_RUS.md index 88e3538..605b0e5 100644 --- a/README_RUS.md +++ b/README_RUS.md @@ -607,7 +607,7 @@ pysim-otaman-server --http-port 8080 | `--apdu-trace` | Лог APDU-трафика в stderr | | `--log-requests` | Лог запросов/ответов в stderr | | `--poll-interval` | Интервал автоопроса STATUS (по умолчанию 30с; `0` отключает опрос) | -| `--fast-init` | Инициализация/equip без лишних сбросов карты (сброс только по явным equip/reset) | +| `--full-pysim-init` | Штатная инициализация/equip из pysim (с лишними сбросами карты). По умолчанию инициализация без лишних сбросов — карта переподключается только по явным equip/reset | | `--menu-timeout` | Автоответ timeout TERMINAL RESPONSE на приостановленную STK-команду (по умолчанию 60с; `0` отключает) | | `--timing` | Лог длительности фаз, сбросов карты и счётчиков APDU с отметками времени | diff --git a/pysim_otaman_server/__main__.py b/pysim_otaman_server/__main__.py index 57ab8bb..71fc0c2 100644 --- a/pysim_otaman_server/__main__.py +++ b/pysim_otaman_server/__main__.py @@ -50,13 +50,15 @@ def main(): help='Skip pysim card initialization (preserve CAT session — no file manager)') parser.add_argument('--timing', action='store_true', default=False, help='Log phase durations, card resets and APDU counters with elapsed timestamps') - parser.add_argument('--fast-init', action='store_true', default=False, - help='Init/equip without redundant card resets (reset only on explicit equip/reset)') + parser.add_argument('--fast-init', action='store_true', help=argparse.SUPPRESS) + parser.add_argument('--full-pysim-init', action='store_true', default=False, + help="Use pysim's stock init_card/equip (multiple physical card resets) instead of the default reset-free fast init") parser.add_argument('--menu-timeout', type=int, default=60, metavar='SECS', help='Auto-send a timeout TERMINAL RESPONSE if a paused STK command is not answered (default: 60, 0 disables)') opts = parser.parse_args() opts.skip_card_init = opts.no_card_init + opts.fast_init = not opts.full_pysim_init if opts.timing: _timing_on() if opts.menu_timeout is not None: diff --git a/pysim_otaman_server/fastinit.py b/pysim_otaman_server/fastinit.py index 7e4baea..eb600f9 100644 --- a/pysim_otaman_server/fastinit.py +++ b/pysim_otaman_server/fastinit.py @@ -9,8 +9,9 @@ restored in software. This module mirrors ``pySim.app.init_card()`` with those resets removed: all profile probes run back-to-back on the same connection and the runtime state -uses a software reset. The explicit ``equip`` and ``reset`` commands keep a -real reconnect/physical reset. +uses a software reset. It is the default init/equip path; ``--full-pysim-init`` +restores pysim's stock behavior, and the explicit ``equip``/``reset`` commands +keep a real reconnect/physical reset. """ import operator