English 中文(简体)
Setting an ACPI field in Linux
原标题:
  • 时间:2010-05-03 16:08:54
  •  标签:
  • linux
  • acpi

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!

问题回答

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.

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.

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.





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签