Files
mi8-platina-linux/scripts/test_continue_and_ssh.py
shenlei 530a3690da
Offline project checks / check (push) Canceled after 0s
feat: add WCN3990 Wi-Fi bringup service, battery protection, and bringup automation
- Add phone-dsp.openrc to initialize Hexagon DSP, rmtfs, pd-mapper, and ath10k_snoc
- Update phone-battery-guard threshold to 80% with power supply node fallbacks
- Enhance phone-cellular-setup with battery gate checks, RF locks, and unit tests
- Include bringup, flashing, and inspection automation scripts for platina
- Update candidate IPA v2.6 patches and package locks
2026-11-12 14:54:23 +09:00

93 lines
2.8 KiB
Python
Executable File

#!/usr/bin/env python3
"""
Trigger continue_boot and wait for OpenRC sshd, then verify cellular.
"""
import time
import socket
import subprocess
TARGET_IP = "172.16.42.1"
SSH_KEY = "/Users/shenlei/Work/sshKey/oracle_tokyo_ARM.key"
USER = "server"
def log(msg):
print(f"[{time.strftime('%H:%M:%S')}] {msg}", flush=True)
def run_ssh(cmd, check=True):
ssh_cmd = f"ssh -o StrictHostKeyChecking=no -o ConnectTimeout=8 -i '{SSH_KEY}' {USER}@{TARGET_IP} '{cmd}'"
log(f"SSH CMD: {cmd}")
res = subprocess.run(ssh_cmd, shell=True, text=True, capture_output=True)
if check and res.returncode != 0:
log(f"SSH FAIL ({res.returncode}):\n{res.stderr}\n{res.stdout}")
return res
def main():
log("Sending continue boot command via telnet...")
s = socket.socket()
s.settimeout(5.0)
try:
s.connect((TARGET_IP, 23))
time.sleep(0.5)
s.sendall(b"/sbin/pmos_continue_boot\n")
time.sleep(1.0)
s.close()
log("pmos_continue_boot sent!")
except Exception as e:
log(f"Telnet note: {e}")
log("Waiting for OpenRC to switch root and start sshd on port 22...")
for i in range(1, 90):
time.sleep(2)
sock = socket.socket()
sock.settimeout(1.0)
try:
sock.connect((TARGET_IP, 22))
sock.close()
log(f"SSH port 22 is OPEN at attempt {i}!")
time.sleep(2)
break
except Exception:
if i % 5 == 0:
log(f"Still waiting for SSH (attempt {i}/90)...")
else:
raise TimeoutError("Timed out waiting for SSH port 22")
# Verify kernel and uptime
log("Checking kernel and uptime...")
res = run_ssh("uname -a; uptime")
log(f"Kernel info:\n{res.stdout.strip()}")
# Check dmesg for IPA
log("Checking dmesg for IPA...")
res = run_ssh("sudo dmesg | grep -iE 'ipa|rmnet' | tail -n 25")
log(f"IPA dmesg:\n{res.stdout.strip()}")
# Check network interfaces
log("Checking network interfaces...")
res = run_ssh("ip link; ip addr")
log(f"Interfaces:\n{res.stdout.strip()}")
# Check modemmanager
log("Checking ModemManager...")
res = run_ssh("mmcli -L; mmcli -m any 2>&1", check=False)
log(f"ModemManager:\n{res.stdout.strip()}")
# Check QRTR
log("Checking QRTR nodes...")
res = run_ssh("qrtr-lookup 2>/dev/null || true", check=False)
log(f"QRTR lookup:\n{res.stdout.strip()}")
# Bring up cellular network
log("Bringing up cellular network...")
run_ssh("sudo platina-cellular --up || nmcli connection up platina-cellular || true", check=False)
time.sleep(5)
# Check routing and ping
log("Testing connectivity...")
res = run_ssh("ip route; ping -I rmnet_ipa0 -c 4 1.1.1.1 || ping -c 4 1.1.1.1 || true", check=False)
log(f"Connectivity test:\n{res.stdout.strip()}")
if __name__ == "__main__":
main()