如何通过adb命令查看android平台CPU温度、电池温度

1、问题说明:

在进行android系统的功耗和散热性能相关的调试开发时,经常需要关注android设备中各个器件的温度,例如:CPU温度、电池温度、TypeC接口温度等。可按照下文中的方法查看所有“支持温度查询”的器件温度。

2、查看cpu和电池温度方法

adb shell cat /sys/class/thermal/thermal_zone18/type
cpu-0-0-usr

adb shell cat /sys/class/thermal/thermal_zone18/temp
45900

计算方法是:45900/1000=45.9度

adb shell cat /sys/class/thermal/thermal_zone81/type
battery

adb shell cat /sys/class/thermal/thermal_zone81/type
27200

计算方法是:27200/1000=27.2度

补充说明:上面举例中thermal_zone18和thermal_zone82为作者当前项目中的路径,不同机型实际情况会存在差异。通用方法为,先查到各个thermal_zoneXX文件夹下的type类型,再根据需要读取温度数值

3、其他温度接口查找方法

“/sys/class/thermal”目录下已经对所有温度接口或adc做好封装,此目录下面可以看到每子个目录代表一个温度接口,目录下:type是名字,temp是实际温度

举例如下:

adb root
adb shell

sm6150:/ # 
sm6150:/ # ls /sys/class/thermal/      (查看目录下的温度接口)
cooling_device0   cooling_device18  cooling_device5  thermal_zone13  thermal_zone22  thermal_zone31  thermal_zone40  thermal_zone5   thermal_zone59  thermal_zone68  thermal_zone77
cooling_device1   cooling_device19  cooling_device6  thermal_zone14  thermal_zone23  thermal_zone32  thermal_zone41  thermal_zone50  thermal_zone6   thermal_zone69  thermal_zone78
cooling_device10  cooling_device2   cooling_device7  thermal_zone15  thermal_zone24  thermal_zone33  thermal_zone42  thermal_zone51  thermal_zone60  thermal_zone7   thermal_zone79
cooling_device11  cooling_device20  cooling_device8  thermal_zone16  thermal_zone25  thermal_zone34  thermal_zone43  thermal_zone52  thermal_zone61  thermal_zone70  thermal_zone8
cooling_device12  cooling_device21  cooling_device9  thermal_zone17  thermal_zone26  thermal_zone35  thermal_zone44  thermal_zone53  thermal_zone62  thermal_zone71  thermal_zone80
cooling_device13  cooling_device22  thermal_zone0    thermal_zone18  thermal_zone27  thermal_zone36  thermal_zone45  thermal_zone54  thermal_zone63  thermal_zone72  thermal_zone81
cooling_device14  cooling_device23  thermal_zone1    thermal_zone19  thermal_zone28  thermal_zone37  thermal_zone46  thermal_zone55  thermal_zone64  thermal_zone73  thermal_zone82
cooling_device15  cooling_device24  thermal_zone10   thermal_zone2   thermal_zone29  thermal_zone38  thermal_zone47  thermal_zone56  thermal_zone65  thermal_zone74  thermal_zone9
cooling_device16  cooling_device3   thermal_zone11   thermal_zone20  thermal_zone3   thermal_zone39  thermal_zone48  thermal_zone57  thermal_zone66  thermal_zone75
cooling_device17  cooling_device4   thermal_zone12   thermal_zone21  thermal_zone30  thermal_zone4   thermal_zone49  thermal_zone58  thermal_zone67  thermal_zone76
sm6150:/ # 
sm6150:/ # 

查看温度接口的名字
sm6150:/ # cat /sys/class/thermal/thermal_zone82/type
battery

查看温度接口的实际瞬时温度值
sm6150:/ # cat /sys/class/thermal/thermal_zone82/temp 
28600

28600/1000=28.6度

Android系统中,GKI(Generic Kernel Image)是Google推出的一个概念,目的是为了使内核更加通用,可以在不同的设备上运行,而不需要大量的定制。GKI项目的目的是将通用内核部分与设备特定的内核部分分离,以便更容易地提供内核更新。 要通过adb命令查看Android手机的GKI状态,你可以使用一系列的adb shell命令询系统信息。以下是一些基本的步骤和命令: 1. 首先确保你的Android设备已经开启了USB调试模式,并且你的电脑已经安装了相应的adb工具,并且已经通过USB连接了你的设备。 2. 打开命令行工具,并输入以下命令来检设备是否正确连接: ``` adb devices ``` 如果设备已连接并正确授权,你应该能看到设备的序列号。 3. 接下来,你可以通过adb shell进入设备的shell环境: ``` adb shell ``` 4. 在设备的shell中,你可以使用如下命令来检内核版本和相关信息: ``` uname -a ``` 这个命令会显示当前运行的内核的详细信息。 5. 要查看内核是否支持GKI,可能需要查看内核的配置文件,这通常需要root权限。如果你的设备已经获取root权限,你可以尝试查看如下文件: ``` cat /proc/config.gz | gunzip | less ``` 这里使用gunzip来解压内核配置文件,并用less命令查看。这个配置文件中可能包含与GKI相关的配置选项。 请注意,不同的设备厂商可能会对Android系统进行深度定制,因此并不是所有的设备都能直接显示出GKI的状态。此外,GKI的某些信息可能并不在上述命令中直接体现,而是需要对内核配置和设备的系统框架有深入的理解。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

我叫特踏实

你的鼓励是我创作最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值