Home » U++ Library support » U++ Core » LoadFile("/sys/devices/virtual/thermal/ ...") does not work
LoadFile("/sys/devices/virtual/thermal/ ...") does not work [message #58259] |
Wed, 06 April 2022 12:29  |
Tom1
Messages: 1301 Registered: March 2007
|
Ultimate Contributor |
|
|
Hi,
I attempted to read Raspberry Pi 4 SoC temperature with the below code. For some reason using LoadFile does not work:
double GetRaspberryPiTemperature(){
String result = LoadFile("/sys/devices/virtual/thermal/thermal_zone0/temp");
if(!result.IsEmpty()) return 0.001*ScanDouble(~result);
return -55.0;
}
So I had to revert using FILE and fgets instead:
double GetRaspberryPiTemperature(){
FILE *in=fopen("/sys/devices/virtual/thermal/thermal_zone0/temp","rb");
char s[8];
if(fgets(s,8,in)) return 0.001*ScanDouble(s);
return -55.0;
}
Is this expected or is this a bug?
Best regards,
Tom
|
|
|
 |
|
LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: Tom1 on Wed, 06 April 2022 12:29
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: mirek on Fri, 08 April 2022 16:11
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: Tom1 on Tue, 12 April 2022 08:54
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: Tom1 on Tue, 12 April 2022 14:46
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: Tom1 on Wed, 13 April 2022 09:13
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: Tom1 on Wed, 13 April 2022 14:44
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: mirek on Wed, 13 April 2022 17:39
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: Tom1 on Wed, 13 April 2022 18:45
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: Tom1 on Wed, 13 April 2022 20:33
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: mirek on Mon, 16 May 2022 10:48
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: Tom1 on Wed, 18 May 2022 09:05
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: mirek on Wed, 18 May 2022 09:58
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: Tom1 on Wed, 18 May 2022 10:15
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: Tom1 on Wed, 18 May 2022 10:26
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: mirek on Wed, 18 May 2022 10:29
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: Tom1 on Wed, 18 May 2022 10:36
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: pvictor on Wed, 18 May 2022 10:50
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: mirek on Wed, 18 May 2022 10:58
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: Tom1 on Wed, 18 May 2022 10:47
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: mirek on Wed, 18 May 2022 11:04
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: Tom1 on Wed, 18 May 2022 11:10
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: mirek on Thu, 19 May 2022 10:33
|
 |
|
Re: LoadFile("/sys/devices/virtual/thermal/ ...") does not work
By: Tom1 on Thu, 19 May 2022 11:04
|
Goto Forum:
Current Time: Thu Apr 24 18:29:55 CEST 2025
Total time taken to generate the page: 0.03532 seconds
|