@@ -9,6 +9,7 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Security.Permissions;
|
||||
using LibreHardwareMonitor.Hardware.Controller.AeroCool;
|
||||
using LibreHardwareMonitor.Hardware.Controller.AquaComputer;
|
||||
using LibreHardwareMonitor.Hardware.Controller.Heatmaster;
|
||||
using LibreHardwareMonitor.Hardware.Controller.TBalancer;
|
||||
@@ -92,12 +93,14 @@ namespace LibreHardwareMonitor.Hardware
|
||||
Add(new TBalancerGroup(_settings));
|
||||
Add(new HeatmasterGroup(_settings));
|
||||
Add(new AquaComputerGroup(_settings));
|
||||
Add(new AeroCoolGroup(_settings));
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveType<TBalancerGroup>();
|
||||
RemoveType<HeatmasterGroup>();
|
||||
RemoveType<AquaComputerGroup>();
|
||||
RemoveType<AeroCoolGroup>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,6 +379,7 @@ namespace LibreHardwareMonitor.Hardware
|
||||
Add(new TBalancerGroup(_settings));
|
||||
Add(new HeatmasterGroup(_settings));
|
||||
Add(new AquaComputerGroup(_settings));
|
||||
Add(new AeroCoolGroup(_settings));
|
||||
}
|
||||
|
||||
if (_storageEnabled)
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
||||
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
// Copyright (C) LibreHardwareMonitor and Contributors.
|
||||
// All Rights Reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using HidLibrary;
|
||||
|
||||
namespace LibreHardwareMonitor.Hardware.Controller.AeroCool
|
||||
{
|
||||
public class AeroCoolGroup : IGroup
|
||||
{
|
||||
private readonly List<IHardware> _hardware = new List<IHardware>();
|
||||
private readonly StringBuilder _report = new StringBuilder();
|
||||
|
||||
public AeroCoolGroup(ISettings settings)
|
||||
{
|
||||
_report.AppendLine("AeroCool Hardware");
|
||||
_report.AppendLine();
|
||||
|
||||
foreach (HidDevice dev in HidDevices.Enumerate(0x2e97))
|
||||
{
|
||||
int hubno = dev.Attributes.ProductId - 0x1000;
|
||||
if (dev.DevicePath.Contains("mi_02") && (hubno >= 1) && (hubno <= 8))
|
||||
{
|
||||
var device = new P7H1(dev, settings);
|
||||
_report.AppendLine($"Device name: {device.Name}");
|
||||
_report.AppendLine($"HUB number: {device.HubNumber}");
|
||||
_report.AppendLine();
|
||||
_hardware.Add(device);
|
||||
}
|
||||
}
|
||||
|
||||
if (_hardware.Count == 0)
|
||||
{
|
||||
_report.AppendLine("No AeroCool Hardware found.");
|
||||
_report.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<IHardware> Hardware => _hardware;
|
||||
|
||||
public void Close()
|
||||
{
|
||||
foreach (IHardware iHardware in _hardware)
|
||||
{
|
||||
if (iHardware is Hardware hardware)
|
||||
hardware.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public string GetReport()
|
||||
{
|
||||
return _report.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
||||
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
// Copyright (C) LibreHardwareMonitor and Contributors.
|
||||
// All Rights Reserved.
|
||||
|
||||
using System;
|
||||
using HidLibrary;
|
||||
|
||||
namespace LibreHardwareMonitor.Hardware.Controller.AeroCool
|
||||
{
|
||||
internal class P7H1 : Hardware
|
||||
{
|
||||
private readonly HidDevice _device;
|
||||
private readonly float[] _speeds = new float[5];
|
||||
private bool _running;
|
||||
|
||||
private readonly Sensor[] _rpm = new Sensor[5];
|
||||
private const byte REPORT_ID = 0x0;
|
||||
|
||||
public int HubNumber { get; private set; }
|
||||
|
||||
public P7H1(HidDevice dev, ISettings settings) : base("AeroCool P7-H1", new Identifier(dev.DevicePath), settings)
|
||||
{
|
||||
_device = dev;
|
||||
HubNumber = _device.Attributes.ProductId - 0x1000;
|
||||
Name = $"AeroCool P7-H1 #{HubNumber}";
|
||||
_device.OpenDevice();
|
||||
_device.MonitorDeviceEvents = true;
|
||||
_running = true;
|
||||
_device.Read(OnDataReady);
|
||||
|
||||
for (int i=0; i<5; i++)
|
||||
{
|
||||
_rpm[i] = new Sensor($"Fan #{i+1}", i, SensorType.Fan, this, settings);
|
||||
ActivateSensor(_rpm[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public override HardwareType HardwareType
|
||||
{
|
||||
get
|
||||
{
|
||||
return HardwareType.AeroCool;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
_running = false;
|
||||
_device.CloseDevice();
|
||||
base.Close();
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
_rpm[i].Value = _speeds[i];
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDataReady(HidDeviceData report)
|
||||
{
|
||||
if (!_running) // Do not register eventhandler again if device stopped
|
||||
return;
|
||||
if (report.Status == HidDeviceData.ReadStatus.Success)
|
||||
{
|
||||
byte[] rawData = report.Data;
|
||||
if(rawData.Length == 16 && rawData[0] == REPORT_ID)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
int speed = rawData[i * 3 + 2] * 256 + rawData[i * 3 + 3];
|
||||
_speeds[i] = (float)speed;
|
||||
}
|
||||
}
|
||||
}
|
||||
_device.Read(OnDataReady);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,8 @@ namespace LibreHardwareMonitor.Hardware
|
||||
TBalancer,
|
||||
Heatmaster,
|
||||
Storage,
|
||||
Network
|
||||
Network,
|
||||
AeroCool
|
||||
}
|
||||
|
||||
public interface IHardware : IElement
|
||||
|
||||
Reference in New Issue
Block a user