chestm007 / amdgpu-fan

Fan controller for AMD graphics cards running the amdgpu driver on Linux
GNU General Public License v2.0
133 stars 40 forks source link

R9 390: fan1_input - No such device #17

Open kleest opened 4 years ago

kleest commented 4 years ago

Using an R9 390, reading the current fan speed results in a program crash:

  File "/usr/lib/python3.8/site-packages/amdgpu_fan/controller.py", line 35, in main
    logger.debug(f'{name}: Temp {temp}, Setting fan speed to: {speed}, fan speed{card.fan_speed}, min:{card.fan_min}, max:{card.fan_max}')
  File "/usr/lib/python3.8/site-packages/amdgpu_fan/lib/amdgpu.py", line 50, in fan_speed
    return int(self.read_endpoint('fan1_input'))
  File "/usr/lib/python3.8/site-packages/amdgpu_fan/lib/amdgpu.py", line 37, in read_endpoint
    return e.read()
OSError: [Errno 19] No such device

This is due to cat /sys/class/drm/card0/device/hwmon/hwmon1/fan1_input: No such device

System information:

1d:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Hawaii PRO [Radeon R9 290/390] [1002:67b1] (rev 80)
Linux 5.5.5-arch1-1 #1 SMP PREEMPT Thu, 20 Feb 2020 18:23:09 +0000 x86_64 GNU/Linux
SpyrosRoum commented 4 years ago

I am having the exact same issue, also with an R9 390 (from sapphire if that helps) though I find it weird because if I try to ls /sys/class/drm/card0/device/hwmon/hwmon1/ I can see fan1_input listed

Edit to say that if I start it with systemctl (sudo systemctl start amdgpu-fan.service) it looks like it run without issues

kleest commented 4 years ago

For the time being, I fixed it with:

--- a/amdgpu_fan/lib/amdgpu.py
+++ b/amdgpu_fan/lib/amdgpu.py
@@ -48,7 +48,7 @@ class Card:
     def fan_speed(self):
         try:
             return int(self.read_endpoint('fan1_input'))
-        except KeyError:  # better to return no speed then explode
+        except:  # better to return no speed then explode
             return 0

     @property

Of course, this is no permanent solution.