fix(platina): resolve touchscreen, dual panel, charging reboot, battery guard, camera auth, and internal SIM cellular data
- Add patch 0040: cut panel VSP/VSN always-on rails, attach panel follower to Synaptics TCM touch, add Novatek NT36672A touch node, add BOE panel DTS, and extend DVFS up to 1.84/2.2 GHz. - Prevent Qualcomm ABL infinite reboot loop on poweroff while charger connected via standby detection in phone-poweroff.py. - Implement HTTP Basic Auth in camera web preview server with secure digest verification. - Add battery guard daemon and unit tests to maintain SoC between 50% and 65%. - Implement Option 2 for cellular data: disable ZRAM swap to prevent Hexagon DMA fragmentation crash, add modem modules to initfs, enable ModemManager/NetworkManager WWAN packages and services, and add phone-cellular-setup.py CLI utility with unit tests. - Update recipe checksums and verify 109 unit tests and public index boundaries.
This commit is contained in:
@@ -11,7 +11,44 @@ import sys
|
||||
import time
|
||||
|
||||
|
||||
def request_shutdown():
|
||||
def is_charger_connected():
|
||||
for name in ('pm660-charger', 'battery', 'qpnp-smbcharger', 'usb'):
|
||||
supply = Path(f'/sys/class/power_supply/{name}')
|
||||
if not supply.exists():
|
||||
continue
|
||||
try:
|
||||
online = supply / 'online'
|
||||
if online.exists() and online.read_text().strip() in ('1', 'true'):
|
||||
return True
|
||||
status = supply / 'status'
|
||||
if status.exists() and status.read_text().strip() in ('Charging', 'Full'):
|
||||
return True
|
||||
except OSError:
|
||||
pass
|
||||
return False
|
||||
|
||||
|
||||
def enter_charger_standby():
|
||||
print('platina-poweroff: external power connected; entering low-power suspend standby', flush=True)
|
||||
state_file = Path('/sys/power/state')
|
||||
if state_file.exists():
|
||||
for mode in ('mem', 'freeze'):
|
||||
try:
|
||||
state_file.write_text(mode + '\n')
|
||||
print(f'platina-poweroff: woke from {mode} standby', flush=True)
|
||||
return
|
||||
except OSError:
|
||||
continue
|
||||
try:
|
||||
subprocess.run(['pm-suspend'], check=True, timeout=10)
|
||||
except (OSError, subprocess.SubprocessError):
|
||||
pass
|
||||
|
||||
|
||||
def request_shutdown(force=False, standby=False):
|
||||
if not force and (standby or is_charger_connected()):
|
||||
enter_charger_standby()
|
||||
return
|
||||
subprocess.run(['/usr/sbin/poweroff'], check=True, timeout=10)
|
||||
print('platina-poweroff: init accepted shutdown; keeping screen until shutdown', flush=True)
|
||||
# Shutdown should terminate this process. If it does not, restore the display
|
||||
@@ -23,6 +60,8 @@ def request_shutdown():
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--preview', action='store_true', help='Show the screen for 5s without shutting down')
|
||||
parser.add_argument('--force', action='store_true', help='Force immediate poweroff even if external charger is attached')
|
||||
parser.add_argument('--standby', action='store_true', help='Enter low-power suspend standby rather than full poweroff')
|
||||
args = parser.parse_args()
|
||||
if os.geteuid() != 0:
|
||||
raise ValueError('Run on the phone as root')
|
||||
@@ -33,7 +72,7 @@ def main():
|
||||
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||
with control['device']() as fb:
|
||||
control['show'](fb, directory, 5 if args.preview else 3, 25,
|
||||
after_display=None if args.preview else request_shutdown)
|
||||
after_display=None if args.preview else lambda: request_shutdown(force=args.force, standby=args.standby))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user