Skip to content

Commit 620b60b

Browse files
committed
Fixed fan index for linux.
1 parent 76ac433 commit 620b60b

File tree

1 file changed

+14
-8
lines changed
  • IPR.Hardware.Tools/Hardware/Controller/Dell

1 file changed

+14
-8
lines changed

IPR.Hardware.Tools/Hardware/Controller/Dell/Dell.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,32 +71,38 @@ private void InitLinux()
7171
, (index, value) =>
7272
{
7373
ProcessStartInfo psi = new ProcessStartInfo();
74-
psi.FileName = "sh";
75-
psi.Arguments = $"i8kctl fan {index} {value}";
74+
psi.FileName = "/bin/sh";
75+
psi.Arguments = $"-c \"i8kctl fan {index} {value}\"";
7676
psi.UseShellExecute = false;
7777
psi.RedirectStandardOutput = true;
7878
psi.RedirectStandardError = true;
79+
psi.CreateNoWindow = true;
7980
Process proc = new Process
8081
{
82+
EnableRaisingEvents = true,
8183
StartInfo = psi
8284
};
8385
proc.Start();
86+
string result = proc.StandardOutput.ReadToEnd();
8487
proc.WaitForExit();
88+
proc.Dispose();
8589
return value;
8690
},
8791
(index, value) =>
8892
{
8993
ProcessStartInfo psi = new ProcessStartInfo();
90-
psi.FileName = "sh";
91-
psi.Arguments = $"i8kctl fan {index} {value}";
94+
psi.FileName = "/bin/sh";
95+
psi.Arguments = $"-c \"i8kctl fan {index} {value}\"";
9296
psi.UseShellExecute = false;
9397
psi.RedirectStandardOutput = true;
9498
psi.RedirectStandardError = true;
99+
psi.CreateNoWindow = true;
95100
Process proc = new Process
96101
{
97102
StartInfo = psi
98103
};
99104
proc.Start();
105+
string result = proc.StandardOutput.ReadToEnd();
100106
proc.WaitForExit();
101107
});
102108
ActivateControl(control);
@@ -178,10 +184,10 @@ public override void Update()
178184
if (Software.OperatingSystem.IsUnix)
179185
{
180186
var i8kValue = File.ReadAllText("/proc/i8k").Split(" ");
181-
var fan1Level = i8kValue[4];
182-
var fan2Level = i8kValue[5];
183-
var fan1rpm = i8kValue[6];
184-
var fan2rpm = i8kValue[7];
187+
var fan1Level = i8kValue[5];
188+
var fan2Level = i8kValue[4];
189+
var fan1rpm = i8kValue[7];
190+
var fan2rpm = i8kValue[6];
185191

186192
_fanSensors[0].Value = double.Parse(fan1Level);
187193
_fanSensors[1].Value = double.Parse(fan1rpm);

0 commit comments

Comments
 (0)