| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- #!/usr/bin/env python3
- """Legacy compatibility entrypoint for the active Prod2U collector."""
- from __future__ import annotations
- import sys
- from pathlib import Path
- from typing import Sequence
- TOOLS = Path(__file__).resolve().parents[1]
- if str(TOOLS) not in sys.path:
- sys.path.insert(0, str(TOOLS))
- import prod2u_collector as _prod2u_collector # noqa: E402
- from prod2u_collector import ( # noqa: E402
- ALL_PROFILES,
- COMBINED_UART_PROFILES,
- COMMAND_SEQUENCE,
- SEPARATE_UART_PROFILES,
- SerialWriteError,
- build_manifest_from_frames,
- build_parser,
- collect_live,
- collector_manifest_name,
- collector_schema_for_profile,
- decode_accumulated_frames,
- drain_combined_frames,
- drain_frames,
- is_combined_uart_profile,
- is_prod2u_profile,
- is_production_profile,
- match_host_acks,
- ready_wait_evidence,
- run_selftest,
- sha256_bytes,
- transport_for_args,
- utc_now,
- wait_for_ready,
- write_blocked_manifest,
- write_exact,
- )
- # Static compatibility contract retained for offline safety review and legacy
- # packaging checks. Runtime behavior remains owned by prod2u_collector.
- COMPATIBILITY_SAFETY_CONTRACT = """
- binary921 collector; explicit COM ports only.
- Legacy argument names: HostPort and DebugPort.
- The delegated serial.Serial path opens the combined UART at 921600 baud and
- the BMC replay UART at 115200 baud. It constructs the endpoint closed before
- setting dtr = False and rts = False.
- Protocol helpers: build_host_command and decode_stream.
- Evidence artifacts: startup-preflight.json, host-command-transcript.json,
- debug-binary921-frames.json, and binary921-evidence-manifest.json.
- Required command coverage: SET_PTC, SET_FAN, SET_PID_REQUESTED, and DISABLE.
- Evidence fields: real_fan_ptc_hardware_status and
- pc_replay_from_real_bmc_capture.
- """.strip()
- # Some legacy callers used this private helper directly. Keep it as an exact
- # alias so the safety-sensitive serial setup has a single implementation.
- _open_serial = _prod2u_collector._open_serial
- __all__ = [
- "ALL_PROFILES",
- "COMBINED_UART_PROFILES",
- "COMMAND_SEQUENCE",
- "SEPARATE_UART_PROFILES",
- "SerialWriteError",
- "build_manifest_from_frames",
- "build_parser",
- "collect_live",
- "collector_manifest_name",
- "collector_schema_for_profile",
- "decode_accumulated_frames",
- "drain_combined_frames",
- "drain_frames",
- "is_combined_uart_profile",
- "is_prod2u_profile",
- "is_production_profile",
- "main",
- "match_host_acks",
- "ready_wait_evidence",
- "run_selftest",
- "sha256_bytes",
- "transport_for_args",
- "utc_now",
- "wait_for_ready",
- "write_blocked_manifest",
- "write_exact",
- ]
- def main(argv: Sequence[str] | None = None) -> int:
- """Delegate the retired J6 command name to the Prod2U collector."""
- return _prod2u_collector.main(list(argv) if argv is not None else None)
- if __name__ == "__main__":
- raise SystemExit(main(sys.argv[1:]))
|