You can find information on sysfs under /sys/class/power_supply/. For example the Apple Wireless Keyboard is under /sys/class/power_supply/hid-78:CA:39:4E:6F:C7-battery/. In the device directory there is a file named capacity, this is a capacity in percents.

So in summary, for reading Apple Wireless Keyboard battery capacity you should do:

chronos@localhost ~ $ cat /sys/class/power_supply/hid-78:CA:39:4E:6F:C7-battery/capacity

Note that hid-78:CA:39:4E:6F:C7-battery can be different for your device.


其实 /sys/class/power_supply/ 下不止是蓝牙设备,还包含所有实现了标准电源信息的设备;而有一些像蓝牙音箱之类的设备是不支持电源信息的。