mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-12-16 09:06:23 +00:00
Update flask_server.py
This commit is contained in:
@@ -1941,10 +1941,19 @@ def get_gpu_info():
|
|||||||
for line in result.stdout.split('\n'):
|
for line in result.stdout.split('\n'):
|
||||||
# Match VGA, 3D, Display controllers
|
# Match VGA, 3D, Display controllers
|
||||||
if any(keyword in line for keyword in ['VGA compatible controller', '3D controller', 'Display controller']):
|
if any(keyword in line for keyword in ['VGA compatible controller', '3D controller', 'Display controller']):
|
||||||
parts = line.split(':', 2)
|
# Line format: "00:02.0 VGA compatible controller: Intel Corporation ..."
|
||||||
if len(parts) >= 3:
|
# Split on first space to get slot, then split remaining on first colon to separate class from name
|
||||||
slot = parts[0].strip()
|
parts = line.split(' ', 1)
|
||||||
gpu_name = parts[2].strip()
|
if len(parts) >= 2:
|
||||||
|
slot = parts[0].strip() # Now captures full slot like "00:02.0"
|
||||||
|
remaining = parts[1]
|
||||||
|
|
||||||
|
# Split remaining part to get GPU name (after the class description)
|
||||||
|
if ':' in remaining:
|
||||||
|
class_and_name = remaining.split(':', 1)
|
||||||
|
gpu_name = class_and_name[1].strip() if len(class_and_name) > 1 else remaining.strip()
|
||||||
|
else:
|
||||||
|
gpu_name = remaining.strip()
|
||||||
|
|
||||||
# Determine vendor
|
# Determine vendor
|
||||||
vendor = 'Unknown'
|
vendor = 'Unknown'
|
||||||
@@ -1973,6 +1982,7 @@ def get_gpu_info():
|
|||||||
|
|
||||||
gpus.append(gpu)
|
gpus.append(gpu)
|
||||||
print(f"[v0] Found GPU: {gpu_name} ({vendor}) at slot {slot}")
|
print(f"[v0] Found GPU: {gpu_name} ({vendor}) at slot {slot}")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[v0] Error detecting GPUs from lspci: {e}")
|
print(f"[v0] Error detecting GPUs from lspci: {e}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user