Creating Thinkpad ACPI Control System Class file for NHC
-
jazzaddict
- Posts: 47
- Joined: Thu Aug 04, 2005 3:51 pm
- Location: Melbourne, Australia
Creating Thinkpad ACPI Control System Class file for NHC
Hi Guys,
Is there anyone here with good programming skills with C#? We could write Thinkpad ACPI control system class file for different thinkpad models for the community.
The programming information are here:
http://www.pbus-167.com/nhc/nhc_advance ... rogramming
To get things started:
Programming the ACPI Control System
With the ACPI Control System you can visualize and control and hardware components like LCD brightness, WLAN, notebook temperature or fan of the notebook.
The ACPI Control System is controlled by open source classes with the programming language c#. For each manufacturer and notebook model it is possible to define a new class and adapt it to the notebook hardware easily. The following steps should give you some information how to program the ACPI Control System.
1. Get the System Description Table (DSDT) from your system
All the information in the ACPI Namespace comes from the Differentiated System Description Table (DSDT).
The ACPI Namespace is a hierarchical tree structure in OS-controlled memory that contains named objects. These objects may be data objects, control method objects, bus/device package objects, and so on.
The NHC ACPI Control System allows you to control and change these objects.
Get the System Description Table (DSDT) with the Intel iASL Compiler
You can use the Intel iASL Compiler to obtain the DSDT from your system.
The iASL Compiler command iasl.exe -d will generate this two files containing the DSDT:
- ACPI Machine Language (AML) Pseudo-code for a virtual machine supported by an ACPI-compatible OS and in which ACPI control methods and objects are written.
- ACPI Source Language (ASL) The programming language equivalent for AML. ASL is compiled into AML images.
You need the second ACPI Source Language (ASL) file. In this file you will see all ACPI data objects, control method objects and bus/device packages of the system.
Intel iASL Compiler Download:
http://developer.intel.com/technology/i ... nloads.htm
Is there anyone here with good programming skills with C#? We could write Thinkpad ACPI control system class file for different thinkpad models for the community.
The programming information are here:
http://www.pbus-167.com/nhc/nhc_advance ... rogramming
To get things started:
Programming the ACPI Control System
With the ACPI Control System you can visualize and control and hardware components like LCD brightness, WLAN, notebook temperature or fan of the notebook.
The ACPI Control System is controlled by open source classes with the programming language c#. For each manufacturer and notebook model it is possible to define a new class and adapt it to the notebook hardware easily. The following steps should give you some information how to program the ACPI Control System.
1. Get the System Description Table (DSDT) from your system
All the information in the ACPI Namespace comes from the Differentiated System Description Table (DSDT).
The ACPI Namespace is a hierarchical tree structure in OS-controlled memory that contains named objects. These objects may be data objects, control method objects, bus/device package objects, and so on.
The NHC ACPI Control System allows you to control and change these objects.
Get the System Description Table (DSDT) with the Intel iASL Compiler
You can use the Intel iASL Compiler to obtain the DSDT from your system.
The iASL Compiler command iasl.exe -d will generate this two files containing the DSDT:
- ACPI Machine Language (AML) Pseudo-code for a virtual machine supported by an ACPI-compatible OS and in which ACPI control methods and objects are written.
- ACPI Source Language (ASL) The programming language equivalent for AML. ASL is compiled into AML images.
You need the second ACPI Source Language (ASL) file. In this file you will see all ACPI data objects, control method objects and bus/device packages of the system.
Intel iASL Compiler Download:
http://developer.intel.com/technology/i ... nloads.htm
-
jazzaddict
- Posts: 47
- Joined: Thu Aug 04, 2005 3:51 pm
- Location: Melbourne, Australia
2. Control the ACPI objects listed in the System Description Table (DSDT) with NHC
NHC supports the following functions to control, read and write the objects in the ACPI Namespace:
ACPI Control System Methods
The ACPI Control System supports the following ACPI Methods:
bool ACPI.METHOD.Call (string method);
bool ACPI.METHOD.GetValue (string method, ref int value);
bool ACPI.METHOD.SetValue (string method, int value);
bool ACPI.METHOD.SetValueWithReturn (string method, int value, ref int returnValue);
Example:
bool result = ACPI.METHOD.GetValue ("_SB.ATKD.GPLV", ref int value);
-> Method in the source language file (ASL) ACPI Source Language (ASL)
DefinitionBlock ("DSDT.aml", "DSDT", 1, "INTEL ", "ALVISO ", 100925440)
{
Scope (_SB)
{
Device (ATKD)
{
Method (GPLV, 0, NotSerialized) // <- NHC will call this method
{
Return (LBTN)
}
}
}
}
NHC supports the following functions to control, read and write the objects in the ACPI Namespace:
ACPI Control System Methods
The ACPI Control System supports the following ACPI Methods:
bool ACPI.METHOD.Call (string method);
bool ACPI.METHOD.GetValue (string method, ref int value);
bool ACPI.METHOD.SetValue (string method, int value);
bool ACPI.METHOD.SetValueWithReturn (string method, int value, ref int returnValue);
Example:
bool result = ACPI.METHOD.GetValue ("_SB.ATKD.GPLV", ref int value);
-> Method in the source language file (ASL) ACPI Source Language (ASL)
DefinitionBlock ("DSDT.aml", "DSDT", 1, "INTEL ", "ALVISO ", 100925440)
{
Scope (_SB)
{
Device (ATKD)
{
Method (GPLV, 0, NotSerialized) // <- NHC will call this method
{
Return (LBTN)
}
}
}
}
-
jazzaddict
- Posts: 47
- Joined: Thu Aug 04, 2005 3:51 pm
- Location: Melbourne, Australia
ACPI Control System functions to read and write PACKAGE objects
The ACPI Control System supports the following function to read or write PACKAGE objects:
bool ACPI.PACKAGE.Read (string name, string path, ref int value);
bool ACPI.PACKAGE.Write (string name, string path, int value);
Example:
bool result = ACPI.PACKAGE.Read ("_TZ.CMP0", "PKG[0].PKG[1].PKG[3]", ref int value);
-> Package in the source language file (ASL) ACPI Source Language (ASL)
DefinitionBlock ("DSDT.aml", "DSDT", 1, "INTEL ", "ALVISO ", 100925440)
{
Scope (_TZ)
{
Name (CMP0, Package (0x02)
{
Package (0x02)
{
Package (0x0A)
{
Zero,
0x2D,
0x39,
0x44,
0x54,
0x64,
0x69,
Zero,
0x09,
0x32
},
Package (0x07)
{
Zero,
Zero,
0x23,
0x35, // <- NHC will read the value 0x35
0x3F,
0x51,
0x5E
}
},
...
...
}
}
}
The ACPI Control System supports the following function to read or write PACKAGE objects:
bool ACPI.PACKAGE.Read (string name, string path, ref int value);
bool ACPI.PACKAGE.Write (string name, string path, int value);
Example:
bool result = ACPI.PACKAGE.Read ("_TZ.CMP0", "PKG[0].PKG[1].PKG[3]", ref int value);
-> Package in the source language file (ASL) ACPI Source Language (ASL)
DefinitionBlock ("DSDT.aml", "DSDT", 1, "INTEL ", "ALVISO ", 100925440)
{
Scope (_TZ)
{
Name (CMP0, Package (0x02)
{
Package (0x02)
{
Package (0x0A)
{
Zero,
0x2D,
0x39,
0x44,
0x54,
0x64,
0x69,
Zero,
0x09,
0x32
},
Package (0x07)
{
Zero,
Zero,
0x23,
0x35, // <- NHC will read the value 0x35
0x3F,
0x51,
0x5E
}
},
...
...
}
}
}
-
jazzaddict
- Posts: 47
- Joined: Thu Aug 04, 2005 3:51 pm
- Location: Melbourne, Australia
ACPI Control System functions to read and write BUFFER objects
The ACPI Control System supports the following function to read or write BUFFER objects:
bool ACPI.BUFFER.Read (string name, int index, ref byte value);
bool ACPI.BUFFER.Write (string name, int index, ref byte value);
Example:
bool result = ACPI.BUFFER.Read ("_TZ.FAN3", 3, ref value);
-> Buffer in the source language file (ASL) ACPI Source Language (ASL)
DefinitionBlock ("DSDT.aml", "DSDT", 1, "INTEL ", "ALVISO ", 100925440)
{
Scope (_TZ)
{
Name (FAN3, Buffer (0x07)
{
0x00, 0x00, 0x8E, 0x9E, 0xD2, 0xDC, 0xDC // <- NHC will read the value 0x9E
})
}
}
The ACPI Control System supports the following function to read or write BUFFER objects:
bool ACPI.BUFFER.Read (string name, int index, ref byte value);
bool ACPI.BUFFER.Write (string name, int index, ref byte value);
Example:
bool result = ACPI.BUFFER.Read ("_TZ.FAN3", 3, ref value);
-> Buffer in the source language file (ASL) ACPI Source Language (ASL)
DefinitionBlock ("DSDT.aml", "DSDT", 1, "INTEL ", "ALVISO ", 100925440)
{
Scope (_TZ)
{
Name (FAN3, Buffer (0x07)
{
0x00, 0x00, 0x8E, 0x9E, 0xD2, 0xDC, 0xDC // <- NHC will read the value 0x9E
})
}
}
-
jazzaddict
- Posts: 47
- Joined: Thu Aug 04, 2005 3:51 pm
- Location: Melbourne, Australia
ACPI Control System functions to read and write NAME objects
The ACPI Control System supports the following function to read or write NAME objects:
bool ACPI.NAME.Read (string name, ref int value);
bool ACPI.NAME.Write (string name, ref int value);
Example:
bool result = ACPI.NAME.Read ("_TZ.FANL", ref value);
-> Name in the source language file (ASL) ACPI Source Language (ASL)
DefinitionBlock ("DSDT.aml", "DSDT", 1, "INTEL ", "ALVISO ", 100925440)
{
Scope (_TZ)
{
Name (FANL, 0xB8) // <- NHC will read the value 0xB8
}
}
The ACPI Control System supports the following function to read or write NAME objects:
bool ACPI.NAME.Read (string name, ref int value);
bool ACPI.NAME.Write (string name, ref int value);
Example:
bool result = ACPI.NAME.Read ("_TZ.FANL", ref value);
-> Name in the source language file (ASL) ACPI Source Language (ASL)
DefinitionBlock ("DSDT.aml", "DSDT", 1, "INTEL ", "ALVISO ", 100925440)
{
Scope (_TZ)
{
Name (FANL, 0xB8) // <- NHC will read the value 0xB8
}
}
-
jazzaddict
- Posts: 47
- Joined: Thu Aug 04, 2005 3:51 pm
- Location: Melbourne, Australia
ACPI Control System functions to read and write FIELD objects
The ACPI Control System supports the following function to read or write FIELD objects:
bool ACPI.FIELD.Read (string name, ref int value);
bool ACPI.FIELD.Write (string name, ref int value);
bool ACPI.FIELD.WriteAdvanced (string name, ref int value, string function);
(How use the ACPI.FIELD.WriteAdvanced function)
To write an ACPI Field value NHC needs the body of a ACPI Method.
The ACPI.FIELD.Write() function will use temporally the body of the System Wake (_WAK) control method.
Normally this control method is available on all systems. After the system wakes from a sleeping state, it will invoke the \_WAK method.
On normal operation the system will not invoke this method and NHC can use the body of the \_WAK method without interferes with the system. (after the system wakes from a sleeping state NHC is not running)
If the _WAK method is not available or the body of the _WAK method is too short you can specify with the function ACPI.FIELD.WriteAdvanced() another ACPI method.
For example you can use the \_BFS method. This control method is executed immediately after a wake event.
Probably you can use every ACPI Method because NHC will use the method body only on call of the FIELD function. To be safe NHC will use the \_WAK Method by default.
Example:
bool result = ACPI.FIELD.Read ("OSYS", ref value);
-> Field in the source language file (ASL) ACPI Source Language (ASL)
DefinitionBlock ("DSDT.aml", "DSDT", 1, "INTEL ", "ALVISO ", 100925440)
{
Scope (_TZ)
{
OperationRegion (MNVS, SystemMemory, 0x7FE9DE4C, 0x0100)
Field (MNVS, AnyAcc, Lock, Preserve)
{
OSYS, 16, // <- NHC will read this value
SMIF, 8
PRM0, 8
PRM1, 8
...
...
}
}
}
The ACPI Control System supports the following function to read or write FIELD objects:
bool ACPI.FIELD.Read (string name, ref int value);
bool ACPI.FIELD.Write (string name, ref int value);
bool ACPI.FIELD.WriteAdvanced (string name, ref int value, string function);
(How use the ACPI.FIELD.WriteAdvanced function)
To write an ACPI Field value NHC needs the body of a ACPI Method.
The ACPI.FIELD.Write() function will use temporally the body of the System Wake (_WAK) control method.
Normally this control method is available on all systems. After the system wakes from a sleeping state, it will invoke the \_WAK method.
On normal operation the system will not invoke this method and NHC can use the body of the \_WAK method without interferes with the system. (after the system wakes from a sleeping state NHC is not running)
If the _WAK method is not available or the body of the _WAK method is too short you can specify with the function ACPI.FIELD.WriteAdvanced() another ACPI method.
For example you can use the \_BFS method. This control method is executed immediately after a wake event.
Probably you can use every ACPI Method because NHC will use the method body only on call of the FIELD function. To be safe NHC will use the \_WAK Method by default.
Example:
bool result = ACPI.FIELD.Read ("OSYS", ref value);
-> Field in the source language file (ASL) ACPI Source Language (ASL)
DefinitionBlock ("DSDT.aml", "DSDT", 1, "INTEL ", "ALVISO ", 100925440)
{
Scope (_TZ)
{
OperationRegion (MNVS, SystemMemory, 0x7FE9DE4C, 0x0100)
Field (MNVS, AnyAcc, Lock, Preserve)
{
OSYS, 16, // <- NHC will read this value
SMIF, 8
PRM0, 8
PRM1, 8
...
...
}
}
}
-
jazzaddict
- Posts: 47
- Joined: Thu Aug 04, 2005 3:51 pm
- Location: Melbourne, Australia
3. Write the ACPI Control System source code class for a new system
To use the ACPI Control on systems with different hardware it is necessary to create a new ACPI Control System class for each of this systems.
NHC will distinguish the different systems with the manufacturer name and product (model) name. Each manufacturer has its own ACPI Control System source file. This source files must be saved in the subdirectory "acpi". You will find the "acpi" subdirectory in the NHC program directory.
To use the ACPI Control on systems with different hardware it is necessary to create a new ACPI Control System class for each of this systems.
NHC will distinguish the different systems with the manufacturer name and product (model) name. Each manufacturer has its own ACPI Control System source file. This source files must be saved in the subdirectory "acpi". You will find the "acpi" subdirectory in the NHC program directory.
-
jazzaddict
- Posts: 47
- Joined: Thu Aug 04, 2005 3:51 pm
- Location: Melbourne, Australia
There's some sample files in this directory, the syntax look very much like java. But, alas...i'm no good with programming, I manage to generate the AML file and ASL image. The AML file looks like C to me. Let me know if there's anything I can do to help out if there's anyone interested.jazzaddict wrote:3. Write the ACPI Control System source code class for a new system
To use the ACPI Control on systems with different hardware it is necessary to create a new ACPI Control System class for each of this systems.
NHC will distinguish the different systems with the manufacturer name and product (model) name. Each manufacturer has its own ACPI Control System source file. This source files must be saved in the subdirectory "acpi". You will find the "acpi" subdirectory in the NHC program directory.
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Fan trouble - 3000 N200 + Type 0769 - ESG ACPI Script for NHC > NOTEBOOK HARDWARE CONTROL
by MatMor » Sun Mar 12, 2017 12:12 pm » in 3000 Series Laptops - 0 Replies
- 2587 Views
-
Last post by MatMor
Sun Mar 12, 2017 12:12 pm
-
-
-
T450 - Brightness control hotkeys not working after system wake
by Czechnology » Tue Jan 10, 2017 9:05 am » in ThinkPad T430/T530 and later Series - 0 Replies
- 415 Views
-
Last post by Czechnology
Tue Jan 10, 2017 9:05 am
-
-
- 4 Replies
- 1429 Views
-
Last post by kfzhu1229
Thu Feb 09, 2017 6:38 pm
-
-
Hard Drive won't boot and external USB Hard Drive enclosure/caddy/adapter for file retrieval
by E350 » Thu Apr 06, 2017 11:38 am » in ThinkPad T6x Series - 5 Replies
- 906 Views
-
Last post by axur-delmeria
Thu Apr 06, 2017 9:43 pm
-
Who is online
Users browsing this forum: No registered users and 0 guests



