4

不使用第三方工具查看笔记本的电量还剩多少

 3 years ago
source link: https://www.lujun9972.win/blog/2018/08/14/%E4%B8%8D%E4%BD%BF%E7%94%A8%E7%AC%AC%E4%B8%89%E6%96%B9%E5%B7%A5%E5%85%B7%E6%9F%A5%E7%9C%8B%E7%AC%94%E8%AE%B0%E6%9C%AC%E7%9A%84%E7%94%B5%E9%87%8F%E8%BF%98%E5%89%A9%E5%A4%9A%E5%B0%91/index.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

不使用第三方工具查看笔记本的电量还剩多少

电池电量信息,通常的方式是内核通过sysfs导出信息和控制接口.

这个接口是平台不相关的,因此我们可以通过查看 /sys/class/power_supply/ 下内容的方式来查看电池相关信息,比如

比如,下面命令可以查到电池的剩余容量为97%

cat /sys/class/power_supply/BAT0/capacity
97

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK