This commit is contained in:
Your Name
2024-04-27 13:03:43 -05:00
parent fe5f722eda
commit 71b83ffe7f
22 changed files with 986 additions and 28 deletions

View File

@@ -94,11 +94,7 @@ def get_device_type():
# lru_cache and cache can cause memory leaks when used in classes
with open("/sys/firmware/devicetree/base/model") as f:
model = f.read().strip('\x00')
model = model.split('comma ')[-1]
# TODO: remove this with AGNOS 7+
if model.startswith('Qualcomm'):
model = 'tici'
return model
return model.split('comma ')[-1]
class Tici(HardwareBase):
@cached_property
@@ -116,6 +112,8 @@ class Tici(HardwareBase):
@cached_property
def amplifier(self):
if self.get_device_type() == "mici":
return None
return Amplifier()
def get_os_version(self):
@@ -134,6 +132,16 @@ class Tici(HardwareBase):
def reboot(self, reason=None):
subprocess.check_output(["sudo", "reboot"])
def soft_reboot(self):
commands = [
['rm', '-f', '/tmp/safe_staging_overlay.lock'],
['tmux', 'new', '-s', 'commatmp', '-d', '/data/continue.sh'],
['tmux', 'kill-session', '-t', 'comma'],
['tmux', 'rename', 'comma'],
]
for command in commands:
subprocess.run(command, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL)
def uninstall(self):
Path("/data/__system_reset__").touch()
os.sync()
@@ -374,9 +382,10 @@ class Tici(HardwareBase):
def set_power_save(self, powersave_enabled):
# amplifier, 100mW at idle
self.amplifier.set_global_shutdown(amp_disabled=powersave_enabled)
if not powersave_enabled:
self.amplifier.initialize_configuration(self.get_device_type())
if self.amplifier is not None:
self.amplifier.set_global_shutdown(amp_disabled=powersave_enabled)
if not powersave_enabled:
self.amplifier.initialize_configuration(self.get_device_type())
# *** CPU config ***
@@ -414,7 +423,8 @@ class Tici(HardwareBase):
return 0
def initialize_hardware(self):
self.amplifier.initialize_configuration(self.get_device_type())
if self.amplifier is not None:
self.amplifier.initialize_configuration(self.get_device_type())
# Allow thermald to write engagement status to kmsg
os.system("sudo chmod a+w /dev/kmsg")
@@ -468,8 +478,9 @@ class Tici(HardwareBase):
# use sim slot
'AT^SIMSWAP=1',
# configure ECM mode
'AT$QCPCFG=usbNet,1'
# ethernet config
'AT$QCPCFG=usbNet,0',
'AT$QCNETDEVCTL=3,1',
]
else:
cmds += [
@@ -478,6 +489,12 @@ class Tici(HardwareBase):
'AT+QNVFW="/nv/item_files/ims/IMS_enable",00',
'AT+QNVFW="/nv/item_files/modem/mmode/ue_usage_setting",01',
]
if self.get_device_type() == "tizi":
cmds += [
# SIM hot swap
'AT+QSIMDET=1,0',
'AT+QSIMSTAT=1',
]
# clear out old blue prime initial APN
os.system('mmcli -m any --3gpp-set-initial-eps-bearer-settings="apn="')