在笔记本电脑上以编程方式访问CPU风扇? (视窗) [英] Programmatically access CPU fan on a laptop? (Windows)

查看:456
本文介绍了在笔记本电脑上以编程方式访问CPU风扇? (视窗)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一个Windows标准的方法来做C / C ++?启动风扇,降低速度等等。

Is there a Windows standard way to do things such as "start fan", "decrease speed" or the like, from C/C++?

怀疑它可能是ACPI,但我是一个虚弱的人,不能读那种文档。

I have a suspicion it might be ACPI, but I am a frail mortal and cannot read that kind of documentation.

编辑:例如Windows 7允许您在电源计划选项中选择如被动冷却(仅当事情变热时)与主动冷却(保持CPU主动冷却)。

e.g. Windows 7 lets you select in your power plan options such as "passive cooling" (only when things get hot?) vs. "active cooling" (keep the CPU proactively cool?). It seems the OS does have a way to control the fan generically.

推荐答案

我现在正在处理一个项目,除其他外,控制计算机风扇。基本上,风扇由您的计算机的superIO芯片控制。我们直接使用端口映射IO访问芯片,从那里我们可以到达逻辑风扇设备。使用端口映射的IO需要代码在内核模式下运行,但Windows不提供任何驱动程序的通用端口IO(有很好的理由,因为它是一个非常强大的工具),所以我们编写了自己的驱动程序,并使用。

I am at the moment working on a project that, among other things, controls the computer fans. Basically, the fans are controlled by the superIO chip of your computer. We access the chip directly using port-mapped IO, and from there we can get to the logical fan device. Using port-mapped IO requires the code to run in kernel mode, but windows does not supply any drivers for generic port IO (with good reason, since it is a very powerful tool), so we wrote our own driver, and used that.

如果你想走这条路线,你基本上需要两个方面的知识:驱动程序开发以及如何访问和解释superIO芯片信息。当我们开始这个项目时,我们在这两个领域都不知道什么,所以它通过浏览,阅读和终于学习。要获得这些知识,我们通过查看以下链接获得了特别的帮助:

If you want to go down this route, you basically need knowledge in two areas: driver development and how to access and interpret superIO chip information. When we started the project, we didn't know anything in either of these areas, so it has been learning by browsing, reading and finally doing. To gain the knowledge, we have been especially helped by looking at these links:


  1. WDK ,这是Windows驱动程序工具包。你需要这个来编译你为Windows写的任何驱动程序,它提供了许多源代码的示例驱动程序,包括一般端口映射​​IO的驱动程序,称为portio。

  2. <一个href =http://www.internals.com/> WinIO 有C的驱动程序的源代码,C中的dll以编程方式安装和加载该驱动程序,以及一些GUI的C#代码,加载dll和读/写到端口。驱动程序与portio中的驱动程序非常相似。

  3. lm-sensors 是linux项目,除其他外,检测您的superIO芯片。 / prog / detect / sensors-detect是检测的perl程序,我们花了一些时间来看看如何与superIO芯片接口。

  4. 当我们正在通过lm-sensors代码,很高兴拥有 RapidDriver RW-everything ,因为它们允许我们模拟一系列传感器检测。后者是更强大的,并且非常有助于可视化IO空间,而前者提供更容易访问一些操作,更好地映射传感器中的那些 - 检测(读/写字节到端口)

  5. 最后,您需要找到您的superIO芯片的数据表。从我看到的示例中,每个芯片的环境控制器提供类似的功能(r / w风扇速度,读取温度,读取芯片电压),但是为了获得此功能,您必须写入什么寄存器。 这个地方已经拥有了所有的数据表,我们至今仍需要。

  1. The WDK, which is the Windows Driver Kit. You need this to compile any driver you write for windows, With it comes a whole lot of source code for example drivers, including a driver for general port-mapped IO, called portio.
  2. WinIO has source code for a driver in C, a dll in C that programmatically installs and loads that driver, and some C# code for a GUI, that loads the dll and reads/writes to the ports. The driver is very similar to the one in portio.
  3. lm-sensors is a linux project, that, among other things, detects your superIO chip. /prog/detect/sensors-detect is the perl program, that does the detecting, and we have spent some time going through the code to see how to interface with a superIO chip.
  4. When we were going through the lm-sensors code, it was very nice to have tools like RapidDriver and RW-everything, since they allowed us to simulate a run of sensors-detect. The latter is the more powerful, and is very helpful in visualising the IO space, while the former provides easier access to some operations which map better to the ones in sensors-detect (read/write byte to port)
  5. Finally, you need to find the datasheet of your superIO chip. From the examples, that I have seen, the environment controllers of each chip provide similar functionality (r/w fan speed, read temperature, read chip voltage), but vary in what registers you have to write to in order to get to this functionality. This place has had all the datasheets, we have needed so far.

这篇关于在笔记本电脑上以编程方式访问CPU风扇? (视窗)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆