Skip to content

Commit f4dd737

Browse files
MickLeskprobers1
authored andcommitted
Improve NVIDIA device detection for container passthrough (community-scripts#9670)
1 parent b77afc9 commit f4dd737

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

misc/build.func

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,9 +2442,16 @@ build_container() {
24422442
msg_custom "🎮" "${GN}" "Detected NVIDIA GPU"
24432443

24442444
# Simple passthrough - just bind /dev/nvidia* devices if they exist
2445-
for d in /dev/nvidia* /dev/nvidiactl /dev/nvidia-modeset /dev/nvidia-uvm /dev/nvidia-uvm-tools; do
2446-
[[ -e "$d" ]] && NVIDIA_DEVICES+=("$d")
2445+
# Only include character devices (-c), skip directories like /dev/nvidia-caps
2446+
for d in /dev/nvidia*; do
2447+
[[ -c "$d" ]] && NVIDIA_DEVICES+=("$d")
24472448
done
2449+
# Also check for devices inside /dev/nvidia-caps/ directory
2450+
if [[ -d /dev/nvidia-caps ]]; then
2451+
for d in /dev/nvidia-caps/*; do
2452+
[[ -c "$d" ]] && NVIDIA_DEVICES+=("$d")
2453+
done
2454+
fi
24482455

24492456
if [[ ${#NVIDIA_DEVICES[@]} -gt 0 ]]; then
24502457
msg_custom "🎮" "${GN}" "Found ${#NVIDIA_DEVICES[@]} NVIDIA device(s) for passthrough"

0 commit comments

Comments
 (0)