Update gpu_hook_guard_helpers.sh

This commit is contained in:
MacRimi
2026-04-06 19:36:35 +02:00
parent d747ac7659
commit 257668ab96

View File

@@ -131,10 +131,12 @@ if [[ -f "$vm_conf" ]]; then
id="${id// /}"
[[ -z "$id" ]] && continue
# Slot-only syntax (e.g. 01:00) is accepted by Proxmox.
if [[ "$id" =~ ^[0-9a-fA-F]{2}:[0-9a-fA-F]{2}$ ]]; then
# Slot-only syntax (e.g. 01:00 or 0000:01:00) is accepted by Proxmox.
if [[ "$id" =~ ^([0-9a-fA-F]{4}:)?[0-9a-fA-F]{2}:[0-9a-fA-F]{2}$ ]]; then
slot="${id,,}"
slot="${slot#0000:}"
slot_has_gpu=false
for dev in /sys/bus/pci/devices/0000:${id}.*; do
for dev in /sys/bus/pci/devices/0000:${slot}.*; do
[[ -e "$dev" ]] || continue
class_hex="$(cat "$dev/class" 2>/dev/null | sed 's/^0x//')"
[[ "${class_hex:0:2}" != "03" ]] && continue