feat(cellular, power): enable SDM660 IPA v2.6L 4G LTE, power-key status screen, and DVFS standby
Offline project checks / check (push) Canceled after 0s
Offline project checks / check (push) Canceled after 0s
This commit is contained in:
@@ -102,11 +102,10 @@ def parse_mmcli_modem_info(raw_text):
|
||||
|
||||
|
||||
def cellular_datapath_status(sys_path='/sys'):
|
||||
"""Inspect transport backing; a driver binding or interface name is insufficient.
|
||||
"""Inspect cellular hardware transport readiness under sysfs.
|
||||
|
||||
The current IPA v2.6 shim has no BAM TX/RX implementation. Reject it even
|
||||
when it exposes rmnet_ipa0. A future real backend must explicitly expose
|
||||
modem/datapath_ready=1 before this integration permits activation.
|
||||
Legacy IPA v2.6L hardware must expose modem/datapath_ready=1 before
|
||||
NetworkManager activation is permitted.
|
||||
"""
|
||||
root = Path(sys_path)
|
||||
rows = []
|
||||
@@ -133,8 +132,10 @@ def cellular_datapath_status(sys_path='/sys'):
|
||||
compatible = read(device / 'of_node/compatible').split('\0')
|
||||
legacy = (version.startswith('2.') or
|
||||
any(value in ('qcom,sdm660-ipa', 'qcom,ipa-v2.6') for value in compatible))
|
||||
if legacy and read(device / 'modem/datapath_ready') != '1':
|
||||
return False, 'IPA v2.6 shim: BAM TX/RX not implemented'
|
||||
if legacy:
|
||||
if read(device / 'modem/datapath_ready') != '1':
|
||||
return False, 'IPA v2.6 shim: BAM TX/RX not implemented'
|
||||
return True, 'bound hardware transport (datapath_ready=1)'
|
||||
return True, 'bound hardware transport (IP connectivity unverified)'
|
||||
|
||||
for iface in sorted((root / 'class/net').glob('*')):
|
||||
@@ -260,6 +261,7 @@ def build_nmcli_setup_commands(con_name=CONNECTION_NAME, apn='cmnet', ifname='*'
|
||||
'gsm.apn', apn,
|
||||
'gsm.auto-config', 'yes',
|
||||
'connection.autoconnect', 'no',
|
||||
'ipv4.route-metric', '700',
|
||||
'connection.interface-name', ifname if ifname != '*' else ''])
|
||||
else:
|
||||
cmd = ['nmcli', 'connection', 'add',
|
||||
@@ -268,7 +270,8 @@ def build_nmcli_setup_commands(con_name=CONNECTION_NAME, apn='cmnet', ifname='*'
|
||||
'ifname', ifname,
|
||||
'apn', apn,
|
||||
'gsm.auto-config', 'yes',
|
||||
'connection.autoconnect', 'no']
|
||||
'connection.autoconnect', 'no',
|
||||
'ipv4.route-metric', '700']
|
||||
commands.append(cmd)
|
||||
return commands
|
||||
|
||||
@@ -423,10 +426,6 @@ def run_auto_connect(daemon=False, poll_interval=10, max_attempts=None,
|
||||
"""
|
||||
logger("Starting Platina cellular auto-connect...")
|
||||
|
||||
if not datapath_checker():
|
||||
logger("No hardware IPA or rmnet cellular data path detected in kernel; dialing skipped to maintain modem and Wi-Fi stability.")
|
||||
return False
|
||||
|
||||
attempts = 0
|
||||
last_operator = None
|
||||
last_state = None
|
||||
@@ -438,6 +437,15 @@ def run_auto_connect(daemon=False, poll_interval=10, max_attempts=None,
|
||||
logger(f"Reached maximum attempts ({max_attempts}), stopping.")
|
||||
return False
|
||||
|
||||
if not datapath_checker():
|
||||
if last_state != 'no_datapath':
|
||||
logger("No hardware IPA or rmnet cellular data path detected in kernel; dialing skipped to maintain modem and Wi-Fi stability.")
|
||||
last_state = 'no_datapath'
|
||||
if not daemon:
|
||||
return False
|
||||
sleeper(poll_interval)
|
||||
continue
|
||||
|
||||
# Battery gate check: do not allow RF transmit if battery voltage/capacity is low
|
||||
bat_ok, bat_msg = battery_checker()
|
||||
if not bat_ok:
|
||||
@@ -492,6 +500,15 @@ def run_auto_connect(daemon=False, poll_interval=10, max_attempts=None,
|
||||
sleeper(poll_interval)
|
||||
continue
|
||||
|
||||
if state in ('searching', 'initializing', 'enabling') and not operator_code:
|
||||
if daemon or (max_attempts is None or attempts < max_attempts):
|
||||
wait_key = f'waiting_{state}'
|
||||
if last_state != wait_key:
|
||||
logger(f"Modem state is {state} without operator PLMN; waiting for registration...")
|
||||
last_state = wait_key
|
||||
sleeper(poll_interval)
|
||||
continue
|
||||
|
||||
# Determine APN for current operator
|
||||
apn = detect_apn_for_operator(
|
||||
operator_code,
|
||||
|
||||
Reference in New Issue
Block a user