Get GPUs JSON output.

This commit is contained in:
Raphaël Numbus
2026-05-25 20:56:25 +02:00
parent 568d5aa165
commit 3c5a746413
+12 -1
View File
@@ -120,6 +120,7 @@ detect_graphics() {
local brand
local renderer
local product
local integrated
OLD_IFS="\$IFS"
IFS=\$'n'
@@ -135,7 +136,7 @@ detect_graphics() {
fi
done
# Renderer info
# Renderer
renderer="\$(ls -lh /dev/dri/by-path | grep "\$pci_addr" | grep "render")"
if [[ -n "\${renderer}" ]]; then
renderer="\${renderer##*render}"
@@ -170,6 +171,16 @@ detect_graphics() {
IFS="\${OLD_IFS}"
local obj
obj=$(jq -n \
--arg b "$brand" \
--arg r "$renderer" \
--arg p "$product" \
--argjson i "$integrated" \
'{brand: $b, renderer: $r, product: $p, integrated: $i}')
gpus=$(echo "$gpus" | jq --argjson obj "$obj" '. += [$obj]')
append_to_report "graphics" "\$gpus"
}