Skip to content

Commit b722e1d

Browse files
committed
improve nvidia gpu set speed
1 parent f216dd5 commit b722e1d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

hush/hardware/nvidia.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ async def get_temp(self):
2424
raise e
2525

2626
async def set_speed(self, speed):
27-
await self.ssh.shell(f'export DISPLAY=:0 && nvidia-settings -c $DISPLAY -a "GPUFanControlState=1" -a "GPUTargetFanSpeed={speed}"')
27+
result = await self.ssh.execute(f'export DISPLAY=:0 && nvidia-settings -c $DISPLAY -a "GPUFanControlState=1" -a "GPUTargetFanSpeed={speed}"')
28+
if result.stdout.count("assigned value") != 2:
29+
raise SystemError
2830

2931
async def close(self):
30-
await self.ssh.shell('export DISPLAY=:0 && nvidia-settings -c $DISPLAY -a "GPUFanControlState=0"')
32+
await self.ssh.execute('export DISPLAY=:0 && nvidia-settings -c $DISPLAY -a "GPUFanControlState=0"')

0 commit comments

Comments
 (0)