Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 116661
Collapse All | Expand All

(-)src/i8ksensorslist.cpp.orig (-7 / +86 lines)
Lines 65-71 Link Here
65
	rightFan->readConfig();
65
	rightFan->readConfig();
66
  }
66
  }
67
67
68
  if ( (acpiAvail=(AcpiAvailable()==0)) )
68
  if (ibmAcpiAvail=(IbmAcpiAvailable()==0))
69
  {
70
	cpuTempAcpiIbm= new Sensor(this);
71
	cpuTempAcpiIbm->setType(Sensor::lmTemp);
72
	cpuTempAcpiIbm->setName("cputemp");
73
	cpuTempAcpiIbm->setDescription("CPU Temp");
74
	cpuTempAcpiIbm->setValueMax  (80 , Sensor::dgCelsius);
75
	cpuTempAcpiIbm->setValueMin  ( 0 , Sensor::dgCelsius);
76
	cpuTempAcpiIbm->setValueIdeal(30 , Sensor::dgCelsius);
77
	cpuTempAcpiIbm->setValue     ( 0 , Sensor::dgCelsius);
78
	cpuTempAcpiIbm->readConfig();
79
80
	pciTempAcpiIbm= new Sensor(this);
81
	pciTempAcpiIbm->setType(Sensor::lmTemp);
82
	pciTempAcpiIbm->setName("pictmp");
83
	pciTempAcpiIbm->setDescription("Mini PCI Temp");
84
	pciTempAcpiIbm->setValueMax  (55 , Sensor::dgCelsius);
85
	pciTempAcpiIbm->setValueMin  ( 0 , Sensor::dgCelsius);
86
	pciTempAcpiIbm->setValueIdeal(25 , Sensor::dgCelsius);
87
	pciTempAcpiIbm->setValue     ( 0 , Sensor::dgCelsius);
88
	pciTempAcpiIbm->readConfig();
89
90
	hddTempAcpiIbm= new Sensor(this);
91
	hddTempAcpiIbm->setType(Sensor::lmTemp);
92
	hddTempAcpiIbm->setName("hddtmp");
93
	hddTempAcpiIbm->setDescription("HDD Temp");
94
	hddTempAcpiIbm->setValueMax  (40 , Sensor::dgCelsius);
95
	hddTempAcpiIbm->setValueMin  ( 0 , Sensor::dgCelsius);
96
	hddTempAcpiIbm->setValueIdeal(20 , Sensor::dgCelsius);
97
	hddTempAcpiIbm->setValue     ( 0 , Sensor::dgCelsius);
98
	hddTempAcpiIbm->readConfig();
99
100
	gpuTempAcpiIbm= new Sensor(this);
101
	gpuTempAcpiIbm->setType(Sensor::lmTemp);
102
	gpuTempAcpiIbm->setName("gputmp");
103
	gpuTempAcpiIbm->setDescription("GPU Temp");
104
	gpuTempAcpiIbm->setValueMax  (60 , Sensor::dgCelsius);
105
	gpuTempAcpiIbm->setValueMin  ( 0 , Sensor::dgCelsius);
106
	gpuTempAcpiIbm->setValueIdeal(25 , Sensor::dgCelsius);
107
	gpuTempAcpiIbm->setValue     ( 0 , Sensor::dgCelsius);
108
	gpuTempAcpiIbm->readConfig();
109
110
	bat0TempAcpiIbm= new Sensor(this);
111
	bat0TempAcpiIbm->setType(Sensor::lmTemp);
112
	bat0TempAcpiIbm->setName("bat0tmp");
113
	bat0TempAcpiIbm->setDescription("BAT0 Temp");
114
	bat0TempAcpiIbm->setValueMax  (40 , Sensor::dgCelsius);
115
	bat0TempAcpiIbm->setValueMin  ( 0 , Sensor::dgCelsius);
116
	bat0TempAcpiIbm->setValueIdeal(30 , Sensor::dgCelsius);
117
	bat0TempAcpiIbm->setValue     ( 0 , Sensor::dgCelsius);
118
	bat0TempAcpiIbm->readConfig();
119
120
	bat1TempAcpiIbm= new Sensor(this);
121
	bat1TempAcpiIbm->setType(Sensor::lmTemp);
122
	bat1TempAcpiIbm->setName("bat1tmp");
123
	bat1TempAcpiIbm->setDescription("BAT1 Temp");
124
	bat1TempAcpiIbm->setValueMax  (40 , Sensor::dgCelsius);
125
	bat1TempAcpiIbm->setValueMin  ( 0 , Sensor::dgCelsius);
126
	bat1TempAcpiIbm->setValueIdeal(30 , Sensor::dgCelsius);
127
	bat1TempAcpiIbm->setValue     ( 0 , Sensor::dgCelsius);
128
	bat1TempAcpiIbm->readConfig();
129
  }
130
131
  if ( (!ibmAcpiAvail) && (acpiAvail=(AcpiAvailable()==0)) )
69
  {
132
  {
70
	cpuTempAcpi= new Sensor(this);
133
	cpuTempAcpi= new Sensor(this);
71
	cpuTempAcpi->setType(Sensor::lmTemp);
134
	cpuTempAcpi->setType(Sensor::lmTemp);
Lines 77-111 Link Here
77
	cpuTempAcpi->setValue     (30 , Sensor::dgCelsius);
140
	cpuTempAcpi->setValue     (30 , Sensor::dgCelsius);
78
	cpuTempAcpi->readConfig();
141
	cpuTempAcpi->readConfig();
79
  }
142
  }
80
81
  updateSensors();
143
  updateSensors();
82
}
144
}
83
145
84
I8KSensorsList::~I8KSensorsList(){
146
I8KSensorsList::~I8KSensorsList(){
85
}
147
}
86
148
87
88
void I8KSensorsList::updateSensors()
149
void I8KSensorsList::updateSensors()
89
{
150
{
90
double t,f1,f2;
151
double t,f1,f2, ct,pt,ht,gt,bt0,na0,bt1,na1;
91
152
92
  if(i8kAvail && !getI8KInfo(&t,&f1,&f2)) {
153
  if(i8kAvail && !getI8KInfo(&t,&f1,&f2)) {
93
    cpuTemp->setValue(t,Sensor::dgCelsius);
154
    cpuTemp->setValue(t,Sensor::dgCelsius);
94
    leftFan->setValue(f1);
155
    leftFan->setValue(f1);
95
    rightFan->setValue(f2);
156
    rightFan->setValue(f2);
96
  }
157
  }
97
  if(acpiAvail && !getAcpiTemperature(&t)) {
158
159
  if(ibmAcpiAvail && !getIbmAcpiTemperature(&ct,&pt,&ht,&gt,&bt0,&na0,&bt1,&na1)) {
160
    cpuTempAcpiIbm->setValue(ct,Sensor::dgCelsius);
161
    pciTempAcpiIbm->setValue(pt,Sensor::dgCelsius);
162
    hddTempAcpiIbm->setValue(ht,Sensor::dgCelsius);
163
    gpuTempAcpiIbm->setValue(gt,Sensor::dgCelsius);
164
    bat0TempAcpiIbm->setValue(bt0,Sensor::dgCelsius);
165
    bat1TempAcpiIbm->setValue(bt1,Sensor::dgCelsius);
166
  }
167
168
  if(!ibmAcpiAvail && acpiAvail && !getAcpiTemperature(&t)) {
98
    cpuTempAcpi->setValue(t,Sensor::dgCelsius);
169
    cpuTempAcpi->setValue(t,Sensor::dgCelsius);
99
  }
170
  }
100
}
101
171
172
}
102
173
103
int I8KSensorsList::AcpiAvailable()
174
int I8KSensorsList::AcpiAvailable()
104
{
175
{
105
 double t;
176
 double t;
177
106
 return  getAcpiTemperature(&t);
178
 return  getAcpiTemperature(&t);
107
}
179
}
108
180
181
int I8KSensorsList::IbmAcpiAvailable()
182
{
183
 double t0,t1,t2,t3,t4,t5,t6,t7;
184
185
 return  getIbmAcpiTemperature(&t0,&t1,&t2,&t3,&t4,&t5,&t6,&t7);
186
}
187
109
int I8KSensorsList::I8KOnlyAvailable()
188
int I8KSensorsList::I8KOnlyAvailable()
110
{
189
{
111
double d1,d2,d3;
190
double d1,d2,d3;
Lines 122-128 Link Here
122
  case -3: qWarning("I18K Warning: Only format version 1.0 is supported. Inform the author.");         break;
201
  case -3: qWarning("I18K Warning: Only format version 1.0 is supported. Inform the author.");         break;
123
 }
202
 }
124
203
125
 return (result==0 ||  AcpiAvailable()==0);
204
 return (result==0 ||  AcpiAvailable()==0 ||  IbmAcpiAvailable()==0);
126
}
205
}
127
206
128
207
(-)src/i8ksensorslist.h.orig (+12 lines)
Lines 42-54 Link Here
42
42
43
  bool i8kAvail;
43
  bool i8kAvail;
44
  bool acpiAvail;
44
  bool acpiAvail;
45
  bool ibmAcpiAvail;
45
46
46
  Sensor *cpuTempAcpi;
47
  Sensor *cpuTempAcpi;
48
49
  Sensor *cpuTempAcpiIbm;
50
  Sensor *pciTempAcpiIbm;
51
  Sensor *hddTempAcpiIbm;
52
  Sensor *gpuTempAcpiIbm;
53
  Sensor *bat0TempAcpiIbm;
54
  Sensor *na0TempAcpiIbm;
55
  Sensor *bat1TempAcpiIbm;
56
  Sensor *na1TempAcpiIbm;
57
47
  Sensor *cpuTemp;
58
  Sensor *cpuTemp;
48
  Sensor *leftFan;
59
  Sensor *leftFan;
49
  Sensor *rightFan;
60
  Sensor *rightFan;
50
61
51
  static int AcpiAvailable();
62
  static int AcpiAvailable();
63
  static int IbmAcpiAvailable();
52
  static int I8KOnlyAvailable();
64
  static int I8KOnlyAvailable();
53
};
65
};
(-)src/procinfo.cpp.orig (-2 / +20 lines)
Lines 84-90 Link Here
84
{
84
{
85
char buf[128];
85
char buf[128];
86
86
87
    if(read_file("/proc/acpi/thermal_zone/THRM/temperature", buf, sizeof(buf))<= 0)  return -1;
87
    if((read_file("/proc/acpi/thermal_zone/THRM/temperature", buf, sizeof(buf))<= 0) &&
88
     (read_file("/proc/acpi/thermal_zone/THM0/temperature", buf, sizeof(buf))<= 0)) return -1;
88
89
89
    sscanf(buf, "temperature: %lf C", cpuTemp);
90
    sscanf(buf, "temperature: %lf C", cpuTemp);
90
91
Lines 92-97 Link Here
92
}
93
}
93
94
94
95
96
// ********* IBM Acpi *************************************
97
// cat /proc/acpi/ibm/thermal (ibm_acpi module) if available
98
// temperatures:   46 45 34 48 32 -128 29 -128
99
100
int getIbmAcpiTemperature(double *cpuTemp, double *pciTemp, double *hddTemp, double *gpuTemp,
101
  double *bat0Temp, double *na0Temp, double *bat1Temp, double *na1Temp)
102
{
103
char buf[128];
104
105
    if(read_file("/proc/acpi/ibm/thermal", buf, sizeof(buf))<= 0) return -1;
106
107
    sscanf(buf, "temperatures: %lf %lf %lf %lf %lf %lf %lf %lf", cpuTemp, pciTemp, hddTemp, gpuTemp,
108
      bat0Temp, na0Temp, bat1Temp, na1Temp);
109
110
    return 0;
111
}
112
95
int getMemInfo(int *RamTotal,int *RamUsed,int *SwapTotal, int *SwapUsed)
113
int getMemInfo(int *RamTotal,int *RamUsed,int *SwapTotal, int *SwapUsed)
96
{
114
{
97
char buf[4096];
115
char buf[4096];
Lines 138-144 Link Here
138
156
139
 if(read_file("/proc/stat", buf, sizeof(buf)) <= 0) return false;
157
 if(read_file("/proc/stat", buf, sizeof(buf)) <= 0) return false;
140
158
141
 sscanf(buf, "cpu %u %u %u %u",user,nice,system,idle);
159
 sscanf(buf, "cpu %d %d %d %d",user,nice,system,idle);
142
160
143
 return true;
161
 return true;
144
}
162
}
(-)src/procinfo.h.orig (+2 lines)
Lines 21-23 Link Here
21
int  getUpTime();
21
int  getUpTime();
22
int getI8KInfo(double *cpuTemp,  double *leftFan, double *rightFan);
22
int getI8KInfo(double *cpuTemp,  double *leftFan, double *rightFan);
23
int getAcpiTemperature(double *cpuTemp);
23
int getAcpiTemperature(double *cpuTemp);
24
int getIbmAcpiTemperature(double *cpuTemp, double *pciTemp, double *hddTemp, double *gpuTemp,
25
  double *bat0Temp, double *na0Temp, double *bat1Temp, double *na1Temp);

Return to bug 116661