过几天要坐飞机,忽然意识到笔记本电池可能会形成麻烦。充电宝容量太大的,不要说随身携带,托运也免谈。找到的信息说,笔记本电脑的电池不得超过160Wh。个人笔记本电脑的电池是多大呢?拆下来确定能看到,不过,我不想拆,便找一找是否有命令行能够在系统内查看。图形界面的电池管理,不过是让咱们看看电池是否是充满电,如今的电量是多少,以及一些其它的诸如屏幕显示的模式设置,没有详细的技术参数。bash
找了不少介绍查看的方法,都不合用。不过,在CentOS上,apci命令是没有的,tlp-stat命令也是没有的,yum中也找不到。命令行
还真找到了——upower!不少文章都说要upower -i /org/.....,系统中根本没有这个目录。因而upower --help,找一下帮助。看到有个参数d,说能把全部信息都倒出来。设计
# upower --help Usage: upower [OPTION…] UPower tool Help Options: -h, --help Show help options Application Options: -e, --enumerate Enumerate objects paths for devices -d, --dump Dump all parameters for all objects -w, --wakeups Get the wakeup data -m, --monitor Monitor activity from the power daemon --monitor-detail Monitor with detail -i, --show-info Show information about object path -v, --version Print version of client and daemon
那就试试呗,运行命令:upower -dcode
[root@hp-notebook-alan ~]# upower -d Device: /org/freedesktop/UPower/devices/line_power_ACAD native-path: ACAD power supply: yes updated: 2019年10月29日 星期二 08时44分57秒 (28901 seconds ago) has history: no has statistics: no line-power warning-level: none online: yes icon-name: 'ac-adapter-symbolic' Device: /org/freedesktop/UPower/devices/battery_BAT1 native-path: BAT1 vendor: Hewlett-Packard model: PABAS0241231 serial: 41167 power supply: yes updated: 2019年10月29日 星期二 16时45分18秒 (80 seconds ago) has history: yes has statistics: yes battery present: yes rechargeable: yes state: fully-charged warning-level: none energy: 67.5598 Wh energy-empty: 0 Wh energy-full: 67.8524 Wh energy-full-design: 70.07 Wh energy-rate: 0 W voltage: 17.524 V percentage: 100% capacity: 96.1758% technology: lithium-ion icon-name: 'battery-full-charged-symbolic' Device: /org/freedesktop/UPower/devices/DisplayDevice power supply: yes updated: 2019年10月29日 星期二 15时05分14秒 (6084 seconds ago) has history: no has statistics: no battery present: yes state: fully-charged warning-level: none energy: 67.5598 Wh energy-full: 67.8524 Wh energy-rate: 0 W percentage: 100% icon-name: 'battery-full-charged-symbolic' Daemon: daemon-version: 0.99.7 on-battery: no lid-is-closed: no lid-is-present: yes critical-action: HybridSleep
看到了,电池设计容量是70.07Wh,如今已经100%充满,是 67.8524 Wh。1000Wh,就是一度电,这个只有0.0678524度电,应该是人畜无害吧。orm
竟然真的有个叫/org/freedesktop/UPower/devices/DisplayDevice的设备,不过在文件系统里看不到。再来试一试:ci
# upower -i /org/freedesktop/UPower/devices/DisplayDevice
嗯,能够使用。也给出了相同的结果。it