sercomm-printserver 0.2.2__tar.gz → 0.4.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.
Files changed (191) hide show
  1. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/CHANGELOG.md +87 -0
  2. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/PKG-INFO +111 -27
  3. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/README.md +104 -20
  4. sercomm_printserver-0.4.0/docs/plans/2026-11-11-ps301-wedge-design.md +66 -0
  5. sercomm_printserver-0.4.0/docs/python-api.md +682 -0
  6. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/docs/systemdesign/module_reference.md +124 -64
  7. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/pyproject.toml +10 -9
  8. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/__init__.py +18 -1
  9. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/__init__conf__.py +1 -1
  10. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/__init__.py +2 -0
  11. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/commands/__init__.py +2 -0
  12. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/commands/_device.py +23 -3
  13. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/commands/device.py +87 -3
  14. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/commands/device_config.py +25 -3
  15. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/commands/printing.py +56 -11
  16. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/constants.py +1 -0
  17. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/exit_codes.py +15 -3
  18. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/root.py +2 -0
  19. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/config/display.py +2 -1
  20. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/config/loader.py +0 -4
  21. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/lpd/client.py +168 -35
  22. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/memory/device.py +44 -8
  23. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/raw/__init__.py +2 -2
  24. sercomm_printserver-0.4.0/src/sercomm_printserver/adapters/raw/printer.py +349 -0
  25. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/application/arp_trick.py +9 -3
  26. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/application/ports.py +22 -4
  27. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/application/print_server.py +262 -10
  28. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/domain/device_info.py +3 -1
  29. sercomm_printserver-0.4.0/src/sercomm_printserver/domain/endpoint.py +98 -0
  30. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/domain/errors.py +74 -0
  31. sercomm_printserver-0.4.0/src/sercomm_printserver/domain/link.py +82 -0
  32. sercomm_printserver-0.4.0/src/sercomm_printserver/domain/port_health.py +85 -0
  33. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/domain/port_status.py +31 -2
  34. sercomm_printserver-0.4.0/src/sercomm_printserver/domain/print_data.py +302 -0
  35. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/fake_lpd_server.py +4 -0
  36. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/fake_raw_server.py +8 -3
  37. sercomm_printserver-0.4.0/tests/print_sources.py +35 -0
  38. sercomm_printserver-0.4.0/tests/streaming_memory_child.py +136 -0
  39. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_adapter_lpd.py +162 -6
  40. sercomm_printserver-0.4.0/tests/test_adapter_raw.py +421 -0
  41. sercomm_printserver-0.4.0/tests/test_cli_bounded_reads.py +118 -0
  42. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_cli_config_errors.py +1 -0
  43. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_cli_device.py +265 -2
  44. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_cli_exit_codes.py +36 -0
  45. sercomm_printserver-0.4.0/tests/test_cli_raw_delivery.py +110 -0
  46. sercomm_printserver-0.4.0/tests/test_display_plain_format.py +22 -0
  47. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_e2e_device.py +33 -4
  48. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_e2e_printer.py +9 -1
  49. sercomm_printserver-0.4.0/tests/test_link_drain.py +76 -0
  50. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_module_entry.py +1 -0
  51. sercomm_printserver-0.4.0/tests/test_port_health.py +56 -0
  52. sercomm_printserver-0.4.0/tests/test_print_data.py +209 -0
  53. sercomm_printserver-0.4.0/tests/test_print_server.py +885 -0
  54. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_public_api.py +24 -0
  55. sercomm_printserver-0.4.0/tests/test_streaming_memory.py +58 -0
  56. sercomm_printserver-0.4.0/tests/test_wedge_probe.py +308 -0
  57. sercomm_printserver-0.2.2/src/sercomm_printserver/adapters/raw/printer.py +0 -180
  58. sercomm_printserver-0.2.2/src/sercomm_printserver/domain/endpoint.py +0 -48
  59. sercomm_printserver-0.2.2/tests/test_adapter_raw.py +0 -166
  60. sercomm_printserver-0.2.2/tests/test_print_server.py +0 -432
  61. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/.gitignore +0 -0
  62. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/CONFIG.md +0 -0
  63. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/LICENSE +0 -0
  64. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/docs/Manual-PS301.md +0 -0
  65. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/docs/adr/0001-memory-adapters-in-src.md +0 -0
  66. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/docs/config-keys.md +0 -0
  67. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/docs/device-dump/CONFIG.txt +0 -0
  68. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/docs/device-dump/PSINF-factory.txt +0 -0
  69. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/docs/device-dump/PSINF.txt +0 -0
  70. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/docs/device-dump/fw6a10/CONFIG.txt +0 -0
  71. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/docs/device-dump/telnet-monitor.txt +0 -0
  72. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/docs/plans/2026-10-23-library-design.md +0 -0
  73. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/__main__.py +0 -0
  74. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/__init__.py +0 -0
  75. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/commands/arp.py +0 -0
  76. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/commands/config.py +0 -0
  77. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/commands/discover.py +0 -0
  78. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/commands/info.py +0 -0
  79. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/config_load.py +0 -0
  80. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/context.py +0 -0
  81. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/envelope.py +0 -0
  82. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/main.py +0 -0
  83. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/py.typed +0 -0
  84. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/safe_console.py +0 -0
  85. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/cli/typed_click.py +0 -0
  86. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/config/__init__.py +0 -0
  87. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/config/defaultconfig.d/40-layered-config.toml +0 -0
  88. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/config/defaultconfig.d/50-device.toml +0 -0
  89. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/config/defaultconfig.d/90-logging.toml +0 -0
  90. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/config/defaultconfig.toml +0 -0
  91. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/config/deploy.py +0 -0
  92. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/config/device_settings.py +0 -0
  93. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/config/overrides.py +0 -0
  94. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/config/py.typed +0 -0
  95. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/discovery/__init__.py +0 -0
  96. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/discovery/py.typed +0 -0
  97. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/discovery/scanner.py +0 -0
  98. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/ftp/__init__.py +0 -0
  99. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/ftp/client.py +0 -0
  100. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/ftp/py.typed +0 -0
  101. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/logging/__init__.py +0 -0
  102. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/logging/py.typed +0 -0
  103. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/logging/setup.py +0 -0
  104. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/lpd/__init__.py +0 -0
  105. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/lpd/py.typed +0 -0
  106. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/memory/__init__.py +0 -0
  107. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/memory/config.py +0 -0
  108. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/memory/discovery.py +0 -0
  109. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/memory/logging.py +0 -0
  110. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/memory/neighbors.py +0 -0
  111. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/neighbors/__init__.py +0 -0
  112. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/neighbors/py.typed +0 -0
  113. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/neighbors/table.py +0 -0
  114. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/py.typed +0 -0
  115. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/raw/py.typed +0 -0
  116. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/snmp/__init__.py +0 -0
  117. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/snmp/py.typed +0 -0
  118. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/snmp/uptime.py +0 -0
  119. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/telnet/__init__.py +0 -0
  120. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/telnet/client.py +0 -0
  121. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/telnet/iac.py +0 -0
  122. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/telnet/py.typed +0 -0
  123. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/tftp/__init__.py +0 -0
  124. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/tftp/client.py +0 -0
  125. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/adapters/tftp/py.typed +0 -0
  126. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/application/__init__.py +0 -0
  127. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/application/discovery.py +0 -0
  128. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/application/py.typed +0 -0
  129. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/composition/__init__.py +0 -0
  130. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/composition/py.typed +0 -0
  131. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/domain/__init__.py +0 -0
  132. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/domain/config_catalogue.py +0 -0
  133. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/domain/config_codec.py +0 -0
  134. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/domain/config_lines.py +0 -0
  135. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/domain/config_model.py +0 -0
  136. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/domain/config_reader.py +0 -0
  137. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/domain/config_types.py +0 -0
  138. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/domain/config_writer.py +0 -0
  139. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/domain/device_files.py +0 -0
  140. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/domain/enums.py +0 -0
  141. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/domain/neighbor.py +0 -0
  142. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/domain/py.typed +0 -0
  143. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/entry.py +0 -0
  144. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/src/sercomm_printserver/py.typed +0 -0
  145. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/conftest.py +0 -0
  146. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/fake_ftp_server.py +0 -0
  147. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/fake_telnet_server.py +0 -0
  148. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/fake_tftp_server.py +0 -0
  149. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/layer_roots.py +0 -0
  150. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_adapter_ftp.py +0 -0
  151. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_adapter_neighbors.py +0 -0
  152. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_adapter_snmp.py +0 -0
  153. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_adapter_telnet.py +0 -0
  154. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_adapter_tftp.py +0 -0
  155. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_arp_trick.py +0 -0
  156. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_cache_effectiveness.py +0 -0
  157. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_cli_arp.py +0 -0
  158. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_cli_config.py +0 -0
  159. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_cli_core.py +0 -0
  160. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_cli_env_file.py +0 -0
  161. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_cli_envelope.py +0 -0
  162. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_cli_main_exit.py +0 -0
  163. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_cli_overrides.py +0 -0
  164. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_cli_validation.py +0 -0
  165. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_config_catalogue.py +0 -0
  166. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_config_codec.py +0 -0
  167. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_config_layer_isolation.py +0 -0
  168. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_config_overrides.py +0 -0
  169. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_coverage_database.py +0 -0
  170. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_declared_dependencies.py +0 -0
  171. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_deploy_mode_safety.py +0 -0
  172. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_deploy_permissions.py +0 -0
  173. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_device_reports.py +0 -0
  174. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_discovery.py +0 -0
  175. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_display.py +0 -0
  176. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_enums.py +0 -0
  177. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_errors.py +0 -0
  178. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_logging.py +0 -0
  179. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_logging_dotenv_isolation.py +0 -0
  180. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_memory_logging.py +0 -0
  181. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_metadata.py +0 -0
  182. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_metadata_sync.py +0 -0
  183. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_packaging.py +0 -0
  184. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_permission_defaults.py +0 -0
  185. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_platform_markers.py +0 -0
  186. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_port_status.py +0 -0
  187. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_ports.py +0 -0
  188. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_property_overrides.py +0 -0
  189. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_safe_console.py +0 -0
  190. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_settings_dotenv_numbers.py +0 -0
  191. {sercomm_printserver-0.2.2 → sercomm_printserver-0.4.0}/tests/test_tcp_fixture_portability.py +0 -0
@@ -6,6 +6,93 @@ the [Keep a Changelog](https://keepachangelog.com/) format.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.4.0] - 2026-11-11
10
+
11
+ ### Added
12
+
13
+ - `PrintData` (exported from the package root): a print job's bytes, read from their source in
14
+ pieces of at most 64 KiB, built with `PrintData.of(bytes)`, `PrintData.from_path(path)` or
15
+ `PrintData.from_stream(stream)`. `print lpd` and `print raw` now stream the file or stdin
16
+ instead of reading it whole, so a job's size no longer adds to peak memory (measured: about
17
+ 1x the job before, under 1 MiB at 64 and 128 MiB after).
18
+ - `print lpd` from a pipe spools the data to a temporary file first, because LPD sends the size
19
+ ahead of the data. A spool that cannot be written raises `SpoolError` (exit 74) before the
20
+ device is contacted; a file that changes size while it is sent raises
21
+ `PrintSourceChangedError` (exit 65) and leaves the job without its end-of-file byte.
22
+ - `check` (library: `PrintServer.check`) tells a wedged port from a busy one. A port reading
23
+ `Printing`, occupied by `Direct Socket`, 0 bytes serviced, gets a bare connect with no data on
24
+ every RAW port routed to it: when all of them accept, the port is `wedged` (every later job to it
25
+ is lost until a restart); when one refuses, a client `held` it. Other ports read `idle` or
26
+ `printing`. It exits 3 when a port is wedged, 0 otherwise.
27
+ - `check --reset --yes` (library: `PrintServer.reset_if_wedged`) restarts the device only when a
28
+ port is wedged, waits for it, and checks again; it exits 3 when the port is still wedged.
29
+ `--reset` without `--yes` is refused.
30
+ - `scripts/ps301_wedge_probe.py` reproduces the wedge on a real device, with and without the
31
+ drain wait, in alternating trials, and logs each one as a JSON line. Every trial prints its job,
32
+ so it runs only with `--confirm-print`.
33
+ - `PortStatus.occupant` gives the protocol `OCCUPIED BY` names as an `Occupant` (`Direct Socket`,
34
+ `LPD`), and None for a free port or any other holder; `occupied_by` keeps the text.
35
+
36
+ ### Changed
37
+
38
+ - `PrintJob.data` is a `PrintData`; plain bytes are still accepted and wrapped, and in-memory data
39
+ compares equal to its bytes, so `PrintJob(data=b"...")` and `job.data == b"..."` keep working.
40
+ `len(job.data)` and the truth value of `job.data` no longer work: use `job.data.size`.
41
+ - `RawPort.send` takes `PrintData` or bytes and returns the number of bytes sent; `LpdPort.submit`
42
+ returns the size of the data file sent. `PrintServer.print_raw` and `print_lpd` return the same
43
+ counts, and `print_raw`/`print_raw_verified` take `PrintData` or bytes. A RAW connection that
44
+ breaks while a pipe is sent says the job's size is unknown instead of giving a total.
45
+ - `print raw` reads the device configuration first (one FTP session, about 1.2 s) and, for a
46
+ logical printer routed to the serial port `SP`, keeps the connection open until the job has
47
+ crossed the serial line at the port's baud rate (plus 0.25 s) before it closes. A RAW connection
48
+ opened while the device still passes the previous job on loses its data and wedges the port; a
49
+ printer on a parallel or USB port gets no wait.
50
+ - `print raw --verify` names the cause in its exit 75 and 110 messages: a wedged port
51
+ (`check --reset --yes` clears it) or another client holding the port. A port still printing
52
+ keeps the old wording.
53
+ - The empty-data refusal of `print raw` now reads "an empty job can leave the RAW port blocked
54
+ for minutes": a bare connect with no data was measured harmless.
55
+ - `sercomm_printserver.adapters.raw` exports `connect_retrying_refusals`.
56
+ - `device-config import` refuses a file larger than 64 KiB with exit 22 (`ConfigFormatError`)
57
+ without reading it whole; a CONFIG the device exports is about 2 KB.
58
+ - `password set --from-file` reads only the file's first line. A line still ends at `\n`, `\r\n`
59
+ or `\r`; the rarer separators `str.splitlines` also split on (vertical tab, form feed, U+2028
60
+ and similar) are now part of the password.
61
+
62
+ ### Fixed
63
+
64
+ - Exit 69 (`DeviceUnavailableError`) now strictly means nothing was sent, so a script can resend
65
+ on it without printing a job twice. `print raw` (library: `PrintServer.print_raw` and the send
66
+ step of `print_raw_verified`) used to exit 69 also when the connection broke after the device
67
+ had taken data, or after every byte was sent and before the device closed. Those cases now
68
+ raise the new `DeliveryUnconfirmedError` (exported from the package root; a `ConnectionError`,
69
+ not a `DeviceUnavailableError`) and exit 110, the code `print raw --verify` already uses for a
70
+ failure after the send; the message says how many bytes were sent and not to resend blindly.
71
+ - `display_config` takes its `output_format` as the plain value too (`"json"`), as an untyped caller passes it, instead of failing with `AttributeError: 'str' object has no attribute 'value'`.
72
+
73
+ ## [0.3.0] - 2026-11-02
74
+
75
+ ### Added
76
+
77
+ - `print raw --verify` (library: `PrintServer.print_raw_verified`) waits for the port the logical
78
+ printer is routed to to read `Idle`, sends, and waits again, each for up to `--verify-timeout`
79
+ seconds (default 30). A plain `print raw` succeeds once the device took the bytes: a port held by
80
+ another job accepts a new one, and a job that blocks the port afterwards goes unnoticed. A port
81
+ still busy before the send exits 75 with `PortBusyError`, nothing sent. After the send it exits
82
+ 110 with `JobNotDrainedError`, which always means the data was sent; exit 69 comes only from
83
+ before or during the send. `Idle` means the port is free, not that a page came out. Without
84
+ `--verify` the command and its JSON answer are unchanged; with it the answer adds `idle_port`.
85
+ - The package root exports `PortBusyError` and `JobNotDrainedError`, and the enums a `PortStatus`
86
+ holds: `PortId`, `PortState`, `PortType` and `PrinterStatus`. They were importable only from
87
+ internal modules.
88
+
89
+ ### Fixed
90
+
91
+ - `notebooks/Quickstart.ipynb` installs the checkout it runs in, so CI's "Execute notebooks" job
92
+ tests the commit under test. It used to install `git+https://github.com/...` every time, which is
93
+ the pushed default branch, so a pull request's notebook run tested the code already there.
94
+ Outside a checkout (a downloaded notebook) it still installs from GitHub.
95
+
9
96
  ## [0.2.2] - 2026-10-30
10
97
 
11
98
  ### Changed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sercomm-printserver
3
- Version: 0.2.2
3
+ Version: 0.4.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,10 +25,10 @@ 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.6.1
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
- Requires-Dist: pydantic>=2.14.1
31
+ Requires-Dist: pydantic>=2.14.2
32
32
  Requires-Dist: python-dotenv>=1.2.4
33
33
  Requires-Dist: rich-click>=1.9.9
34
34
  Provides-Extra: dev
@@ -36,8 +36,8 @@ Requires-Dist: bandit>=1.9.4; extra == 'dev'
36
36
  Requires-Dist: build>=1.6.1; extra == 'dev'
37
37
  Requires-Dist: certifi>=2026.10.23; extra == 'dev'
38
38
  Requires-Dist: click>=8.5.0; extra == 'dev'
39
- Requires-Dist: filelock>=4.2.4; (python_version >= '3.11') and extra == 'dev'
40
- Requires-Dist: hatchling>=1.32.4; extra == 'dev'
39
+ Requires-Dist: filelock>=4.2.7; (python_version >= '3.11') and extra == 'dev'
40
+ Requires-Dist: hatchling>=1.33.0; extra == 'dev'
41
41
  Requires-Dist: httpx2>=2.14.0; extra == 'dev'
42
42
  Requires-Dist: hypothesis>=6.168.5; extra == 'dev'
43
43
  Requires-Dist: import-linter>=2.15; extra == 'dev'
@@ -47,10 +47,10 @@ Requires-Dist: pynacl>=1.6.2; extra == 'dev'
47
47
  Requires-Dist: pyright[nodejs]>=1.1.414; extra == 'dev'
48
48
  Requires-Dist: pytest-cov>=7.1.0; extra == 'dev'
49
49
  Requires-Dist: pytest-xdist>=3.8.0; extra == 'dev'
50
- Requires-Dist: pytest>=9.1.1; extra == 'dev'
50
+ Requires-Dist: pytest>=9.2.0; extra == 'dev'
51
51
  Requires-Dist: python-multipart>=0.0.32; extra == 'dev'
52
52
  Requires-Dist: rtoml>=0.14.0; extra == 'dev'
53
- Requires-Dist: ruff>=0.17.2; extra == 'dev'
53
+ Requires-Dist: ruff>=0.17.3; extra == 'dev'
54
54
  Requires-Dist: textual>=8.2.8; extra == 'dev'
55
55
  Requires-Dist: twine>=7.0.0; extra == 'dev'
56
56
  Requires-Dist: urllib3>=2.8.0; extra == 'dev'
@@ -222,12 +222,14 @@ sercomm-printserver discover [--network 192.0.2.0/24] # reads the FTP greeting
222
222
  sercomm-printserver device-info # PSINF: names, MAC, firmware, addresses
223
223
  sercomm-printserver firmware # firmware version, no login needed
224
224
  sercomm-printserver status # port state and printer status
225
- sercomm-printserver queue L1 [--long] # LPD queue state; sends no print data
225
+ sercomm-printserver check # wedged ports (see "A wedged port"); exit 3 on one
226
+ sercomm-printserver queue L2 [--long] # LPD queue state (default L1); sends no print data
226
227
  ```
227
228
 
228
229
  Without `--network`, `discover` searches this host's networks up to 4096 addresses in all and
229
- lists the networks beyond that budget under `skipped`; a named `--network` larger than 4096
230
- addresses is refused (exit 22). `--timeout` is the wait for each host's greeting (default 3 s).
230
+ lists the networks beyond that budget under `skipped`. Named networks (`--network` can be given
231
+ more than once) that hold more than 4096 host addresses together are refused (exit 22) before
232
+ anything is probed. `--timeout` is the wait for each host's greeting (default 3 s).
231
233
 
232
234
  ### Configuration of the device
233
235
 
@@ -246,6 +248,9 @@ SNMP agent does not answer fails after 120 s with exit 69, even though the chang
246
248
  `--no-apply` stores the change without the restart; it takes effect at the next `reset --yes`.
247
249
  `reset --no-wait` returns without waiting.
248
250
 
251
+ `device-config import` takes a file as `device-config export` wrote it. A CONFIG is about 2 KB, so
252
+ a file larger than 64 KiB is refused (exit 22) without being read whole.
253
+
249
254
  ### Restart, password, factory settings
250
255
 
251
256
  ```bash
@@ -256,6 +261,11 @@ sercomm-printserver store-ip --yes --confirm-name PS_EXAMPLE
256
261
  sercomm-printserver factory-default --yes --confirm-name PS_EXAMPLE
257
262
  ```
258
263
 
264
+ `password set` never takes the password on the command line: it asks with a hidden prompt, or
265
+ reads the first line of `--from-file` (only that line is read; a line ends at `\n`, `\r\n` or
266
+ `\r`). The device stores at most 19 printable ASCII characters; anything else is refused
267
+ (exit 22).
268
+
259
269
  After `factory-default` the device restarts with its stored address set to 0.0.0.0, DHCP
260
270
  switched on and its name empty. It answers wherever a DHCP server puts it (measured: the old
261
271
  address again, so the address alone does not show the reset happened). Without a DHCP server it
@@ -278,7 +288,60 @@ Only L1..L3 have a RAW port, and RAW data goes wherever that logical printer is
278
288
  an LPD job. Data that no printer takes stays queued and keeps the port busy until a restart
279
289
  (`reset --yes`), so never send a test job, LPD or RAW, to a port without a printer. An LPD job
280
290
  there fails after `--timeout` with exit 76, because the device holds back its acknowledgement.
281
- `print lpd` names the job `job` unless `--job-name` says otherwise.
291
+ `print lpd` names the job `job` unless `--job-name` says otherwise. An empty job is refused
292
+ (exit 22) before the device is contacted.
293
+
294
+ Both commands stream the data: a job of any size is read and sent in pieces of at most 64 KiB, so
295
+ it never sits in memory whole. LPD puts the size in front of the data, so `print lpd` from a pipe first
296
+ copies the data to a temporary file (in `TMPDIR`); when that fails, for example on a full disk,
297
+ it exits 74 before the device is contacted. A file that grows or shrinks while `print lpd` sends
298
+ it stops the job without its end-of-file byte and exits 65: an LPD server discards such a job, but
299
+ this device prints data as it arrives, so part of it may be on paper. The reported size is the
300
+ number of bytes sent, also for a pipe.
301
+
302
+ `print raw` succeeds as soon as the device took the bytes, whatever the port is doing: a port held
303
+ by another job accepts a new one, and a job that blocks the port afterwards goes unnoticed. With
304
+ `--verify` it waits for the port the printer is routed to to read `Idle`, sends, and waits again,
305
+ each for up to `--verify-timeout` seconds (default 30; raise it for a long job;
306
+ `--verify-timeout` without `--verify` is a usage error). A port still busy
307
+ before the send exits 75 with nothing sent, so sending later is safe. After the send it exits 110:
308
+ the data was sent, so do not resend it blindly. `Idle` means the port is free again, not that a
309
+ page came out.
310
+
311
+ ```bash
312
+ sercomm-printserver print raw 3 label.dpl --verify
313
+ ```
314
+
315
+ `print raw` reads the device's configuration first (one FTP session). A printer on the serial
316
+ port gets its data at the port's baud rate, and a RAW connection opened before the device has
317
+ passed the previous job on loses its data and wedges the port. So for a printer routed to `SP` the
318
+ connection stays open until the job has crossed the serial line (bytes / (baud / bits per frame),
319
+ plus 0.25 s), about 2.4 s for 2 KB at 9600 8N1. A printer on a parallel or USB port gets no wait.
320
+
321
+ ### A wedged port
322
+
323
+ A port can be left reading `Printing`, occupied by `Direct Socket`, 0 bytes serviced, with no
324
+ client connected: a RAW connection that lost its data (another program opened one too early, or a
325
+ job was sent while the device still passed the previous one on). Every later job to it is
326
+ accepted and lost. `status` cannot tell this from a client that holds the port, since an open
327
+ connection reads the same. `check` can: it makes a bare connect, with no data, to each RAW port
328
+ routed there. A wedged port accepts it, a held one refuses it. A port counts as wedged only if
329
+ every such connect got in, so a live job is never reported as one. A port that reads like a wedge
330
+ but has no RAW port routed to it (only L1..L3 have one) cannot be probed and is reported
331
+ `unprobed`; it does not count as wedged.
332
+
333
+ ```bash
334
+ sercomm-printserver check # idle / printing / held / wedged / unprobed per port; exit 3 on a wedge
335
+ sercomm-printserver check --reset --yes # restart only if a port is wedged, then check again
336
+ ```
337
+
338
+ Only a restart clears a wedge, and it restarts every port, so `--reset` acts only when a port is
339
+ wedged and exits 0 only once the check after the restart finds none. `--reset` without `--yes` is
340
+ refused (exit 77). With `--json`, a found wedge gives an envelope with `"ok":false` and the full
341
+ answer under `data`. `print raw --verify` names a
342
+ wedge, or another client, in its exit 75 and 110 messages. Not found by `check`: a RAW port that
343
+ refuses every connect while `status` reads it idle (`print raw` reports that one when it cannot
344
+ connect), and an idle port whose printer does not answer.
282
345
 
283
346
  ### A device without a usable address
284
347
 
@@ -310,19 +373,22 @@ only the envelope; anything meant for a person goes to stderr. Success and failu
310
373
  A usage error (an unknown option, `print raw 4`) is reported by the command-line parser before
311
374
  any JSON is written: exit 2 and a usage message on stderr. Exit codes do not depend on the format.
312
375
 
313
- | Exit code | Meaning |
314
- |-----------|------------------------------------------------------------------------------|
315
- | 0 | done |
316
- | 1 | any other failure, such as an ARP table this host could not change |
317
- | 2 | usage error: a missing or invalid option or argument |
318
- | 13 | this host lacks a right (`arp`: the ARP table or sending an ARP request; |
319
- | | `config-deploy`: a system dir) |
320
- | 22 | invalid argument |
321
- | 69 | the device did not answer, or did not come back after a restart |
322
- | 76 | the device answered something this firmware family does not send, or stored |
323
- | | a value other than the one sent (rare: run the command again) |
324
- | 77 | refused: confirmation missing, the device wants a login, or a wrong password |
325
- | 78 | configuration error, such as no device address |
376
+ | Exit code | Meaning |
377
+ |-----------|-------------------------------------------------------------------------------------------------------------------------------------------|
378
+ | 0 | done |
379
+ | 1 | any other failure, such as an ARP table this host could not change |
380
+ | 2 | usage error: a missing or invalid option or argument |
381
+ | 3 | `check`: a port is wedged (with `--reset`: still wedged after the restart) |
382
+ | 13 | this host lacks a right (`arp`: the ARP table or sending an ARP request; `config-deploy`: a system dir) |
383
+ | 22 | invalid argument, such as an empty print job, a password the device cannot store or a CONFIG file over 64 KiB |
384
+ | 65 | `print lpd`: the file changed size while it was sent; do not resend blindly |
385
+ | 69 | the device did not answer, or did not come back after a restart; no print data reached it, so a resend is safe |
386
+ | 74 | `print lpd`: a pipe could not be spooled to `TMPDIR`, nothing was sent |
387
+ | 75 | `print raw --verify`: the port stayed busy before the send, nothing was sent |
388
+ | 76 | the device answered something this firmware family does not send, or stored a value other than the one sent (rare: run the command again) |
389
+ | 77 | refused: confirmation missing, the device wants a login, or a wrong password |
390
+ | 78 | configuration error, such as no device address |
391
+ | 110 | `print raw`: the data was sent and then the connection was lost, or (`--verify`) the port was not read as idle; do not resend blindly |
326
392
 
327
393
  ### Python
328
394
 
@@ -334,15 +400,30 @@ server.print_lpd("L1", PrintJob(data=b"hello\r\n\f", name="greeting"))
334
400
  print(server.info().firmware_version)
335
401
  ```
336
402
 
337
- `discover_print_servers()`, `PrintServer.read_config()`, `write_config()` and `reset()`, and
338
- `arp_trick` with `IpscoutNeighborTable` cover the rest.
403
+ A big job is streamed from where it lies instead of being read into memory: `PrintData.from_path`
404
+ reads a file (re-opened on every send), `PrintData.from_stream` an open binary stream such as
405
+ `sys.stdin.buffer` (readable once). `PrintJob`, `print_raw` and `print_raw_verified` take a
406
+ `PrintData` or plain bytes, and `print_raw` and `print_lpd` return the number of bytes sent.
407
+
408
+ ```python
409
+ from sercomm_printserver import PrintData
410
+
411
+ sent = server.print_raw(1, PrintData.from_path("manual.pcl"))
412
+ server.print_lpd("L2", PrintJob(data=PrintData.from_path("report.ps"), name="report"))
413
+ ```
414
+
415
+ `PrintServer.check()` and `reset_if_wedged()` are the library side of `check` and
416
+ `check --reset --yes`. `discover_print_servers()`, `PrintServer.read_config()`, `write_config()`
417
+ and `reset()`, and `arp_trick` with `IpscoutNeighborTable` cover the rest. The
418
+ [Python API reference](docs/python-api.md) describes every public name, its arguments and the
419
+ exceptions it raises.
339
420
 
340
421
  ### Application configuration
341
422
 
342
423
  ```bash
343
424
  sercomm-printserver config # the merged configuration
344
425
  sercomm-printserver config --section device
345
- sercomm-printserver config-deploy --target user # -> ~/.config/sercomm-printserver/config.toml
426
+ sercomm-printserver config-deploy --target user # Linux: ~/.config/sercomm-printserver/config.toml
346
427
  sercomm-printserver --set device.host=192.0.2.52 status
347
428
  sercomm-printserver config-generate-examples --destination ./examples # one placeholder file per layer
348
429
  sercomm-printserver info # package metadata (name, version, ...)
@@ -387,6 +468,9 @@ See [CONFIG.md](CONFIG.md) for every key and its environment variable.
387
468
  - [Install Guide](INSTALL.md)
388
469
  - [Development Handbook](DEVELOPMENT.md)
389
470
  - [Contributor Guide](CONTRIBUTING.md)
471
+ - [Configuration](CONFIG.md)
472
+ - [Python API](docs/python-api.md) - the library reference
390
473
  - [Changelog](CHANGELOG.md)
391
474
  - [Module Reference](docs/systemdesign/module_reference.md)
475
+ - [Device notes](docs/Manual-PS301.md) (German) and [CONFIG keys](docs/config-keys.md)
392
476
  - [License](LICENSE)
@@ -162,12 +162,14 @@ sercomm-printserver discover [--network 192.0.2.0/24] # reads the FTP greeting
162
162
  sercomm-printserver device-info # PSINF: names, MAC, firmware, addresses
163
163
  sercomm-printserver firmware # firmware version, no login needed
164
164
  sercomm-printserver status # port state and printer status
165
- sercomm-printserver queue L1 [--long] # LPD queue state; sends no print data
165
+ sercomm-printserver check # wedged ports (see "A wedged port"); exit 3 on one
166
+ sercomm-printserver queue L2 [--long] # LPD queue state (default L1); sends no print data
166
167
  ```
167
168
 
168
169
  Without `--network`, `discover` searches this host's networks up to 4096 addresses in all and
169
- lists the networks beyond that budget under `skipped`; a named `--network` larger than 4096
170
- addresses is refused (exit 22). `--timeout` is the wait for each host's greeting (default 3 s).
170
+ lists the networks beyond that budget under `skipped`. Named networks (`--network` can be given
171
+ more than once) that hold more than 4096 host addresses together are refused (exit 22) before
172
+ anything is probed. `--timeout` is the wait for each host's greeting (default 3 s).
171
173
 
172
174
  ### Configuration of the device
173
175
 
@@ -186,6 +188,9 @@ SNMP agent does not answer fails after 120 s with exit 69, even though the chang
186
188
  `--no-apply` stores the change without the restart; it takes effect at the next `reset --yes`.
187
189
  `reset --no-wait` returns without waiting.
188
190
 
191
+ `device-config import` takes a file as `device-config export` wrote it. A CONFIG is about 2 KB, so
192
+ a file larger than 64 KiB is refused (exit 22) without being read whole.
193
+
189
194
  ### Restart, password, factory settings
190
195
 
191
196
  ```bash
@@ -196,6 +201,11 @@ sercomm-printserver store-ip --yes --confirm-name PS_EXAMPLE
196
201
  sercomm-printserver factory-default --yes --confirm-name PS_EXAMPLE
197
202
  ```
198
203
 
204
+ `password set` never takes the password on the command line: it asks with a hidden prompt, or
205
+ reads the first line of `--from-file` (only that line is read; a line ends at `\n`, `\r\n` or
206
+ `\r`). The device stores at most 19 printable ASCII characters; anything else is refused
207
+ (exit 22).
208
+
199
209
  After `factory-default` the device restarts with its stored address set to 0.0.0.0, DHCP
200
210
  switched on and its name empty. It answers wherever a DHCP server puts it (measured: the old
201
211
  address again, so the address alone does not show the reset happened). Without a DHCP server it
@@ -218,7 +228,60 @@ Only L1..L3 have a RAW port, and RAW data goes wherever that logical printer is
218
228
  an LPD job. Data that no printer takes stays queued and keeps the port busy until a restart
219
229
  (`reset --yes`), so never send a test job, LPD or RAW, to a port without a printer. An LPD job
220
230
  there fails after `--timeout` with exit 76, because the device holds back its acknowledgement.
221
- `print lpd` names the job `job` unless `--job-name` says otherwise.
231
+ `print lpd` names the job `job` unless `--job-name` says otherwise. An empty job is refused
232
+ (exit 22) before the device is contacted.
233
+
234
+ Both commands stream the data: a job of any size is read and sent in pieces of at most 64 KiB, so
235
+ it never sits in memory whole. LPD puts the size in front of the data, so `print lpd` from a pipe first
236
+ copies the data to a temporary file (in `TMPDIR`); when that fails, for example on a full disk,
237
+ it exits 74 before the device is contacted. A file that grows or shrinks while `print lpd` sends
238
+ it stops the job without its end-of-file byte and exits 65: an LPD server discards such a job, but
239
+ this device prints data as it arrives, so part of it may be on paper. The reported size is the
240
+ number of bytes sent, also for a pipe.
241
+
242
+ `print raw` succeeds as soon as the device took the bytes, whatever the port is doing: a port held
243
+ by another job accepts a new one, and a job that blocks the port afterwards goes unnoticed. With
244
+ `--verify` it waits for the port the printer is routed to to read `Idle`, sends, and waits again,
245
+ each for up to `--verify-timeout` seconds (default 30; raise it for a long job;
246
+ `--verify-timeout` without `--verify` is a usage error). A port still busy
247
+ before the send exits 75 with nothing sent, so sending later is safe. After the send it exits 110:
248
+ the data was sent, so do not resend it blindly. `Idle` means the port is free again, not that a
249
+ page came out.
250
+
251
+ ```bash
252
+ sercomm-printserver print raw 3 label.dpl --verify
253
+ ```
254
+
255
+ `print raw` reads the device's configuration first (one FTP session). A printer on the serial
256
+ port gets its data at the port's baud rate, and a RAW connection opened before the device has
257
+ passed the previous job on loses its data and wedges the port. So for a printer routed to `SP` the
258
+ connection stays open until the job has crossed the serial line (bytes / (baud / bits per frame),
259
+ plus 0.25 s), about 2.4 s for 2 KB at 9600 8N1. A printer on a parallel or USB port gets no wait.
260
+
261
+ ### A wedged port
262
+
263
+ A port can be left reading `Printing`, occupied by `Direct Socket`, 0 bytes serviced, with no
264
+ client connected: a RAW connection that lost its data (another program opened one too early, or a
265
+ job was sent while the device still passed the previous one on). Every later job to it is
266
+ accepted and lost. `status` cannot tell this from a client that holds the port, since an open
267
+ connection reads the same. `check` can: it makes a bare connect, with no data, to each RAW port
268
+ routed there. A wedged port accepts it, a held one refuses it. A port counts as wedged only if
269
+ every such connect got in, so a live job is never reported as one. A port that reads like a wedge
270
+ but has no RAW port routed to it (only L1..L3 have one) cannot be probed and is reported
271
+ `unprobed`; it does not count as wedged.
272
+
273
+ ```bash
274
+ sercomm-printserver check # idle / printing / held / wedged / unprobed per port; exit 3 on a wedge
275
+ sercomm-printserver check --reset --yes # restart only if a port is wedged, then check again
276
+ ```
277
+
278
+ Only a restart clears a wedge, and it restarts every port, so `--reset` acts only when a port is
279
+ wedged and exits 0 only once the check after the restart finds none. `--reset` without `--yes` is
280
+ refused (exit 77). With `--json`, a found wedge gives an envelope with `"ok":false` and the full
281
+ answer under `data`. `print raw --verify` names a
282
+ wedge, or another client, in its exit 75 and 110 messages. Not found by `check`: a RAW port that
283
+ refuses every connect while `status` reads it idle (`print raw` reports that one when it cannot
284
+ connect), and an idle port whose printer does not answer.
222
285
 
223
286
  ### A device without a usable address
224
287
 
@@ -250,19 +313,22 @@ only the envelope; anything meant for a person goes to stderr. Success and failu
250
313
  A usage error (an unknown option, `print raw 4`) is reported by the command-line parser before
251
314
  any JSON is written: exit 2 and a usage message on stderr. Exit codes do not depend on the format.
252
315
 
253
- | Exit code | Meaning |
254
- |-----------|------------------------------------------------------------------------------|
255
- | 0 | done |
256
- | 1 | any other failure, such as an ARP table this host could not change |
257
- | 2 | usage error: a missing or invalid option or argument |
258
- | 13 | this host lacks a right (`arp`: the ARP table or sending an ARP request; |
259
- | | `config-deploy`: a system dir) |
260
- | 22 | invalid argument |
261
- | 69 | the device did not answer, or did not come back after a restart |
262
- | 76 | the device answered something this firmware family does not send, or stored |
263
- | | a value other than the one sent (rare: run the command again) |
264
- | 77 | refused: confirmation missing, the device wants a login, or a wrong password |
265
- | 78 | configuration error, such as no device address |
316
+ | Exit code | Meaning |
317
+ |-----------|-------------------------------------------------------------------------------------------------------------------------------------------|
318
+ | 0 | done |
319
+ | 1 | any other failure, such as an ARP table this host could not change |
320
+ | 2 | usage error: a missing or invalid option or argument |
321
+ | 3 | `check`: a port is wedged (with `--reset`: still wedged after the restart) |
322
+ | 13 | this host lacks a right (`arp`: the ARP table or sending an ARP request; `config-deploy`: a system dir) |
323
+ | 22 | invalid argument, such as an empty print job, a password the device cannot store or a CONFIG file over 64 KiB |
324
+ | 65 | `print lpd`: the file changed size while it was sent; do not resend blindly |
325
+ | 69 | the device did not answer, or did not come back after a restart; no print data reached it, so a resend is safe |
326
+ | 74 | `print lpd`: a pipe could not be spooled to `TMPDIR`, nothing was sent |
327
+ | 75 | `print raw --verify`: the port stayed busy before the send, nothing was sent |
328
+ | 76 | the device answered something this firmware family does not send, or stored a value other than the one sent (rare: run the command again) |
329
+ | 77 | refused: confirmation missing, the device wants a login, or a wrong password |
330
+ | 78 | configuration error, such as no device address |
331
+ | 110 | `print raw`: the data was sent and then the connection was lost, or (`--verify`) the port was not read as idle; do not resend blindly |
266
332
 
267
333
  ### Python
268
334
 
@@ -274,15 +340,30 @@ server.print_lpd("L1", PrintJob(data=b"hello\r\n\f", name="greeting"))
274
340
  print(server.info().firmware_version)
275
341
  ```
276
342
 
277
- `discover_print_servers()`, `PrintServer.read_config()`, `write_config()` and `reset()`, and
278
- `arp_trick` with `IpscoutNeighborTable` cover the rest.
343
+ A big job is streamed from where it lies instead of being read into memory: `PrintData.from_path`
344
+ reads a file (re-opened on every send), `PrintData.from_stream` an open binary stream such as
345
+ `sys.stdin.buffer` (readable once). `PrintJob`, `print_raw` and `print_raw_verified` take a
346
+ `PrintData` or plain bytes, and `print_raw` and `print_lpd` return the number of bytes sent.
347
+
348
+ ```python
349
+ from sercomm_printserver import PrintData
350
+
351
+ sent = server.print_raw(1, PrintData.from_path("manual.pcl"))
352
+ server.print_lpd("L2", PrintJob(data=PrintData.from_path("report.ps"), name="report"))
353
+ ```
354
+
355
+ `PrintServer.check()` and `reset_if_wedged()` are the library side of `check` and
356
+ `check --reset --yes`. `discover_print_servers()`, `PrintServer.read_config()`, `write_config()`
357
+ and `reset()`, and `arp_trick` with `IpscoutNeighborTable` cover the rest. The
358
+ [Python API reference](docs/python-api.md) describes every public name, its arguments and the
359
+ exceptions it raises.
279
360
 
280
361
  ### Application configuration
281
362
 
282
363
  ```bash
283
364
  sercomm-printserver config # the merged configuration
284
365
  sercomm-printserver config --section device
285
- sercomm-printserver config-deploy --target user # -> ~/.config/sercomm-printserver/config.toml
366
+ sercomm-printserver config-deploy --target user # Linux: ~/.config/sercomm-printserver/config.toml
286
367
  sercomm-printserver --set device.host=192.0.2.52 status
287
368
  sercomm-printserver config-generate-examples --destination ./examples # one placeholder file per layer
288
369
  sercomm-printserver info # package metadata (name, version, ...)
@@ -327,6 +408,9 @@ See [CONFIG.md](CONFIG.md) for every key and its environment variable.
327
408
  - [Install Guide](INSTALL.md)
328
409
  - [Development Handbook](DEVELOPMENT.md)
329
410
  - [Contributor Guide](CONTRIBUTING.md)
411
+ - [Configuration](CONFIG.md)
412
+ - [Python API](docs/python-api.md) - the library reference
330
413
  - [Changelog](CHANGELOG.md)
331
414
  - [Module Reference](docs/systemdesign/module_reference.md)
415
+ - [Device notes](docs/Manual-PS301.md) (German) and [CONFIG keys](docs/config-keys.md)
332
416
  - [License](LICENSE)
@@ -0,0 +1,66 @@
1
+ # PS301 RAW port wedge: drain wait, `check`, probe
2
+
3
+ Design agreed with the user on 2026-11-11 (backlog item [55]). The measurements it rests on are
4
+ in `docs/Manual-PS301.md` and in the module docstrings that cite them.
5
+
6
+ ## The defect
7
+
8
+ A PS301 takes a whole RAW job at once and passes it on to a serial printer at line speed (about
9
+ 960 B/s at 9600 8N1). A NEW RAW connection opened before that is finished loses its data, and
10
+ the port is left reading `Printing`, occupied by `Direct Socket`, 0 bytes serviced, with no
11
+ client. Only a restart clears it. Keeping the job's connection open until the drain is over
12
+ prevents it.
13
+
14
+ ## 1. Drain wait in `print raw`
15
+
16
+ - `PrintServer.print_raw` reads the configuration (one FTP session) and finds the physical port
17
+ the logical printer is routed to (`Ln_PROUT`). `--verify` already read it.
18
+ - Routed to `SP`: the link rate is `baud / (1 start + data bits + parity bit + stop bits)`
19
+ bytes per second. Routed to a parallel port or USB: no wait. That a parallel port needs none is
20
+ unmeasured.
21
+ - `RawPrinter.send` takes the rate as a `LinkDrain` (rate plus a 0.25 s margin). After the last
22
+ byte it keeps the connection fully open until every byte the socket took has had the rate to
23
+ reach the printer, plus the margin, and only then half-closes and waits for the device's close.
24
+ A half-close does not protect anything: the PS301 closes 0.07 s after EOF, long before the
25
+ printer has the data. A failed write raises at once without waiting.
26
+
27
+ ## 2. `check`
28
+
29
+ - Reads the monitor. A port reading `Printing` / `Direct Socket` / 0 bytes serviced is a
30
+ candidate; only then the configuration is read and each RAW port (L1..L3) routed there gets a
31
+ bare connect with no data, with the usual 3 s retry of a refused connect.
32
+ - Verdicts: `idle`, `printing`, `held` (a probe was refused: another client holds the port; a
33
+ second connect while one is open is refused outright), `wedged` (every probe was accepted),
34
+ `unprobed` (a candidate no RAW port is routed to). Requiring every probe to be accepted errs
35
+ towards `held`, so a live job is never reported as a wedge.
36
+ - Exit 0 when nothing is wedged, 3 when something is. `print raw --verify` uses the same
37
+ classifier, so its busy and not-drained errors say `wedged` or `held` when they are.
38
+ - Not detected: a RAW port that refuses every connect while the monitor reads Idle, and a port
39
+ that reads Idle while the printer does not answer. The first is reported by `print raw`'s
40
+ refusal message already; the second needs the printer's own protocol.
41
+
42
+ ## 3. `check --reset --yes`
43
+
44
+ Restarts the device only when something is wedged, waits for the restart as `reset` does, runs
45
+ the check again and exits 0 only when the wedge is gone. `--reset` without `--yes` is refused
46
+ (exit 77), like every other command that changes the device.
47
+
48
+ ## 4. `scripts/ps301_wedge_probe.py`
49
+
50
+ A maintainer tool that reproduces the measurement. Arguments: host, logical printer, a job file,
51
+ a query file (bytes the printer answers), rounds. Two arms run interleaved, `wait` (the drain
52
+ wait) and `close` (no wait, the liveness control). A trial: check the port is idle, send the job,
53
+ send the query at once on a new connection and read the answer, run `check` at +1, +5 and +15 s,
54
+ restart on a wedge, append one JSON line. No address and no printer language are built in.
55
+
56
+ ## Memory
57
+
58
+ Nothing grows with input: the job is the bytes the caller already holds, the check holds one
59
+ monitor read and one configuration, the probe writes each trial to its log and keeps only the
60
+ current one.
61
+
62
+ ## Testing
63
+
64
+ Unit tests drive `PrintServer` through the in-memory fake device and `RawPrinter` against a local
65
+ TCP server, with an injected clock and sleep for the wait. The real-device run of the probe
66
+ prints labels on the test printer, so it runs only with the user's go.