问题
As many of other I am facing the google glass overheating issue. My question is how to detect it in the application?
I was looking through the log but nothing that indicates it expect a message on the screen.
回答1:
Google Glass have (at least) two temperature probes.
One for the battery, and the other for the CPU board.
You can read them as a regular file.
Battery/sys/devices/platform/omap_i2c.1/i2c-1/1-0055/power_supply/bq27520-0/temp
CPU Board/sys/devices/platform/notle_pcb_sensor.0/temperature
But keep in mind that these files may change location as new versions of Google Glass are shipped.
The code (simplified version)
private String readTemperature(String path) throws IOException {
return new BufferedReader(new InputStreamReader(new FileInputStream(new File(path)))).readLine();
}
Interpretation
The values you'll get from these files are in different units.
The CPU Board temperature must be divided by 1000 to get the temperature in °C.
The battery temperature must be divided by 10 to get the temperature in °C.
Logcat
The logcat also gives you the temperatures every minutes or so in a one line log.
You could even parse it:
I/UserEventService(568): [GlassUserEventPerformanceStats ... battery_temperature_milli_centigrade: 34000 board_temperature_milli_centigrade: 44000 ]
Values
From what I've experience, values of the CPU board can go from 25°C to 70°C.
If you go above 70°C, you app or any active app is likely to be killed by the system and you'll see the message "Glass must cool down to run smoothly".
来源:https://stackoverflow.com/questions/28053059/detect-overheating-in-google-glass-programmaticaly