Ioreg -r -l -k "BatteryPercent" | grep -i battery any device with this property will be listed you need to know one of target device's property key(-k), for example it is BatteryPercent for Bluetooth keyboard and mouse instead of using device io class, you could also use a property key to query Ioreg -c AppleDeviceManagementHIDEventService -r -l | grep -i battery Ioreg -c AppleDeviceManagementHIDEventService -r -l the -c specify device class, the class could be specific or general by default some object properties are not shown the -l option is used to display properties for all object The solution that works on my computer is: // the -r option is used to reduce output On my iMac(macOS 10.12.6), none of solutions mentioned above works. Still unable to get the battery level from my headphones though, and not sure why :/ I know have a wireless trackpad & keyboard, and can see their battery levels perfectly fine ( in both the toolbar or the command line). I have a feeling batterypercent may only be coded for standard peripherals (trackpad, mouse, keyboard), as all battery monitoring widgets I've tried are only compatible with such devices. The Battery Level can be read using the GATT Read Characteristic Value sub-procedure, so I need to figure out a way of interfacing with this service from the command line. Looking at the Bluetooth docs, it seems there's a Battery Service which exposes the Battery State and Battery Level. Just can't figure out how to access the batterypercent param. Initially I thought the issue was with the device name, but it seems "Powerbeats Wireless" and bluetoothaudiod work interchangeably. How can I check the battery level of my bluetooth connected headphones? This leads me to believe that the device is broadcasting battery level, and that I should be able to access this information from my computer. If I connect the headphones to my iPhone, the battery level immediately pops up on the toolbar. I tried ioreg -c bluetoothaudiod |grep -i battery to get general information about the battery, and get this as a response: | | +-o AppleSmartBatteryManager I tried this command using "Powerbeats Wireless" and "bluetoothaudiod" for the 'deviceName''s, but neither returned the batterypercent. Ioreg -c 'deviceName' |grep -i batterypercent I came across a few discussions, and it seems all I need to do is enter the following: I am trying to check the battery level of my wireless headphones from the command line.
0 Comments
Leave a Reply. |