Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.
/ Akku Public archive

Experimental bluetooth headset battery monitoring application for MacOS

Notifications You must be signed in to change notification settings

jariz/Akku

Repository files navigation

Akku Build Status

Akku is a tiny battery status monitoring app for headset bluetooth devices.

What does it do?

  • Displays headset battery status, which can't be viewed on macOS at all (only for Apple accessories).
  • (Optionally) notifies you when headset battery gets low.
  • Menu bar icon.

What it doesn't do

  • Display battery status for non-headsets, and/or Apple accessories.
    Those can all be viewed from the regular macOS bluetooth menu.
    Maybe someday. Currently not part of Akku's scope.

Compatibility

It will work with any headset that conforms to the Apple bluetooth spec*

Translation:
If your Android device can read it's battery status, it will very likely work.
If your iPhone device can read your headset's battery status, it will work.


* = You read that correctly, Apple did not bother to implement their own specifications on the Mac.

My device doesn't work!

It's possible that your device doesn't have a battery indication feature, or that it's not supported.
If it works on iPhone / Android: donate me the device and I will ensure it works. (DM me @JariZwarts)

How does it work?

The simple explanation:
You give it root, and it will monitor all bluetooth communication that goes through the system to intercept battery indicator commands.

The hard explanation:
You give it root, and it will install a helper application.
The helper proceeds to communicate to the app through XPC
Once the helper is activated, it will communicate with the IOBluetoothHCIController driver through IOKit
It will map a region of memory from the kernel to Akku, and scan through the raw bluetooth data.
Akku can currently decode HCI events, L2CAP packets and RFCOMM packets (RFCOMM is build upon L2CAP).
Once it has exhausted said bluetooth data, it will poll and instruct the system to dump any new data to Akku's mapped memory every 5 seconds.
The only communication that goes back to the non-privileged process is the normalized battery indication signals.
Both Akku and it's helper verify their signatures to ensure no unauthorized access is made.
Both are codesigned with a valid Apple developer cert.

Inspirations / Shoutouts

  • Jeff Reiner // @mirshko
    Icon Design, moral support 😍
  • SwiftPrivilegedHelper
    Great starting point to implement helper installation & XPC communication, thanks @ekkrik!
  • Android's BluetoothHeadset.java
    Gives some good information on the vendor specific AT commands that Android accepts.
  • Wireshark
    Wouldn't have gotten anywhere with figuring out the raw bluetooth data without wireshark.

About

Experimental bluetooth headset battery monitoring application for MacOS

Resources

Stars

Watchers

Forks

Packages

No packages published