在 Linux 中设置 ACPI 字段

发布于 2024-08-31 03:45:21 字数 696 浏览 4 评论 0原文

我有一台上网本,根据我的喜好,风扇运行得有点早。我找到了一种仅适用于 Windows 的解决方案来降低风扇噪音,但我在这台计算机上使用 Ubuntu。

在 Windows 解决方案中,该人使用了一个名为笔记本硬件控制 (NHC) 的程序,据我所知,该程序正在读取和设置 ACPI 值。 (http://hpmini110c.siteboard.eu/f3t31-lueftersteuerung-fuer -den-mini.html,7z文件中的相关源,其中的.cs文件是一个C#文件,其中包含用于设置风扇的逻辑)

我想找到一种方法的部分在 Linux 环境中复制的是:

# Where the value is being set
write = ACPI.FIELD.Write("_SP.PCIO.SBRG.ECO.CTPM", 40);
# Reading the temperature
int temp1 = 0;
bool _tmp = APCI.FIELD.Read("_SB.PCIO.SBRG.ECO.TPM1", ref temp1)

老实说,我在这方面已经超出了我的能力范围,但如果有人能推动我朝正确的方向前进,我将非常感激!

I've a netbook that is running the fan a bit to early for my liking. I've found a Windows-only solution to reducing the fan noise but I'm using Ubuntu on this computer.

In the Windows solution the guy is using a program called Notebook Hardware Control (NHC) which, from what I can make out, is reading and setting ACPI values. (http://hpmini110c.siteboard.eu/f3t31-lueftersteuerung-fuer-den-mini.html, relevant source in the 7z-file, the .cs-file in there is a C#-file with the logic for setting the fan on)

The part I would like to find a way to replicate in a Linux environment is:

# Where the value is being set
write = ACPI.FIELD.Write("_SP.PCIO.SBRG.ECO.CTPM", 40);
# Reading the temperature
int temp1 = 0;
bool _tmp = APCI.FIELD.Read("_SB.PCIO.SBRG.ECO.TPM1", ref temp1)

I'll be honest that I'm over my head on this, but if someone could nudge me in the right direction I'd be very grateful!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

落日海湾 2024-09-07 03:45:21

Michal Kottman 创建了一个内核模块,允许您执行此类 ACPI 命令。它旨在调用命令来切换视频卡,但也可用于其他目的。它可以从Github获得,安装说明如下:

  1. 安装与当前内核匹配的内核头
  2. 获取源代码并构建它

    git 克隆 git://github.com/mkottman/acpi_call.git
    cd acpi_call
    制作
    
  3. 加载模块:

    <代码>/sbin/insmod acpi_call.ko
    

    如果一切顺利,您现在应该有一个 /proc/acpi/call “文件”。

  4. 要执行命令,请将其写入/proc/acpi/call。我猜您输入了 _SP 错误,因此将其替换为 \_SB

    echo '\_SB.PCIO.SBRG.ECO.CTPM' > /proc/acpi/调用
    
  5. 要获取此命令的结果,请检查您的内核日志 (dmesg)或读取结果:

    cat /proc/acpi/call
    

    读取后,该值将被清除,因此如果您想稍后重新使用它,请务必将输出保存在某个地方。

Michal Kottman created a kernel module which allows you to execute such ACPI commands. It was designed for calling commands to toggle video cards, but can be used for other purposed as well. It's available from Github, installation instructions below:

  1. Install the kernel headers matching the current kernel
  2. Get the source and build it

    git clone git://github.com/mkottman/acpi_call.git
    cd acpi_call
    make
    
  3. Load the module:

    /sbin/insmod acpi_call.ko
    

    If everything went well, you should now have a /proc/acpi/call "file".

  4. To execute a command, write it to /proc/acpi/call. I guess you made a typo with _SP and therefore replaced it by \_SB:

    echo '\_SB.PCIO.SBRG.ECO.CTPM' > /proc/acpi/call
    
  5. To get the result of this command, check your kernel log (dmesg) or read the result:

    cat /proc/acpi/call
    

    After reading it, the value will be cleared so be sure to save the output somewhere if you want to re-use it later.

清引 2024-09-07 03:45:21

不确定这是否正是您想要的,但是您是否研究过 lm_sensors
它们支持使用内核驱动程序进行硬件监控,但提供用户空间库。

Not sure if it's exactly what you are wanting, but have you looked into lm_sensors?
They support hw monoriting with kernel drivers, but provide a user space library.

我是男神闪亮亮 2024-09-07 03:45:21

Reflector 表示 NHC.exe 是一个托管程序集,它包含提供以下功能的类: ACPI.FIELD.Write()ACPI.FIELD.Read() 等等。 NHC 的作者在 chm 文件中描述了如何编写自己的类,其中包括对特定硬件类型(例如插件模型)的调用。

不过,您可以将实际的 C# 代码放入一个特殊的文件夹中,而不是放入 .DLL 中。显然,当 nhc.exe 启动时,nhc.exe 会动态编译并运行此代码。如果所有这些都是正确的,您应该能够编写自己的应用程序,使用 ACPI.FIELD.ReadWrite 调用,将其编译为 exe,指定 nhc .exe作为参考。

但更糟糕的是,nhc.exe 被混淆了,所有这些类都不可见。因此,您不能简单地运行csc.exe并引用nhc.exe。我不确定,但在我看来,只能在 nhc.exe 的上下文中运行该代码,它会进行特殊的编译来处理它。

另一个坏消息是 NHC 的开发似乎已经停止了;论坛网站已经死了,最后一次更新是2007年。

Reflector says that NHC.exe is a managed assembly, and it contains the classes that provide ACPI.FIELD.Write() and ACPI.FIELD.Read() and so on. The author of NHC has described, in the chm file, how to author your own classes that include calls to those things, for specific hardware types, something like a plugin model.

Rather than dropping in a .DLL, though, you drop in the actual C# code into a special folder; apparently nhc.exe dynamically compiles and runs this code when nhc.exe starts. If all of that is true, you should be able to write your own app that uses ACPI.FIELD.Read and Write calls, compile it into an exe, specifying the nhc.exe as a reference.

The kicker though, is that nhc.exe is obfuscated, and all those classes are not visible. So you cannot simply run csc.exe and reference nhc.exe. I don't know for sure, but it seems to me that It's only possible to run that code within the context of nhc.exe, which does a special compile to handle it.

The other bad news is that NHC development seems to have ceased; the forum website is dead, and the last update was from 2007.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文