https://bugzilla.kernel.org/show_bug.cgi?id=201539
--- Comment #48 from Jan Ziak (http://atom-symbol.net) (0xe2.0x9a.0x9b@gmail.com) --- (In reply to muncrief from comment #47)
(In reply to Jan Ziak (http://atom-symbol.net) from comment #46)
There is also the possibility to use question marks in the path:
/sys/class/drm/card?/device/hwmon/hwmon?
Thank you for mentioning that. If you only have one GPU that will indeed work. I have multiple GPUs, one Nvidia and one AMD, so I have to hard-code the card.
Maybe you can use the PCI ID of the device:
FOUND=false for CARD in /sys/class/drm/card?; do DEVICE="$(cat "$CARD/device/device")" if [[ "${DEVICE,,}" == 0x67b1 ]]; then FOUND=true break fi done $FOUND || exit 1 HWMON=$CARD/device/hwmon/hwmon? echo $HWMON