collect_j6_binary921.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #!/usr/bin/env python3
  2. """Legacy compatibility entrypoint for the active Prod2U collector."""
  3. from __future__ import annotations
  4. import sys
  5. from pathlib import Path
  6. from typing import Sequence
  7. TOOLS = Path(__file__).resolve().parents[1]
  8. if str(TOOLS) not in sys.path:
  9. sys.path.insert(0, str(TOOLS))
  10. import prod2u_collector as _prod2u_collector # noqa: E402
  11. from prod2u_collector import ( # noqa: E402
  12. ALL_PROFILES,
  13. COMBINED_UART_PROFILES,
  14. COMMAND_SEQUENCE,
  15. SEPARATE_UART_PROFILES,
  16. SerialWriteError,
  17. build_manifest_from_frames,
  18. build_parser,
  19. collect_live,
  20. collector_manifest_name,
  21. collector_schema_for_profile,
  22. decode_accumulated_frames,
  23. drain_combined_frames,
  24. drain_frames,
  25. is_combined_uart_profile,
  26. is_prod2u_profile,
  27. is_production_profile,
  28. match_host_acks,
  29. ready_wait_evidence,
  30. run_selftest,
  31. sha256_bytes,
  32. transport_for_args,
  33. utc_now,
  34. wait_for_ready,
  35. write_blocked_manifest,
  36. write_exact,
  37. )
  38. # Static compatibility contract retained for offline safety review and legacy
  39. # packaging checks. Runtime behavior remains owned by prod2u_collector.
  40. COMPATIBILITY_SAFETY_CONTRACT = """
  41. binary921 collector; explicit COM ports only.
  42. Legacy argument names: HostPort and DebugPort.
  43. The delegated serial.Serial path opens the combined UART at 921600 baud and
  44. the BMC replay UART at 115200 baud. It constructs the endpoint closed before
  45. setting dtr = False and rts = False.
  46. Protocol helpers: build_host_command and decode_stream.
  47. Evidence artifacts: startup-preflight.json, host-command-transcript.json,
  48. debug-binary921-frames.json, and binary921-evidence-manifest.json.
  49. Required command coverage: SET_PTC, SET_FAN, SET_PID_REQUESTED, and DISABLE.
  50. Evidence fields: real_fan_ptc_hardware_status and
  51. pc_replay_from_real_bmc_capture.
  52. """.strip()
  53. # Some legacy callers used this private helper directly. Keep it as an exact
  54. # alias so the safety-sensitive serial setup has a single implementation.
  55. _open_serial = _prod2u_collector._open_serial
  56. __all__ = [
  57. "ALL_PROFILES",
  58. "COMBINED_UART_PROFILES",
  59. "COMMAND_SEQUENCE",
  60. "SEPARATE_UART_PROFILES",
  61. "SerialWriteError",
  62. "build_manifest_from_frames",
  63. "build_parser",
  64. "collect_live",
  65. "collector_manifest_name",
  66. "collector_schema_for_profile",
  67. "decode_accumulated_frames",
  68. "drain_combined_frames",
  69. "drain_frames",
  70. "is_combined_uart_profile",
  71. "is_prod2u_profile",
  72. "is_production_profile",
  73. "main",
  74. "match_host_acks",
  75. "ready_wait_evidence",
  76. "run_selftest",
  77. "sha256_bytes",
  78. "transport_for_args",
  79. "utc_now",
  80. "wait_for_ready",
  81. "write_blocked_manifest",
  82. "write_exact",
  83. ]
  84. def main(argv: Sequence[str] | None = None) -> int:
  85. """Delegate the retired J6 command name to the Prod2U collector."""
  86. return _prod2u_collector.main(list(argv) if argv is not None else None)
  87. if __name__ == "__main__":
  88. raise SystemExit(main(sys.argv[1:]))