本文介绍了读取Magic Mouse和Apple Wireless Keyboard电池电量百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问你,是否有人知道在Mac OS中访问鼠标和键盘"电池状态的简单方法.有一些API可以访问此信息?谢谢!

I want to ask you If anybody know a simple way to access Mouse and Keyboard battery state in Mac OS. There are some API to access this information? Thanks!

推荐答案

对于键盘,它是:

ioreg -n "IOAppleBluetoothHIDDriver" | grep -i "batterypercent" | sed 's/[^[:digit:]]//g'

对于魔术鼠标,它是:

ioreg -n "BNBMouseDevice" | grep -i "batterypercent" | sed 's/[^[:digit:]]//g'

这篇关于读取Magic Mouse和Apple Wireless Keyboard电池电量百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:59