|
|
@ -85,19 +85,27 @@ class Tici(HardwareBase): |
|
|
|
try: |
|
|
|
try: |
|
|
|
primary_connection = self.nm.Get(NM, 'PrimaryConnection', dbus_interface=DBUS_PROPS, timeout=TIMEOUT) |
|
|
|
primary_connection = self.nm.Get(NM, 'PrimaryConnection', dbus_interface=DBUS_PROPS, timeout=TIMEOUT) |
|
|
|
primary_connection = self.bus.get_object(NM, primary_connection) |
|
|
|
primary_connection = self.bus.get_object(NM, primary_connection) |
|
|
|
tp = primary_connection.Get(NM_CON_ACT, 'Type', dbus_interface=DBUS_PROPS, timeout=TIMEOUT) |
|
|
|
primary_type = primary_connection.Get(NM_CON_ACT, 'Type', dbus_interface=DBUS_PROPS, timeout=TIMEOUT) |
|
|
|
|
|
|
|
primary_id = primary_connection.Get(NM_CON_ACT, 'Id', dbus_interface=DBUS_PROPS, timeout=TIMEOUT) |
|
|
|
|
|
|
|
|
|
|
|
if tp in ['802-3-ethernet', '802-11-wireless']: |
|
|
|
if primary_type == '802-3-ethernet': |
|
|
|
|
|
|
|
return NetworkType.ethernet |
|
|
|
|
|
|
|
elif primary_type == '802-11-wireless' and primary_id != 'Hotspot': |
|
|
|
return NetworkType.wifi |
|
|
|
return NetworkType.wifi |
|
|
|
elif tp in ['gsm']: |
|
|
|
else: |
|
|
|
modem = self.get_modem() |
|
|
|
active_connections = self.nm.Get(NM, 'ActiveConnections', dbus_interface=DBUS_PROPS, timeout=TIMEOUT) |
|
|
|
access_t = modem.Get(MM_MODEM, 'AccessTechnologies', dbus_interface=DBUS_PROPS, timeout=TIMEOUT) |
|
|
|
for conn in active_connections: |
|
|
|
if access_t >= MM_MODEM_ACCESS_TECHNOLOGY_LTE: |
|
|
|
c = self.bus.get_object(NM, conn) |
|
|
|
return NetworkType.cell4G |
|
|
|
tp = c.Get(NM_CON_ACT, 'Type', dbus_interface=DBUS_PROPS, timeout=TIMEOUT) |
|
|
|
elif access_t >= MM_MODEM_ACCESS_TECHNOLOGY_UMTS: |
|
|
|
if tp == 'gsm': |
|
|
|
return NetworkType.cell3G |
|
|
|
modem = self.get_modem() |
|
|
|
else: |
|
|
|
access_t = modem.Get(MM_MODEM, 'AccessTechnologies', dbus_interface=DBUS_PROPS, timeout=TIMEOUT) |
|
|
|
return NetworkType.cell2G |
|
|
|
if access_t >= MM_MODEM_ACCESS_TECHNOLOGY_LTE: |
|
|
|
|
|
|
|
return NetworkType.cell4G |
|
|
|
|
|
|
|
elif access_t >= MM_MODEM_ACCESS_TECHNOLOGY_UMTS: |
|
|
|
|
|
|
|
return NetworkType.cell3G |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
return NetworkType.cell2G |
|
|
|
except Exception: |
|
|
|
except Exception: |
|
|
|
pass |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
@ -254,7 +262,3 @@ class Tici(HardwareBase): |
|
|
|
# TODO: fix permissions with udev |
|
|
|
# TODO: fix permissions with udev |
|
|
|
val = "0" if enabled else "1" |
|
|
|
val = "0" if enabled else "1" |
|
|
|
os.system(f"sudo su -c 'echo {val} > /sys/devices/system/cpu/cpu{i}/online'") |
|
|
|
os.system(f"sudo su -c 'echo {val} > /sys/devices/system/cpu/cpu{i}/online'") |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
|
|
|
|
import sys |
|
|
|
|
|
|
|
Tici().set_power_save(bool(int(sys.argv[1]))) |
|
|
|
|
|
|
|