This commit is contained in:
Cayo Puigdefabregas 2024-11-12 10:50:49 +01:00
parent b2f9363696
commit eac898964f

View file

@ -241,6 +241,19 @@ def smartctl(all_disks, disk=None):
return data_list return data_list
@logs
def inxi():
filename = "hw.json"
command = 'sudo inxi'
options = '-a -x 3 -f -m -n --edid -G -E -M -A -B -D --output json --output-file'
cmd = f"{command} {options} {filename}"
exec_cmd(cmd)
with open(filename) ad f:
data = f.read()
rm = f"rm -f {filename}"
os.popen(rm).read()
return data
## End Command Functions ## ## End Command Functions ##
@ -251,12 +264,14 @@ def get_data(all_disks):
hwinfo = 'sudo hwinfo --reallyall' hwinfo = 'sudo hwinfo --reallyall'
dmidecode = 'sudo dmidecode' dmidecode = 'sudo dmidecode'
lspci = 'sudo lspci -vv' lspci = 'sudo lspci -vv'
data = { data = {
'lshw': exec_cmd(lshw) or "{}", 'lshw': exec_cmd(lshw) or "{}",
'disks': smartctl(all_disks), 'disks': smartctl(all_disks),
'hwinfo': exec_cmd(hwinfo), 'hwinfo': exec_cmd(hwinfo),
'dmidecode': exec_cmd(dmidecode), 'dmidecode': exec_cmd(dmidecode),
'lspci': exec_cmd(lspci) 'lspci': exec_cmd(lspci)
'inxi': exec_inxi()
} }
return data return data