Advertisement
Guest User

NHC - Lenovo N200 0769 BNG - Lenovo.cs

a guest
Dec 6th, 2015
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 9.87 KB | None | 0 0
  1. //
  2. //  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3. //  N o t e b o o k   H a r d w a r e   C o n t r o l   A C P I   D L L
  4. //  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5. //
  6. //
  7. //  This file is provided "as is" with no expressed or implied warranty.
  8. //  The authors accepts no liability for any damage/loss of business that
  9. //  this product may cause.
  10. //
  11. //
  12.  
  13. public static class Lenovo
  14. {
  15.  
  16.    #region Notebook Lenovo : class N200
  17.     //
  18.     // class author: Daniel Albers (Kontakt: www.P35-Forum.de "Hallo32") mit der Unterstützung von Yardi & ilikedirt (bei @ www.p35-forum.de)
  19.     //
  20.     //Version 1.0 (erste Final Version)
  21.     //Modified for Lenovo N200 by AndySeven Version 0.21 http://www.thinkpad-forum.de/thread.php?threadid=33888
  22.  
  23.  public  class N200  
  24.  
  25.  {
  26.    
  27.     #region Thermal Zone class for CPU Temperature : class THRM
  28.         //
  29.         public static class THRM                                                    // If the name of the Thermal Zone class is the same as the name of an existing thermal zone in the system then NHC will overwrite the system thermal zone
  30.         {
  31.            
  32.        
  33.                                                                                     // Info
  34.             public const string description = "CPU Temperature";                    // Description of current class
  35.             public const bool default_enable = true;                                // false = By default the current class is disabled in NHC
  36.             public const int icon = 5;                                              // 0 = Hardware icon, 1 = Brightness icon, 2 = Fan icon, 3 = Battery icon, 4 = Audio icon, 5 = Temperature icon
  37.             public const bool thermal_zone = true;                                  // NHC will interpret this class as a Thermal Zone zone class if this value is true                    
  38.  
  39.             #region Value class for _TZ : class _TZ
  40.             //
  41.             public static class _TZ
  42.             {
  43.                 // Properties of the value class
  44.                 public const string description = "Thermal Zone";                   // Description of current value
  45.                 public const bool nhc_visible = true;                               // true -> value is visible in NHC
  46.  
  47.                                                                                     // Value                
  48.                 public static int _tz = 0;                                          // It must have the same name as the class (case are ignored)
  49.                 public static int fan_on_modus = 0;
  50.                 public const string unit = "°C";                                    // unit of the example_value class.                
  51.             }
  52.             //
  53.             #endregion
  54.  
  55.            
  56.             public const int refresh_interval=1;                                    // Highspeed Fkt führt zu Fehlern, evtl. sehr langsamer EC
  57.             public static bool refresh()
  58.             {
  59.                 int max_temp=0;
  60.                 int cache1 = 0;
  61.                 int cache2 = 0;
  62.                 int cache3 = 0;
  63.  
  64.                 if(ACPI.FIELD.ReadByOffset("_SB.PCI0.LPCB.EC0.ERAM", ref cache1, 0xB0, 8)==false) {return false;}
  65.                 if(ACPI.FIELD.ReadByOffset("_SB.PCI0.LPCB.EC0.ERAM", ref cache2, 0xB1, 8)==false) {return false;}
  66.                 if(ACPI.FIELD.ReadByOffset("_SB.PCI0.LPCB.EC0.ERAM", ref cache3, 0xB5, 8) == false) { return false; }
  67.  
  68.                 max_temp = cache1;
  69.                 if (cache2 > max_temp)
  70.                 {
  71.                     max_temp = cache2;
  72.                 }
  73.                 if (cache3 > max_temp)
  74.                 {
  75.                     max_temp = cache3;
  76.                 }
  77.                
  78.                 //if(ACPI.FIELD.ReadByOffset("_SB.PCI0.LPCB.EC0.ERAM", ref cache, 176, 8)==false) {return false;}     // get TZ temperature
  79.  
  80.                 if (cache1 != 45 && cache1 != 51 && cache1 != 61)
  81.                 {
  82.                     _TZ._tz = cache1;
  83.                 }
  84.  
  85.  
  86.                 if ((_TZ._tz <= FAN_CONFIG.FAN_ON_TEMP_MINIMUM.fan_on_temp_minimum) || _TZ.fan_on_modus == 0)
  87.                
  88.                 {  
  89.                     if (ACPI.FIELD.WriteByOffset("_SB.PCI0.LPCB.EC0.ERAM", 45, 181, 8)==false) {return false;}
  90.                     if (ACPI.FIELD.WriteByOffset("_SB.PCI0.LPCB.EC0.ERAM", 45, 177, 8)==false) {return false;}
  91.                     if (ACPI.FIELD.WriteByOffset("_SB.PCI0.LPCB.EC0.ERAM", 45, 176, 8)==false) {return false;}
  92.                     _TZ.fan_on_modus = 0;
  93.                  }
  94.  
  95.  
  96.                 if ((_TZ._tz > FAN_CONFIG.FAN_ON_TEMP.fan_on_temp && _TZ._tz <= FAN_CONFIG.FAN_ON_TEMP.fan_on_temp + 5) || _TZ.fan_on_modus == 1)
  97.                  {
  98.                      if (ACPI.FIELD.WriteByOffset("_SB.PCI0.LPCB.EC0.ERAM", 51, 181, 8) == false) { return false; }
  99.                      if (ACPI.FIELD.WriteByOffset("_SB.PCI0.LPCB.EC0.ERAM", 51, 177, 8) == false) { return false; }
  100.                      if (ACPI.FIELD.WriteByOffset("_SB.PCI0.LPCB.EC0.ERAM", 51, 176, 8) == false) { return false; }
  101.                      _TZ.fan_on_modus = 1;
  102.                  }
  103.  
  104.                 if ((_TZ._tz > FAN_CONFIG.FAN_ON_TEMP.fan_on_temp + 5 && _TZ._tz<=70)|| _TZ.fan_on_modus == 2)
  105.                
  106.                 {  
  107.                     if (ACPI.FIELD.WriteByOffset("_SB.PCI0.LPCB.EC0.ERAM", 61, 181, 8)==false) {return false;}
  108.                     if (ACPI.FIELD.WriteByOffset("_SB.PCI0.LPCB.EC0.ERAM", 61, 177, 8)==false) {return false;}
  109.                     if (ACPI.FIELD.WriteByOffset("_SB.PCI0.LPCB.EC0.ERAM", 61, 176, 8)==false) {return false;}
  110.                     _TZ.fan_on_modus = 2;
  111.                 }
  112.                 if ((_TZ._tz > 70 && _TZ._tz 80) || _TZ.fan_on_modus == 3)
  113.                 {
  114.                     if (ACPI.FIELD.WriteByOffset("_SB.PCI0.LPCB.EC0.ERAM", 70, 181, 8) == false) { return false; }
  115.                     if (ACPI.FIELD.WriteByOffset("_SB.PCI0.LPCB.EC0.ERAM", 70, 177, 8) == false) { return false; }
  116.                     if (ACPI.FIELD.WriteByOffset("_SB.PCI0.LPCB.EC0.ERAM", 70, 176, 8) == false) { return false; }
  117.                     _TZ.fan_on_modus = 3;
  118.                 }
  119.                 if (_TZ._tz >= 80)
  120.                 {
  121.                     if (ACPI.FIELD.WriteByOffset("_SB.PCI0.LPCB.EC0.ERAM", 90, 181, 8) == false) { return false; }
  122.                     if (ACPI.FIELD.WriteByOffset("_SB.PCI0.LPCB.EC0.ERAM", 90, 177, 8) == false) { return false; }
  123.                     if (ACPI.FIELD.WriteByOffset("_SB.PCI0.LPCB.EC0.ERAM", 90, 176, 8) == false) { return false; }
  124.                     _TZ.fan_on_modus = 4;
  125.                 }
  126.                                      
  127.                 return true;
  128.             }
  129.         }
  130.         //
  131.     #endregion
  132.            
  133.     #region
  134.     public static class FAN_CONFIG
  135.         {
  136.             // Info
  137.             public const string description = "FAN Config";                         // Description of current class
  138.             public const bool default_enable = true;                                // false = By default the current class is disabled in NHC
  139.             public const int icon = 2;                                              // 0 = Hardware icon, 1 = Brightness icon, 2 = Fan icon, 3 = Battery icon, 4 = Audio icon, 5 = Temperature icon
  140.                                  
  141.             #region Value class for FAN_ON_TEMP : class FAN_ON_TEMP
  142.             //
  143.             public static class FAN_ON_TEMP
  144.             {
  145.                                                                                     // Properties of the value class
  146.                 public const string description = "FAN ON Temperature";             // Description of current value
  147.                 public const bool nhc_visible = true;                               // true -> value is visible in NHC
  148.  
  149.                                                                                     // Value
  150.                 public static int fan_on_temp = 1;                                  // It must have the same name as the class (case are ignored)
  151.                 public const string unit = "°C";                                    // unit of value
  152.  
  153.                                                                                     // With this class it is possible to change the value in NHC on runtime
  154.                  public static class NHC_WRITE
  155.                 {
  156.                     public const bool nhc_write = true;                             // true -> it is possible to change the value in NHC
  157.                     public const int nhc_minimum_value = 45;                        // the minimum value
  158.                     public const int nhc_maximum_value = 65;                        // the maximum value 65 +5 = 70°
  159.                     public const int nhc_default_value = 57;                        // the default value
  160.                                    
  161.                 }
  162.             }
  163.  
  164.             public static class FAN_ON_TEMP_MINIMUM
  165.             {
  166.                 // Properties of the value class
  167.                 public const string description = "FAN OFF Temperature";                // Description of current value
  168.                 public const bool nhc_visible = true;                               // true -> value is visible in NHC
  169.  
  170.                 // Value
  171.                 public static int fan_on_temp_minimum = 1;                                  // It must have the same name as the class (case are ignored)
  172.                 public const string unit = "°C";                                    // unit of value
  173.  
  174.                 // With this class it is possible to change the value in NHC on runtime
  175.                 public static class NHC_WRITE
  176.                 {
  177.                     public const bool nhc_write = true;                             // true -> it is possible to change the value in NHC
  178.                     public const int nhc_minimum_value = 30;                        // the minimum value
  179.                     public const int nhc_maximum_value = 62;                        // the maximum value
  180.                     public const int nhc_default_value = 50;                        // the default value
  181.  
  182.                 }
  183.             }
  184.             //
  185.             #endregion
  186.     }
  187.     //
  188.     #endregion
  189. }
  190.  #endregion
  191. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement