Debugging.
This commit is contained in:
+23
-23
@@ -117,37 +117,38 @@ append_to_report() {
|
||||
# --- 1. Detect Graphics ---
|
||||
detect_graphics() {
|
||||
local gpus="[]"
|
||||
local obj
|
||||
local brand
|
||||
local renderer
|
||||
local product
|
||||
local integrated
|
||||
local pci_addr
|
||||
|
||||
while read -r gpu; do
|
||||
echo \$gpu >> "${REMOTE_STDERR}"
|
||||
echo "test" >> "${REMOTE_STDERR}"
|
||||
# Process each GPU found by lspci
|
||||
while read -r line; do
|
||||
[[ -z "\$line" ]] && continue
|
||||
local brand="unknown"
|
||||
local renderer="none"
|
||||
local product="unknown"
|
||||
local integrated="false"
|
||||
local pci_addr="none"
|
||||
|
||||
pci_addr="\$(lspci | grep VGA | head -c 7)"
|
||||
# Extract PCI address (e.g. 00:02.0)
|
||||
pci_addr="\$(echo "\$line" | cut -d' ' -f1)"
|
||||
|
||||
# Brand
|
||||
for b in Intel AMD NVIDIA; do
|
||||
if echo "\${gpu}" | grep -i "\${b}" >> "${REMOTE_STDOUT}" 2>> "${REMOTE_STDERR}"; then
|
||||
if echo "\$line" | grep -iq "\$b"; then
|
||||
brand="\${b}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Renderer
|
||||
renderer="\$(ls -lh /dev/dri/by-path | grep "\$pci_addr" | grep "render")"
|
||||
if [[ -n "\${renderer}" ]]; then
|
||||
renderer="\${renderer##*render}"
|
||||
renderer="render\${renderer}"
|
||||
else
|
||||
renderer="none"
|
||||
if [[ -d "/dev/dri/by-path" ]]; then
|
||||
local render_node
|
||||
render_node=\$(ls /dev/dri/by-path | grep "\$pci_addr" | grep "render" | head -n1 || true)
|
||||
if [[ -n "\$render_node" ]]; then
|
||||
renderer=\$(basename "\$(readlink -f "/dev/dri/by-path/\$render_node")")
|
||||
fi
|
||||
fi
|
||||
|
||||
# Product name
|
||||
product="\${gpu#*:}"
|
||||
product="\${line#*:}"
|
||||
product="\${product#*: }"
|
||||
|
||||
# Form factor
|
||||
@@ -162,25 +163,24 @@ detect_graphics() {
|
||||
fi
|
||||
fi
|
||||
if [[ "\${brand}" == "AMD" ]]; then
|
||||
if echo "\${gpu}" | grep "Mobile"; then
|
||||
if echo "\$line" | grep -iq "Mobile"; then
|
||||
integrated="true"
|
||||
else
|
||||
integrated="false"
|
||||
fi
|
||||
fi
|
||||
|
||||
obj=\$(jq -n \
|
||||
local obj=\$(jq -n \
|
||||
--arg b "\${brand}" \
|
||||
--arg r "\${renderer}" \
|
||||
--arg p "\${product}" \
|
||||
--argjson i "\${integrated}" \
|
||||
'{brand: \${b}, renderer: \${r}, product: \${p}, integrated: \${i}}')
|
||||
'{brand: \$b, renderer: \$r, product: \$p, integrated: \$i}')
|
||||
|
||||
gpus=\$(echo "\$gpus" | jq --argjson obj "\$obj" '. += [\$obj]')
|
||||
|
||||
done < <(lspci | grep -e "VGA" -e "3D" >> "${REMOTE_STDOUT}" 2>> "${REMOTE_STDERR}")
|
||||
done < <(lspci | grep -E "VGA|3D")
|
||||
|
||||
echo "\$gpus" >> "${REMOTE_STDERR}"
|
||||
append_to_report "graphics" "\$gpus"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user