amdgpu_fan 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/amdgpu_fan +1 -1
- data/lib/amdgpu_fan_cli.rb +24 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50dee1caaf6f26947eabb70a37b584ae8fc8c98b4a3cef1d26b19ef59aab2b1d
|
4
|
+
data.tar.gz: 6e87eaffcffc5dce3a0a6c413f5848e9ada6490558e49d1d0e664e0672746688
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b20353e1b75b6ec79fad9a960a41795a4dff56aa8a22c484c502096cda365a698dade6bdb270c595e50a83bb6c61d3e3dd489017ac5e38c4cdaaca0cee4ccfe4
|
7
|
+
data.tar.gz: 16b78ea4ecbc84afdfefce9d9b34c42ceef66b2e96ea3e6899e4c01fc5b159778dfc639655cdd776350dd6c164e41ac70dbf27aa4e32075d957b7363a319682d
|
data/bin/amdgpu_fan
CHANGED
data/lib/amdgpu_fan_cli.rb
CHANGED
@@ -8,18 +8,19 @@ class AmdgpuFanCli < Thor
|
|
8
8
|
FAN_MAX_POWER_FILE = Dir.glob("/sys/class/drm/card0/device/**/pwm1_max").first
|
9
9
|
FAN_INPUT_FILE = Dir.glob("/sys/class/drm/card0/device/**/fan1_input").first
|
10
10
|
FAN_MODE_FILE = Dir.glob("/sys/class/drm/card0/device/**/pwm1_enable").first
|
11
|
+
FAN_MODES = { auto: '2', manual: '1' }.freeze
|
11
12
|
|
12
|
-
desc 'auto', 'set mode to automatic'
|
13
|
+
desc 'auto', 'set mode to automatic (requires sudo)'
|
13
14
|
def auto
|
14
|
-
|
15
|
-
`sudo su -c "echo 2 > #{FAN_MODE_FILE}"`
|
15
|
+
set_mode(:auto)
|
16
16
|
end
|
17
17
|
|
18
|
-
desc 'set PERCENTAGE', 'set fan speed to PERCENTAGE'
|
18
|
+
desc 'set PERCENTAGE', 'set fan speed to PERCENTAGE (requires sudo)'
|
19
19
|
def set(percentage)
|
20
|
-
return unless (0..100).cover?(percentage.to_i)
|
20
|
+
return puts "Invalid percentage" unless (0..100).cover?(percentage.to_i)
|
21
|
+
set_mode(:manual) unless in_manual_mode?
|
21
22
|
puts "Setting fan to #{setting_from_percent percentage}/#{max}..."
|
22
|
-
|
23
|
+
set_manual_speed setting_from_percent(percentage)
|
23
24
|
end
|
24
25
|
|
25
26
|
desc 'status', 'report the current status'
|
@@ -57,10 +58,27 @@ class AmdgpuFanCli < Thor
|
|
57
58
|
@max ||= File.read(FAN_MAX_POWER_FILE).to_i
|
58
59
|
end
|
59
60
|
|
61
|
+
def in_auto_mode?
|
62
|
+
File.read(FAN_MODE_FILE).strip == '2'
|
63
|
+
end
|
64
|
+
|
65
|
+
def in_manual_mode?
|
66
|
+
File.read(FAN_MODE_FILE).strip == '1'
|
67
|
+
end
|
68
|
+
|
60
69
|
def rpm
|
61
70
|
File.read(FAN_INPUT_FILE).strip
|
62
71
|
end
|
63
72
|
|
73
|
+
def set_mode(mode)
|
74
|
+
puts "Setting mode to #{mode}"
|
75
|
+
`echo "#{FAN_MODES[mode]}" | sudo tee #{FAN_MODE_FILE}`
|
76
|
+
end
|
77
|
+
|
78
|
+
def set_manual_speed(speed)
|
79
|
+
`echo "#{speed}" | sudo tee #{FAN_POWER_FILE}`
|
80
|
+
end
|
81
|
+
|
64
82
|
def setting_from_percent(percent)
|
65
83
|
(percent.to_f / 100 * max.to_i).round
|
66
84
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amdgpu_fan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin McCormack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A CLI for amdgpu fans
|
14
14
|
email: harlemsquirrel@gmail.com
|
@@ -40,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
40
40
|
version: '0'
|
41
41
|
requirements: []
|
42
42
|
rubyforge_project:
|
43
|
-
rubygems_version: 2.7.
|
43
|
+
rubygems_version: 2.7.7
|
44
44
|
signing_key:
|
45
45
|
specification_version: 4
|
46
46
|
summary: A CLI to view and set fan speeds for AMD graphics cards running on the open
|