Offline project checks / check (push) Canceled after 0s
- 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
118 lines
3.7 KiB
Python
118 lines
3.7 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Continue boot into OpenRC, wait for SSH, and test 4G cellular data over rmnet_ipa0.
|
|
"""
|
|
import os
|
|
import socket
|
|
import subprocess
|
|
import sys
|
|
import time
|
|
|
|
TARGET_IP = "172.16.42.1"
|
|
TARGET_TELNET_PORT = 23
|
|
SSH_KEY = "/Users/shenlei/Work/sshKey/oracle_tokyo_ARM.key"
|
|
|
|
def log(msg):
|
|
print(f"[{time.strftime('%H:%M:%S')}] {msg}", flush=True)
|
|
|
|
def telnet_send(cmd):
|
|
try:
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
s.settimeout(5.0)
|
|
s.connect((TARGET_IP, TARGET_TELNET_PORT))
|
|
time.sleep(0.5)
|
|
try:
|
|
s.recv(4096)
|
|
except socket.timeout:
|
|
pass
|
|
s.sendall((cmd + "\n").encode("utf-8"))
|
|
time.sleep(1.0)
|
|
s.close()
|
|
except Exception as e:
|
|
log(f"Telnet send error (expected if telnet killed): {e}")
|
|
|
|
def run_ssh(cmd, timeout=30):
|
|
ssh_cmd = [
|
|
"ssh",
|
|
"-o", "StrictHostKeyChecking=no",
|
|
"-o", "UserKnownHostsFile=/dev/null",
|
|
"-o", "ConnectTimeout=5",
|
|
"-i", SSH_KEY,
|
|
f"server@{TARGET_IP}",
|
|
cmd
|
|
]
|
|
res = subprocess.run(ssh_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, timeout=timeout)
|
|
return res.returncode, res.stdout, res.stderr
|
|
|
|
def main():
|
|
log("1. Unmounting /mnt and triggering /sbin/pmos_continue_boot...")
|
|
telnet_send("sync; umount /mnt 2>/dev/null; /sbin/pmos_continue_boot")
|
|
|
|
log("2. Waiting for device to switch root and launch OpenRC userspace...")
|
|
time.sleep(5)
|
|
start = time.time()
|
|
ssh_ready = False
|
|
while time.time() - start < 60:
|
|
s = socket.socket()
|
|
s.settimeout(1.0)
|
|
try:
|
|
s.connect((TARGET_IP, 22))
|
|
s.close()
|
|
log("SSH port 22 is OPEN!")
|
|
ssh_ready = True
|
|
break
|
|
except Exception:
|
|
pass
|
|
time.sleep(2)
|
|
|
|
if not ssh_ready:
|
|
log("ERROR: Timed out waiting for SSH port 22.")
|
|
return 1
|
|
|
|
time.sleep(3) # Wait for sshd to finish fork/handshake setup
|
|
|
|
# 3. Test SSH login
|
|
log("3. Testing SSH login to server@172.16.42.1...")
|
|
code, out, err = run_ssh("uname -a; uptime")
|
|
log(f"SSH output:\n{out.strip()}\n{err.strip()}")
|
|
|
|
# 4. Check modules and IPA interface
|
|
log("4. Checking loaded modules and rmnet_ipa0...")
|
|
code, out, err = run_ssh("sudo modprobe -v ipa 2>&1; lsmod | grep ipa; ip link show rmnet_ipa0")
|
|
log(f"IPA status:\n{out.strip()}")
|
|
|
|
# 5. Check ModemManager status
|
|
log("5. Checking ModemManager modem status...")
|
|
code, out, err = run_ssh("sudo mmcli -m any 2>&1 | head -n 30 || true")
|
|
log(f"ModemManager:\n{out.strip()}")
|
|
|
|
# 6. Check NetworkManager devices
|
|
log("6. Checking nmcli device...")
|
|
code, out, err = run_ssh("sudo nmcli device 2>&1")
|
|
log(f"NM devices:\n{out.strip()}")
|
|
|
|
# 7. Bring up cellular data
|
|
log("7. Activating cellular data connection...")
|
|
code, out, err = run_ssh("sudo platina-cellular --up 2>&1 || sudo nmcli connection up platina-cellular 2>&1 || true")
|
|
log(f"Cellular activate output:\n{out.strip()}")
|
|
|
|
# 8. Check IP and route
|
|
log("8. Checking IP address and routes...")
|
|
code, out, err = run_ssh("ip addr show rmnet_ipa0; ip route")
|
|
log(f"Routing table:\n{out.strip()}")
|
|
|
|
# 9. Test ping over cellular
|
|
log("9. Testing connectivity over cellular network...")
|
|
code, out, err = run_ssh("ping -I rmnet_ipa0 -c 4 1.1.1.1 2>&1 || ping -c 4 1.1.1.1 2>&1")
|
|
log(f"Ping result:\n{out.strip()}")
|
|
|
|
# 10. Check dmesg for IPA messages
|
|
log("10. Checking kernel log for IPA runtime messages...")
|
|
code, out, err = run_ssh("sudo dmesg | grep -iE 'ipa|rmnet' | tail -n 20")
|
|
log(f"Kernel log:\n{out.strip()}")
|
|
|
|
return 0
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|