sercomm-printserver 0.2.2__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/CHANGELOG.md +23 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/PKG-INFO +16 -2
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/README.md +14 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/docs/systemdesign/module_reference.md +11 -2
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/pyproject.toml +3 -3
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/__init__.py +10 -1
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/__init__conf__.py +1 -1
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/commands/_device.py +4 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/commands/printing.py +43 -4
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/exit_codes.py +3 -1
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/memory/device.py +10 -2
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/application/print_server.py +102 -4
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/errors.py +28 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_cli_device.py +76 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_e2e_device.py +30 -1
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_e2e_printer.py +9 -1
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_print_server.py +174 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_public_api.py +24 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/.gitignore +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/CONFIG.md +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/LICENSE +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/docs/Manual-PS301.md +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/docs/adr/0001-memory-adapters-in-src.md +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/docs/config-keys.md +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/docs/device-dump/CONFIG.txt +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/docs/device-dump/PSINF-factory.txt +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/docs/device-dump/PSINF.txt +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/docs/device-dump/fw6a10/CONFIG.txt +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/docs/device-dump/telnet-monitor.txt +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/docs/plans/2026-10-23-library-design.md +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/__main__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/commands/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/commands/arp.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/commands/config.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/commands/device.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/commands/device_config.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/commands/discover.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/commands/info.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/config_load.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/constants.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/context.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/envelope.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/main.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/root.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/safe_console.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/cli/typed_click.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/config/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/config/defaultconfig.d/40-layered-config.toml +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/config/defaultconfig.d/50-device.toml +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/config/defaultconfig.d/90-logging.toml +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/config/defaultconfig.toml +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/config/deploy.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/config/device_settings.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/config/display.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/config/loader.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/config/overrides.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/config/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/discovery/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/discovery/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/discovery/scanner.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/ftp/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/ftp/client.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/ftp/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/logging/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/logging/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/logging/setup.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/lpd/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/lpd/client.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/lpd/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/memory/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/memory/config.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/memory/discovery.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/memory/logging.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/memory/neighbors.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/neighbors/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/neighbors/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/neighbors/table.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/raw/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/raw/printer.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/raw/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/snmp/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/snmp/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/snmp/uptime.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/telnet/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/telnet/client.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/telnet/iac.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/telnet/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/tftp/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/tftp/client.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/adapters/tftp/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/application/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/application/arp_trick.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/application/discovery.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/application/ports.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/application/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/composition/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/composition/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/__init__.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/config_catalogue.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/config_codec.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/config_lines.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/config_model.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/config_reader.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/config_types.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/config_writer.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/device_files.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/device_info.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/endpoint.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/enums.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/neighbor.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/port_status.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/entry.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/py.typed +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/conftest.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/fake_ftp_server.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/fake_lpd_server.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/fake_raw_server.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/fake_telnet_server.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/fake_tftp_server.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/layer_roots.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_adapter_ftp.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_adapter_lpd.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_adapter_neighbors.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_adapter_raw.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_adapter_snmp.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_adapter_telnet.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_adapter_tftp.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_arp_trick.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_cache_effectiveness.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_cli_arp.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_cli_config.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_cli_config_errors.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_cli_core.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_cli_env_file.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_cli_envelope.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_cli_exit_codes.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_cli_main_exit.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_cli_overrides.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_cli_validation.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_config_catalogue.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_config_codec.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_config_layer_isolation.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_config_overrides.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_coverage_database.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_declared_dependencies.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_deploy_mode_safety.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_deploy_permissions.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_device_reports.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_discovery.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_display.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_enums.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_errors.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_logging.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_logging_dotenv_isolation.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_memory_logging.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_metadata.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_metadata_sync.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_module_entry.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_packaging.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_permission_defaults.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_platform_markers.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_port_status.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_ports.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_property_overrides.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_safe_console.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_settings_dotenv_numbers.py +0 -0
- {sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/tests/test_tcp_fixture_portability.py +0 -0
|
@@ -6,6 +6,29 @@ the [Keep a Changelog](https://keepachangelog.com/) format.
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.3.0] - 2026-11-02
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `print raw --verify` (library: `PrintServer.print_raw_verified`) waits for the port the logical
|
|
14
|
+
printer is routed to to read `Idle`, sends, and waits again, each for up to `--verify-timeout`
|
|
15
|
+
seconds (default 30). A plain `print raw` succeeds once the device took the bytes: a port held by
|
|
16
|
+
another job accepts a new one, and a job that blocks the port afterwards goes unnoticed. A port
|
|
17
|
+
still busy before the send exits 75 with `PortBusyError`, nothing sent. After the send it exits
|
|
18
|
+
110 with `JobNotDrainedError`, which always means the data was sent; exit 69 comes only from
|
|
19
|
+
before or during the send. `Idle` means the port is free, not that a page came out. Without
|
|
20
|
+
`--verify` the command and its JSON answer are unchanged; with it the answer adds `idle_port`.
|
|
21
|
+
- The package root exports `PortBusyError` and `JobNotDrainedError`, and the enums a `PortStatus`
|
|
22
|
+
holds: `PortId`, `PortState`, `PortType` and `PrinterStatus`. They were importable only from
|
|
23
|
+
internal modules.
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- `notebooks/Quickstart.ipynb` installs the checkout it runs in, so CI's "Execute notebooks" job
|
|
28
|
+
tests the commit under test. It used to install `git+https://github.com/...` every time, which is
|
|
29
|
+
the pushed default branch, so a pull request's notebook run tested the code already there.
|
|
30
|
+
Outside a checkout (a downloaded notebook) it still installs from GitHub.
|
|
31
|
+
|
|
9
32
|
## [0.2.2] - 2026-10-30
|
|
10
33
|
|
|
11
34
|
### Changed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: sercomm-printserver
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: CLI and Python library for SerComm-based network print servers (PS301 and OEM variants)
|
|
5
5
|
Project-URL: Homepage, https://github.com/bitranox/sercomm-printserver
|
|
6
6
|
Project-URL: Repository, https://github.com/bitranox/sercomm-printserver.git
|
|
@@ -25,7 +25,7 @@ Requires-Python: >=3.10
|
|
|
25
25
|
Requires-Dist: click>=8.5.0
|
|
26
26
|
Requires-Dist: ipscout>=2.5.4
|
|
27
27
|
Requires-Dist: lib-cli-exit-tools>=2.4.1
|
|
28
|
-
Requires-Dist: lib-layered-config>=7.
|
|
28
|
+
Requires-Dist: lib-layered-config>=7.7.0
|
|
29
29
|
Requires-Dist: lib-log-rich>=8.1.2
|
|
30
30
|
Requires-Dist: orjson>=3.13.0
|
|
31
31
|
Requires-Dist: pydantic>=2.14.1
|
|
@@ -280,6 +280,18 @@ an LPD job. Data that no printer takes stays queued and keeps the port busy unti
|
|
|
280
280
|
there fails after `--timeout` with exit 76, because the device holds back its acknowledgement.
|
|
281
281
|
`print lpd` names the job `job` unless `--job-name` says otherwise.
|
|
282
282
|
|
|
283
|
+
`print raw` succeeds as soon as the device took the bytes, whatever the port is doing: a port held
|
|
284
|
+
by another job accepts a new one, and a job that blocks the port afterwards goes unnoticed. With
|
|
285
|
+
`--verify` it waits for the port the printer is routed to to read `Idle`, sends, and waits again,
|
|
286
|
+
each for up to `--verify-timeout` seconds (default 30; raise it for a long job). A port still busy
|
|
287
|
+
before the send exits 75 with nothing sent, so sending later is safe. After the send it exits 110:
|
|
288
|
+
the data was sent, so do not resend it blindly. `Idle` means the port is free again, not that a
|
|
289
|
+
page came out.
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
sercomm-printserver print raw 3 label.dpl --verify
|
|
293
|
+
```
|
|
294
|
+
|
|
283
295
|
### A device without a usable address
|
|
284
296
|
|
|
285
297
|
The device answers any address this host maps to its MAC, which is how the vendor manuals
|
|
@@ -319,10 +331,12 @@ any JSON is written: exit 2 and a usage message on stderr. Exit codes do not dep
|
|
|
319
331
|
| | `config-deploy`: a system dir) |
|
|
320
332
|
| 22 | invalid argument |
|
|
321
333
|
| 69 | the device did not answer, or did not come back after a restart |
|
|
334
|
+
| 75 | `print raw --verify`: the port stayed busy before the send, nothing was sent |
|
|
322
335
|
| 76 | the device answered something this firmware family does not send, or stored |
|
|
323
336
|
| | a value other than the one sent (rare: run the command again) |
|
|
324
337
|
| 77 | refused: confirmation missing, the device wants a login, or a wrong password |
|
|
325
338
|
| 78 | configuration error, such as no device address |
|
|
339
|
+
| 110 | `print raw --verify`: the data was sent, the port was not read as idle |
|
|
326
340
|
|
|
327
341
|
### Python
|
|
328
342
|
|
|
@@ -220,6 +220,18 @@ an LPD job. Data that no printer takes stays queued and keeps the port busy unti
|
|
|
220
220
|
there fails after `--timeout` with exit 76, because the device holds back its acknowledgement.
|
|
221
221
|
`print lpd` names the job `job` unless `--job-name` says otherwise.
|
|
222
222
|
|
|
223
|
+
`print raw` succeeds as soon as the device took the bytes, whatever the port is doing: a port held
|
|
224
|
+
by another job accepts a new one, and a job that blocks the port afterwards goes unnoticed. With
|
|
225
|
+
`--verify` it waits for the port the printer is routed to to read `Idle`, sends, and waits again,
|
|
226
|
+
each for up to `--verify-timeout` seconds (default 30; raise it for a long job). A port still busy
|
|
227
|
+
before the send exits 75 with nothing sent, so sending later is safe. After the send it exits 110:
|
|
228
|
+
the data was sent, so do not resend it blindly. `Idle` means the port is free again, not that a
|
|
229
|
+
page came out.
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
sercomm-printserver print raw 3 label.dpl --verify
|
|
233
|
+
```
|
|
234
|
+
|
|
223
235
|
### A device without a usable address
|
|
224
236
|
|
|
225
237
|
The device answers any address this host maps to its MAC, which is how the vendor manuals
|
|
@@ -259,10 +271,12 @@ any JSON is written: exit 2 and a usage message on stderr. Exit codes do not dep
|
|
|
259
271
|
| | `config-deploy`: a system dir) |
|
|
260
272
|
| 22 | invalid argument |
|
|
261
273
|
| 69 | the device did not answer, or did not come back after a restart |
|
|
274
|
+
| 75 | `print raw --verify`: the port stayed busy before the send, nothing was sent |
|
|
262
275
|
| 76 | the device answered something this firmware family does not send, or stored |
|
|
263
276
|
| | a value other than the one sent (rare: run the command again) |
|
|
264
277
|
| 77 | refused: confirmation missing, the device wants a login, or a wrong password |
|
|
265
278
|
| 78 | configuration error, such as no device address |
|
|
279
|
+
| 110 | `print raw --verify`: the data was sent, the port was not read as idle |
|
|
266
280
|
|
|
267
281
|
### Python
|
|
268
282
|
|
{sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/docs/systemdesign/module_reference.md
RENAMED
|
@@ -155,7 +155,7 @@ takes `--network`, the `arp` commands `--mac`, `--ip` and `--interface` (`assign
|
|
|
155
155
|
| `store-ip` | Store the current address as static IP (SETIP) |
|
|
156
156
|
| `factory-default` | Restore factory settings (stored IP 0.0.0.0 with DHCP on, name empty) |
|
|
157
157
|
| `print lpd QUEUE SOURCE` | Send a file or stdin to an LPD queue (`--job-name`) |
|
|
158
|
-
| `print raw PRINTER SOURCE` | Send
|
|
158
|
+
| `print raw PRINTER SOURCE` | Send to the RAW port of logical printer 1..3 (`--verify`) |
|
|
159
159
|
| `arp reach` | Read the identity of the device behind `--mac` at borrowed `--ip` |
|
|
160
160
|
| `arp assign-ip` | Store `--ip` as static address (DHCP off) and restart there |
|
|
161
161
|
| `arp factory-reset` | Restore factory settings of the device behind `--mac` |
|
|
@@ -173,10 +173,11 @@ in `adapters/cli/commands/_device.py` (first match wins, anything else exits 1).
|
|
|
173
173
|
| 13 | `PERMISSION_DENIED` | `HostPrivilegeError` (no right to change the ARP table), `UnverifiedAddressError` (no ARP request possible, cache knows nothing); config-deploy refusals |
|
|
174
174
|
| 22 | `INVALID_ARGUMENT` | `ValueError`, including `ConfigFormatError`; config section not found |
|
|
175
175
|
| 69 | `DEVICE_UNAVAILABLE` | `DeviceUnavailableError`: refused, timed out, no route |
|
|
176
|
+
| 75 | `PORT_BUSY` | `PortBusyError`: `print raw --verify` found the port busy until the deadline and sent nothing |
|
|
176
177
|
| 76 | `PROTOCOL_ERROR` | `DeviceResponseError`: the device answered in an unexpected form |
|
|
177
178
|
| 77 | `REFUSED` | `ConfirmationRequiredError`, `AuthenticationRequiredError` |
|
|
178
179
|
| 78 | `CONFIG_ERROR` | `ConfigurationError`: configuration missing, not loadable or invalid |
|
|
179
|
-
| 110 | `TIMEOUT` |
|
|
180
|
+
| 110 | `TIMEOUT` | `JobNotDrainedError`: `print raw --verify` sent the data and the port was not read as idle |
|
|
180
181
|
| 130 | `SIGNAL_INT` | SIGINT (translated by lib_cli_exit_tools) |
|
|
181
182
|
| 141 | `BROKEN_PIPE` | Output pipe closed |
|
|
182
183
|
| 143 | `SIGNAL_TERM` | SIGTERM |
|
|
@@ -195,6 +196,14 @@ reachable (`ConfigWriteResult`).
|
|
|
195
196
|
until an SNMP uptime read afterwards is no longer than the time since the trigger, then until FTP
|
|
196
197
|
answers again, for at most 120 s.
|
|
197
198
|
|
|
199
|
+
**Verified RAW print:** `PrintServer.print_raw_verified` reads the printer's routing from CONFIG,
|
|
200
|
+
then reads that port every second until it is idle, sends, and reads it the same way again, with
|
|
201
|
+
`timeout` for each wait. An unanswered read before a deadline is ignored, and a routing the status
|
|
202
|
+
does not list is refused with nothing sent. A port busy until the first deadline is
|
|
203
|
+
`PortBusyError`, since a busy port would accept the job behind the one holding it. Every failure
|
|
204
|
+
after the send is `JobNotDrainedError`, never `DeviceUnavailableError`, so exit 69 cannot lead a
|
|
205
|
+
caller to send a job the device already has.
|
|
206
|
+
|
|
198
207
|
**ARP trick:** the static neighbour entry lives only inside `borrowed_address`; the device is
|
|
199
208
|
then spoken to over FTP at the borrowed address, and the entry is removed in every case.
|
|
200
209
|
`factory_reset` refuses unless the PSINF default name matches both `--mac` and `--confirm-name`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sercomm-printserver"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.3.0"
|
|
4
4
|
description = "CLI and Python library for SerComm-based network print servers (PS301 and OEM variants)"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -12,7 +12,7 @@ dependencies = [
|
|
|
12
12
|
# 6.4.2: validate_config, the check config --profile runs, refuses exactly what init() refuses.
|
|
13
13
|
"lib_log_rich>=8.1.2",
|
|
14
14
|
"python-dotenv>=1.2.4",
|
|
15
|
-
"lib_layered_config>=7.
|
|
15
|
+
"lib_layered_config>=7.7.0",
|
|
16
16
|
"pydantic>=2.14.1",
|
|
17
17
|
"orjson>=3.13.0",
|
|
18
18
|
"ipscout>=2.5.4",
|
|
@@ -304,4 +304,4 @@ ignores = ["E003"]
|
|
|
304
304
|
|
|
305
305
|
[tool.uv]
|
|
306
306
|
exclude-newer = "7 days"
|
|
307
|
-
exclude-newer-package = {lib-cli-exit-tools = false, lib-layered-config = false, lib-log-rich = false, virtualenv = "2026-10-22T20:10:18Z", ipscout = false}
|
|
307
|
+
exclude-newer-package = {lib-cli-exit-tools = false, lib-layered-config = false, lib-log-rich = false, virtualenv = "2026-10-22T20:10:18Z", ipscout = false, grimp = "2026-09-11T10:36:50Z"}
|
|
@@ -29,6 +29,7 @@ from .application.print_server import ConfigWriteResult, PrintServer
|
|
|
29
29
|
from .composition import get_config, open_print_server
|
|
30
30
|
from .domain.config_codec import ConfigChange, parse_config, render_config, with_value
|
|
31
31
|
from .domain.config_model import DeviceConfig
|
|
32
|
+
from .domain.config_types import PortId
|
|
32
33
|
from .domain.device_info import DeviceInfo, MacAddress, normalise_mac
|
|
33
34
|
from .domain.endpoint import DeviceEndpoint, PrintJob
|
|
34
35
|
from .domain.errors import (
|
|
@@ -39,11 +40,13 @@ from .domain.errors import (
|
|
|
39
40
|
DeviceResponseError,
|
|
40
41
|
DeviceUnavailableError,
|
|
41
42
|
HostPrivilegeError,
|
|
43
|
+
JobNotDrainedError,
|
|
42
44
|
NeighborTableError,
|
|
45
|
+
PortBusyError,
|
|
43
46
|
UnverifiedAddressError,
|
|
44
47
|
)
|
|
45
48
|
from .domain.neighbor import AddressHolder, LookupMethod
|
|
46
|
-
from .domain.port_status import PortStatus
|
|
49
|
+
from .domain.port_status import PortState, PortStatus, PortType, PrinterStatus
|
|
47
50
|
|
|
48
51
|
|
|
49
52
|
def discover_print_servers(*, networks: list[str] | None = None, timeout: float = 3.0) -> DiscoveryReport:
|
|
@@ -87,12 +90,18 @@ __all__ = [
|
|
|
87
90
|
"DiscoveryReport",
|
|
88
91
|
"HostPrivilegeError",
|
|
89
92
|
"IpscoutNeighborTable",
|
|
93
|
+
"JobNotDrainedError",
|
|
90
94
|
"LookupMethod",
|
|
91
95
|
"MacAddress",
|
|
92
96
|
"NeighborTableError",
|
|
97
|
+
"PortBusyError",
|
|
98
|
+
"PortId",
|
|
99
|
+
"PortState",
|
|
93
100
|
"PortStatus",
|
|
101
|
+
"PortType",
|
|
94
102
|
"PrintJob",
|
|
95
103
|
"PrintServer",
|
|
104
|
+
"PrinterStatus",
|
|
96
105
|
"UnverifiedAddressError",
|
|
97
106
|
"arp_trick",
|
|
98
107
|
"discover_print_servers",
|
{sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/__init__conf__.py
RENAMED
|
@@ -40,7 +40,7 @@ name = "sercomm-printserver"
|
|
|
40
40
|
#: Human-readable summary shown in CLI help output.
|
|
41
41
|
title = "CLI and Python library for SerComm-based network print servers (PS301 and OEM variants)"
|
|
42
42
|
#: Current release version pulled from ``pyproject.toml`` by automation.
|
|
43
|
-
version = "0.
|
|
43
|
+
version = "0.3.0"
|
|
44
44
|
#: Repository homepage presented to users.
|
|
45
45
|
homepage = "https://github.com/bitranox/sercomm-printserver"
|
|
46
46
|
#: Author attribution surfaced in CLI output.
|
|
@@ -23,7 +23,9 @@ from sercomm_printserver.domain.errors import (
|
|
|
23
23
|
DeviceResponseError,
|
|
24
24
|
DeviceUnavailableError,
|
|
25
25
|
HostPrivilegeError,
|
|
26
|
+
JobNotDrainedError,
|
|
26
27
|
NeighborTableError,
|
|
28
|
+
PortBusyError,
|
|
27
29
|
UnverifiedAddressError,
|
|
28
30
|
)
|
|
29
31
|
|
|
@@ -56,6 +58,8 @@ _EXIT_CODES: tuple[tuple[type[Exception], ExitCode], ...] = (
|
|
|
56
58
|
(ConfigurationError, ExitCode.CONFIG_ERROR),
|
|
57
59
|
(DeviceUnavailableError, ExitCode.DEVICE_UNAVAILABLE),
|
|
58
60
|
(DeviceResponseError, ExitCode.PROTOCOL_ERROR),
|
|
61
|
+
(JobNotDrainedError, ExitCode.TIMEOUT),
|
|
62
|
+
(PortBusyError, ExitCode.PORT_BUSY),
|
|
59
63
|
(HostPrivilegeError, ExitCode.PERMISSION_DENIED),
|
|
60
64
|
(UnverifiedAddressError, ExitCode.PERMISSION_DENIED),
|
|
61
65
|
(NeighborTableError, ExitCode.GENERAL_ERROR),
|
|
@@ -13,6 +13,8 @@ from typing import TYPE_CHECKING, BinaryIO
|
|
|
13
13
|
import rich_click as click
|
|
14
14
|
from pydantic import BaseModel, model_validator
|
|
15
15
|
|
|
16
|
+
from sercomm_printserver.application.print_server import DEFAULT_VERIFY_TIMEOUT
|
|
17
|
+
from sercomm_printserver.domain.config_types import PortId
|
|
16
18
|
from sercomm_printserver.domain.endpoint import PrintJob
|
|
17
19
|
|
|
18
20
|
from ..constants import CLICK_CONTEXT_SETTINGS, CommandName
|
|
@@ -57,6 +59,20 @@ class PrintReport(BaseModel, frozen=True):
|
|
|
57
59
|
return self
|
|
58
60
|
|
|
59
61
|
|
|
62
|
+
class VerifiedPrintReport(PrintReport, frozen=True):
|
|
63
|
+
"""Answer of ``print raw --verify``: the port the job went to reads idle again.
|
|
64
|
+
|
|
65
|
+
Example:
|
|
66
|
+
>>> report = VerifiedPrintReport(
|
|
67
|
+
... host="192.0.2.52", transport=PrintTransport.RAW, queue=None, printer=3, size=2, idle_port=PortId.SP
|
|
68
|
+
... )
|
|
69
|
+
>>> report.model_dump_json()
|
|
70
|
+
'{"host":"192.0.2.52","transport":"raw","queue":null,"printer":3,"size":2,"idle_port":"SP"}'
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
idle_port: PortId
|
|
74
|
+
|
|
75
|
+
|
|
60
76
|
def _flags(host: str | None, timeout: float | None, as_json: bool, as_json_bare: bool) -> DeviceFlags:
|
|
61
77
|
return DeviceFlags(host=host, timeout=timeout, as_json=as_json, as_json_bare=as_json_bare)
|
|
62
78
|
|
|
@@ -66,7 +82,8 @@ def _render(report: PrintReport) -> str:
|
|
|
66
82
|
target = f"{report.transport.value.upper()} queue {report.queue}"
|
|
67
83
|
else:
|
|
68
84
|
target = f"{report.transport.value.upper()} port of L{report.printer}"
|
|
69
|
-
|
|
85
|
+
sent = f"{report.host}: sent {report.size} bytes to {target}"
|
|
86
|
+
return f"{sent}; {report.idle_port.value} is Idle again" if isinstance(report, VerifiedPrintReport) else sent
|
|
70
87
|
|
|
71
88
|
|
|
72
89
|
@click.group("print", context_settings=CLICK_CONTEXT_SETTINGS)
|
|
@@ -108,6 +125,19 @@ def cli_print_lpd(
|
|
|
108
125
|
@cli_print.command("raw", context_settings=CLICK_CONTEXT_SETTINGS)
|
|
109
126
|
@argument("printer", type=click.IntRange(min=1, max=3))
|
|
110
127
|
@argument("source", type=click.File("rb"))
|
|
128
|
+
@option(
|
|
129
|
+
"--verify",
|
|
130
|
+
is_flag=True,
|
|
131
|
+
default=False,
|
|
132
|
+
help="Wait for the routed port to read Idle before sending, and again after. Idle means the port is free, "
|
|
133
|
+
"not that a page came out. Busy before the send exits 75, nothing sent; busy after it exits 110, data sent.",
|
|
134
|
+
)
|
|
135
|
+
@option(
|
|
136
|
+
"--verify-timeout",
|
|
137
|
+
type=click.FloatRange(min=0.1, max=3600),
|
|
138
|
+
default=None,
|
|
139
|
+
help=f"Seconds each --verify wait may take, before and after the send (default {DEFAULT_VERIFY_TIMEOUT:g}).",
|
|
140
|
+
)
|
|
111
141
|
@device_options
|
|
112
142
|
@click.pass_context
|
|
113
143
|
def cli_print_raw(
|
|
@@ -115,23 +145,32 @@ def cli_print_raw(
|
|
|
115
145
|
printer: int,
|
|
116
146
|
source: BinaryIO,
|
|
117
147
|
*,
|
|
148
|
+
verify: bool,
|
|
149
|
+
verify_timeout: float | None,
|
|
118
150
|
host: str | None,
|
|
119
151
|
timeout: float | None,
|
|
120
152
|
as_json: bool,
|
|
121
153
|
as_json_bare: bool,
|
|
122
154
|
) -> None:
|
|
123
155
|
"""Send SOURCE (a file, or - for stdin) to the RAW port of logical printer PRINTER (1..3)."""
|
|
156
|
+
if verify_timeout is not None and not verify:
|
|
157
|
+
# Taking the value and not watching would read as a verified print that was never verified.
|
|
158
|
+
raise click.UsageError("--verify-timeout needs --verify")
|
|
124
159
|
|
|
125
160
|
def work(server: PrintServer) -> PrintReport:
|
|
126
161
|
data = source.read()
|
|
127
|
-
|
|
128
|
-
return PrintReport(
|
|
162
|
+
fields = PrintReport(
|
|
129
163
|
host=server.endpoint.host, transport=PrintTransport.RAW, queue=None, printer=printer, size=len(data)
|
|
130
164
|
)
|
|
165
|
+
if not verify:
|
|
166
|
+
server.print_raw(printer, data)
|
|
167
|
+
return fields
|
|
168
|
+
status = server.print_raw_verified(printer, data, timeout=verify_timeout or DEFAULT_VERIFY_TIMEOUT)
|
|
169
|
+
return VerifiedPrintReport(**fields.model_dump(), idle_port=status.port)
|
|
131
170
|
|
|
132
171
|
run_device_command(
|
|
133
172
|
ctx, command=CommandName.PRINT_RAW, flags=_flags(host, timeout, as_json, as_json_bare), work=work, human=_render
|
|
134
173
|
)
|
|
135
174
|
|
|
136
175
|
|
|
137
|
-
__all__ = ["PrintReport", "PrintTransport", "cli_print"]
|
|
176
|
+
__all__ = ["PrintReport", "PrintTransport", "VerifiedPrintReport", "cli_print"]
|
|
@@ -27,11 +27,12 @@ class ExitCode(IntEnum):
|
|
|
27
27
|
* 2-13: errno-derived codes (ENOENT, EACCES)
|
|
28
28
|
* 22: EINVAL
|
|
29
29
|
* 69: EX_UNAVAILABLE (sysexits.h): the print server did not answer
|
|
30
|
+
* 75: EX_TEMPFAIL (sysexits.h): ``print raw --verify`` found the port busy and sent nothing
|
|
30
31
|
* 76: EX_PROTOCOL (sysexits.h): the print server answered something unexpected
|
|
31
32
|
* 77: EX_NOPERM (sysexits.h): refused by policy, such as a destructive action
|
|
32
33
|
without its confirmation flags
|
|
33
34
|
* 78: EX_CONFIG (sysexits.h)
|
|
34
|
-
* 110: ETIMEDOUT
|
|
35
|
+
* 110: ETIMEDOUT: ``print raw --verify`` sent the data and the port was not read as idle
|
|
35
36
|
* 128+N: signal N (informational only)
|
|
36
37
|
|
|
37
38
|
Example:
|
|
@@ -47,6 +48,7 @@ class ExitCode(IntEnum):
|
|
|
47
48
|
PERMISSION_DENIED = 13
|
|
48
49
|
INVALID_ARGUMENT = 22
|
|
49
50
|
DEVICE_UNAVAILABLE = 69
|
|
51
|
+
PORT_BUSY = 75
|
|
50
52
|
PROTOCOL_ERROR = 76
|
|
51
53
|
REFUSED = 77
|
|
52
54
|
CONFIG_ERROR = 78
|
|
@@ -58,6 +58,9 @@ class FakeDevice:
|
|
|
58
58
|
self.config = config
|
|
59
59
|
self.psinf = psinf
|
|
60
60
|
self.monitor_text = monitor
|
|
61
|
+
#: Answers to the next ``monitor`` calls, oldest first, before ``monitor_text`` applies
|
|
62
|
+
#: again; an error in the list is raised, as a device that did not answer a read.
|
|
63
|
+
self.monitor_replies: list[str | DeviceUnavailableError] = []
|
|
61
64
|
self.firmware = firmware
|
|
62
65
|
self.login_for_writes = login_for_writes
|
|
63
66
|
self.credential = ""
|
|
@@ -151,9 +154,14 @@ class FakeDevice:
|
|
|
151
154
|
# TelnetPort -----------------------------------------------------------
|
|
152
155
|
|
|
153
156
|
def monitor(self, endpoint: DeviceEndpoint) -> str:
|
|
154
|
-
"""Return the monitor text."""
|
|
157
|
+
"""Return the next scripted answer, else the monitor text."""
|
|
155
158
|
self._check_reachable(endpoint)
|
|
156
|
-
|
|
159
|
+
if not self.monitor_replies:
|
|
160
|
+
return self.monitor_text
|
|
161
|
+
reply = self.monitor_replies.pop(0)
|
|
162
|
+
if isinstance(reply, DeviceUnavailableError):
|
|
163
|
+
raise reply
|
|
164
|
+
return reply
|
|
157
165
|
|
|
158
166
|
# LpdPort ---------------------------------------------------------------
|
|
159
167
|
|
|
@@ -27,8 +27,10 @@ from ..domain.errors import (
|
|
|
27
27
|
ConfirmationRequiredError,
|
|
28
28
|
DeviceResponseError,
|
|
29
29
|
DeviceUnavailableError,
|
|
30
|
+
JobNotDrainedError,
|
|
31
|
+
PortBusyError,
|
|
30
32
|
)
|
|
31
|
-
from ..domain.port_status import PortStatus, parse_monitor
|
|
33
|
+
from ..domain.port_status import PortState, PortStatus, parse_monitor
|
|
32
34
|
|
|
33
35
|
if TYPE_CHECKING:
|
|
34
36
|
from collections.abc import Callable
|
|
@@ -36,6 +38,7 @@ if TYPE_CHECKING:
|
|
|
36
38
|
from pydantic import SecretStr
|
|
37
39
|
|
|
38
40
|
from ..domain.config_model import DeviceConfig
|
|
41
|
+
from ..domain.config_types import PortId
|
|
39
42
|
from ..domain.endpoint import DeviceEndpoint, PrintJob
|
|
40
43
|
from .ports import FtpPort, LpdPort, RawPort, TelnetPort, TftpPort, UptimePort
|
|
41
44
|
|
|
@@ -53,6 +56,12 @@ _READ_BACK_MASKED: Final = frozenset({cat.mail_line(cat.MailField.PASSWORD)})
|
|
|
53
56
|
#: How long a restart may take before waiting for it is given up.
|
|
54
57
|
_RESTART_TIMEOUT: Final = 120.0
|
|
55
58
|
_POLL_INTERVAL: Final = 0.5
|
|
59
|
+
#: How long a port may stay busy before and after a verified RAW print: a short label drains in well
|
|
60
|
+
#: under a second, and the printer's own handling gets the rest. A long job needs its own value.
|
|
61
|
+
DEFAULT_VERIFY_TIMEOUT: Final = 30.0
|
|
62
|
+
#: Pause between status reads of a verified print. Each read is a Telnet session of about 1.1 s
|
|
63
|
+
#: (measured on a PS301, FW 6022), so a shorter pause would keep the device's Telnet side busy.
|
|
64
|
+
_VERIFY_POLL_INTERVAL: Final = 1.0
|
|
56
65
|
|
|
57
66
|
|
|
58
67
|
@dataclass(frozen=True, slots=True)
|
|
@@ -259,6 +268,65 @@ class PrintServer:
|
|
|
259
268
|
A job stays queued as "Printing / Direct Socket" while no printer takes it, so empty data
|
|
260
269
|
is refused before anything is sent.
|
|
261
270
|
"""
|
|
271
|
+
self._ports.raw.send(self._endpoint, self._raw_port(logical_printer, data), data)
|
|
272
|
+
|
|
273
|
+
def print_raw_verified(
|
|
274
|
+
self, logical_printer: int, data: bytes, *, timeout: float = DEFAULT_VERIFY_TIMEOUT
|
|
275
|
+
) -> PortStatus:
|
|
276
|
+
"""Wait until the routed port is idle, send ``data``, and wait until it is idle again.
|
|
277
|
+
|
|
278
|
+
A plain RAW send succeeds once the device took the bytes, whatever the port is doing.
|
|
279
|
+
Measured on a PS301 (FW 6022): a port held by another job accepts a new one without
|
|
280
|
+
complaint, the first status read after a job a printer took says ``Idle``, and after one no
|
|
281
|
+
printer takes it says ``Printing`` until a restart. Idle means the port is free, never that
|
|
282
|
+
a page came out.
|
|
283
|
+
|
|
284
|
+
Args:
|
|
285
|
+
logical_printer: The logical printer (1-3).
|
|
286
|
+
data: The print data.
|
|
287
|
+
timeout: Seconds each of the two waits may take, so the worst case is twice this.
|
|
288
|
+
|
|
289
|
+
Returns:
|
|
290
|
+
The status of the routed port once it is idle after the send.
|
|
291
|
+
|
|
292
|
+
Raises:
|
|
293
|
+
ValueError: The data is empty or the printer has no RAW port; nothing was sent.
|
|
294
|
+
DeviceResponseError: The printer is routed to a port the status does not list.
|
|
295
|
+
PortBusyError: The port stayed busy before the send; nothing was sent.
|
|
296
|
+
JobNotDrainedError: The data was sent and the port stayed busy or could not be read.
|
|
297
|
+
DeviceUnavailableError: The device failed before or during the send, never after it.
|
|
298
|
+
"""
|
|
299
|
+
port = self._raw_port(logical_printer, data)
|
|
300
|
+
routed = self.read_config().logical_printers[logical_printer - 1].port
|
|
301
|
+
host = self._endpoint.host
|
|
302
|
+
before = self._last_read_until_idle(logical_printer, routed, timeout=timeout)
|
|
303
|
+
if isinstance(before, DeviceUnavailableError):
|
|
304
|
+
raise DeviceUnavailableError(
|
|
305
|
+
f"{host}: nothing was sent, {routed.value} could not be read for {timeout:g} s: {before}"
|
|
306
|
+
) from before
|
|
307
|
+
if before.state is not PortState.IDLE:
|
|
308
|
+
raise PortBusyError(
|
|
309
|
+
f"{host}: nothing was sent, {routed.value} is still {before.state.value} after {timeout:g} s "
|
|
310
|
+
f"({_occupancy(before)}); a restart clears a stuck port"
|
|
311
|
+
)
|
|
312
|
+
self._ports.raw.send(self._endpoint, port, data)
|
|
313
|
+
# The data is sent from here on, so no failure may be a DeviceUnavailableError: a caller
|
|
314
|
+
# reads that as unsent, and a resend prints the job twice.
|
|
315
|
+
after = self._last_read_until_idle(logical_printer, routed, timeout=timeout)
|
|
316
|
+
if isinstance(after, DeviceUnavailableError):
|
|
317
|
+
raise JobNotDrainedError(
|
|
318
|
+
f"{host}: the data was sent, but {routed.value} could not be read {timeout:g} s later: {after}"
|
|
319
|
+
) from after
|
|
320
|
+
if after.state is not PortState.IDLE:
|
|
321
|
+
raise JobNotDrainedError(
|
|
322
|
+
f"{host}: the data was sent, but {routed.value} is still {after.state.value} {timeout:g} s later "
|
|
323
|
+
f"({_occupancy(after)}); a restart clears the port"
|
|
324
|
+
)
|
|
325
|
+
return after
|
|
326
|
+
|
|
327
|
+
# ------------------------------------------------------------------ helpers
|
|
328
|
+
|
|
329
|
+
def _raw_port(self, logical_printer: int, data: bytes) -> int:
|
|
262
330
|
if not data:
|
|
263
331
|
raise ValueError("refusing to open a RAW print port without data to send")
|
|
264
332
|
port = self._raw_port_base + logical_printer - 1
|
|
@@ -266,9 +334,35 @@ class PrintServer:
|
|
|
266
334
|
raise ValueError(f"logical printer {logical_printer} has no RAW port")
|
|
267
335
|
if logical_printer > _RAW_LAST_PRINTER:
|
|
268
336
|
raise ValueError(f"logical printer {logical_printer} has no RAW port: only L1..L3 have one")
|
|
269
|
-
|
|
337
|
+
return port
|
|
270
338
|
|
|
271
|
-
|
|
339
|
+
def _routed_status(self, logical_printer: int, routed: PortId) -> PortStatus:
|
|
340
|
+
for status in self.status():
|
|
341
|
+
if status.port is routed:
|
|
342
|
+
return status
|
|
343
|
+
raise DeviceResponseError(f"L{logical_printer} is routed to {routed.value}, which the status does not list")
|
|
344
|
+
|
|
345
|
+
def _last_read_until_idle(
|
|
346
|
+
self, logical_printer: int, routed: PortId, *, timeout: float
|
|
347
|
+
) -> PortStatus | DeviceUnavailableError:
|
|
348
|
+
"""Read the port until it is idle or the time is up; return the last read, or why it failed.
|
|
349
|
+
|
|
350
|
+
One unanswered read says nothing about the port, so only the last one decides. The caller
|
|
351
|
+
words the failure, since it alone knows whether the data has been sent.
|
|
352
|
+
"""
|
|
353
|
+
deadline = self._clock() + timeout
|
|
354
|
+
while True:
|
|
355
|
+
latest: PortStatus | DeviceUnavailableError
|
|
356
|
+
try:
|
|
357
|
+
latest = self._routed_status(logical_printer, routed)
|
|
358
|
+
except DeviceUnavailableError as error:
|
|
359
|
+
latest = error
|
|
360
|
+
if isinstance(latest, PortStatus) and latest.state is PortState.IDLE:
|
|
361
|
+
return latest
|
|
362
|
+
left = deadline - self._clock()
|
|
363
|
+
if left <= 0:
|
|
364
|
+
return latest
|
|
365
|
+
self._sleep(min(_VERIFY_POLL_INTERVAL, left))
|
|
272
366
|
|
|
273
367
|
def _read_text(self, name: ReadableFile) -> str:
|
|
274
368
|
data = self._with_login(lambda endpoint: self._ports.ftp.retrieve(endpoint, name))
|
|
@@ -362,4 +456,8 @@ def _describe_changes(changes: list[ConfigChange]) -> str:
|
|
|
362
456
|
return "; ".join(f"{change.token}: sent {change.old!r}, stored {change.new!r}" for change in changes)
|
|
363
457
|
|
|
364
458
|
|
|
365
|
-
|
|
459
|
+
def _occupancy(status: PortStatus) -> str:
|
|
460
|
+
return f"occupied by {status.occupied_by}, {status.bytes_serviced} bytes serviced"
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
__all__ = ["DEFAULT_VERIFY_TIMEOUT", "ConfigWriteResult", "DevicePorts", "PrintServer"]
|
{sercomm_printserver-0.2.2 → sercomm_printserver-0.3.0}/src/sercomm_printserver/domain/errors.py
RENAMED
|
@@ -51,6 +51,32 @@ class DeviceUnavailableError(ConnectionError):
|
|
|
51
51
|
"""
|
|
52
52
|
|
|
53
53
|
|
|
54
|
+
class JobNotDrainedError(TimeoutError):
|
|
55
|
+
"""A job was sent, but the port it went to was not read as idle in time.
|
|
56
|
+
|
|
57
|
+
Distinct from :class:`DeviceUnavailableError`, which a caller can read as "nothing was sent":
|
|
58
|
+
here the device took the data, so sending it again can print it twice. The port stayed busy or
|
|
59
|
+
could not be read any more; a restart clears a busy port.
|
|
60
|
+
|
|
61
|
+
Example:
|
|
62
|
+
>>> isinstance(JobNotDrainedError("SP still Printing 30 s after the job was sent"), TimeoutError)
|
|
63
|
+
True
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class PortBusyError(TimeoutError):
|
|
68
|
+
"""The port a verified print would use stayed busy, so nothing was sent.
|
|
69
|
+
|
|
70
|
+
Distinct from :class:`JobNotDrainedError`: here sending the job later is safe. A busy port
|
|
71
|
+
does not refuse a new job, it accepts it behind the one holding it (measured on a PS301,
|
|
72
|
+
FW 6022), so a verified print waits instead of adding to a port that may be stuck.
|
|
73
|
+
|
|
74
|
+
Example:
|
|
75
|
+
>>> isinstance(PortBusyError("nothing was sent: SP is still Printing after 30 s"), TimeoutError)
|
|
76
|
+
True
|
|
77
|
+
"""
|
|
78
|
+
|
|
79
|
+
|
|
54
80
|
class AuthenticationRequiredError(PermissionError):
|
|
55
81
|
"""The print server refused the operation until the right login and password are given.
|
|
56
82
|
|
|
@@ -111,6 +137,8 @@ __all__ = [
|
|
|
111
137
|
"DeviceResponseError",
|
|
112
138
|
"DeviceUnavailableError",
|
|
113
139
|
"HostPrivilegeError",
|
|
140
|
+
"JobNotDrainedError",
|
|
114
141
|
"NeighborTableError",
|
|
142
|
+
"PortBusyError",
|
|
115
143
|
"UnverifiedAddressError",
|
|
116
144
|
]
|
|
@@ -381,3 +381,79 @@ def test_print_raw_with_empty_input_sends_nothing_and_exits_22(
|
|
|
381
381
|
|
|
382
382
|
assert result.exit_code == 22
|
|
383
383
|
assert device.raw_sends == []
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
_IDLE_PORTS = (
|
|
387
|
+
"(P1)STATE: Idle\r\nTYPE: Parallel\r\nPRINTER STATUS: Offline\r\n\r\n"
|
|
388
|
+
"(P2)STATE: Idle\r\nTYPE: Parallel\r\nPRINTER STATUS: Offline\r\n\r\n"
|
|
389
|
+
"(SP)STATE: Idle\r\nTYPE: Serial\r\nPRINTER STATUS: On-Line\r\n"
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
def test_print_raw_verify_reports_the_port_that_went_idle(
|
|
394
|
+
cli_runner: CliRunner, services: Callable[[], AppServices], device: FakeDevice
|
|
395
|
+
) -> None:
|
|
396
|
+
device.monitor_text = _IDLE_PORTS
|
|
397
|
+
|
|
398
|
+
human = cli_runner.invoke(cli_root.cli, ["print", "raw", "3", "-", *_HOST, "--verify"], obj=services, input=b"x")
|
|
399
|
+
machine = cli_runner.invoke(
|
|
400
|
+
cli_root.cli, ["print", "raw", "3", "-", *_HOST, "--verify", "--json-bare"], obj=services, input=b"x"
|
|
401
|
+
)
|
|
402
|
+
|
|
403
|
+
assert human.exit_code == 0
|
|
404
|
+
assert human.stdout == "192.0.2.52: sent 1 bytes to RAW port of L3; SP is Idle again\n"
|
|
405
|
+
assert machine.stdout == (
|
|
406
|
+
'{"ok":true,"command":"print raw","data":{"host":"192.0.2.52","transport":"raw",'
|
|
407
|
+
'"queue":null,"printer":3,"size":1,"idle_port":"SP"},"skipped":[]}\n'
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
def test_print_raw_verify_exits_75_and_sends_nothing_when_the_port_stays_busy_before_the_send(
|
|
412
|
+
cli_runner: CliRunner, services: Callable[[], AppServices], device: FakeDevice
|
|
413
|
+
) -> None:
|
|
414
|
+
# The dumped monitor text has every port "Printing / Direct Socket".
|
|
415
|
+
result = cli_runner.invoke(
|
|
416
|
+
cli_root.cli,
|
|
417
|
+
["print", "raw", "3", "-", *_HOST, "--verify", "--verify-timeout", "0.1", "--json-bare"],
|
|
418
|
+
obj=services,
|
|
419
|
+
input=b"x",
|
|
420
|
+
)
|
|
421
|
+
|
|
422
|
+
assert result.exit_code == 75
|
|
423
|
+
envelope = _json(result.stdout)
|
|
424
|
+
assert (envelope["ok"], envelope["error"]) == (False, "PortBusyError")
|
|
425
|
+
assert "nothing was sent, SP is still Printing" in str(envelope["message"])
|
|
426
|
+
assert device.raw_sends == []
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
def test_print_raw_verify_exits_110_when_the_port_stays_busy_after_the_send(
|
|
430
|
+
cli_runner: CliRunner, services: Callable[[], AppServices], device: FakeDevice
|
|
431
|
+
) -> None:
|
|
432
|
+
# Free for the read before the send, then the dumped text: every port "Printing / Direct Socket".
|
|
433
|
+
device.monitor_replies = [_IDLE_PORTS]
|
|
434
|
+
|
|
435
|
+
result = cli_runner.invoke(
|
|
436
|
+
cli_root.cli,
|
|
437
|
+
["print", "raw", "3", "-", *_HOST, "--verify", "--verify-timeout", "0.1", "--json-bare"],
|
|
438
|
+
obj=services,
|
|
439
|
+
input=b"x",
|
|
440
|
+
)
|
|
441
|
+
|
|
442
|
+
assert result.exit_code == 110
|
|
443
|
+
envelope = _json(result.stdout)
|
|
444
|
+
assert (envelope["ok"], envelope["error"]) == (False, "JobNotDrainedError")
|
|
445
|
+
assert "the data was sent, but SP is still Printing" in str(envelope["message"])
|
|
446
|
+
assert device.raw_sends == [(9102, b"x")]
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
def test_print_raw_verify_timeout_without_verify_is_a_usage_error(
|
|
450
|
+
cli_runner: CliRunner, services: Callable[[], AppServices], device: FakeDevice
|
|
451
|
+
) -> None:
|
|
452
|
+
# Taking the value and not watching would read as a verified print that was never verified.
|
|
453
|
+
result = cli_runner.invoke(
|
|
454
|
+
cli_root.cli, ["print", "raw", "1", "-", *_HOST, "--verify-timeout", "5"], obj=services, input=b"x"
|
|
455
|
+
)
|
|
456
|
+
|
|
457
|
+
assert result.exit_code == 2
|
|
458
|
+
assert "--verify-timeout needs --verify" in result.stderr
|
|
459
|
+
assert device.raw_sends == []
|