Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Battery Percentage #4

Open
DrJedikiah opened this issue Jun 18, 2021 · 4 comments
Open

[Feature Request] Battery Percentage #4

DrJedikiah opened this issue Jun 18, 2021 · 4 comments
Labels
✨ enhancement New feature or request

Comments

@DrJedikiah
Copy link

I noticed that battery percentage on similar apps are not precise, it's always like 50% 60% not like 58% incrementing by 10.

At first I thought it might be something related to AWDL hardware but my mac os installed laptop which has an intel bluetooth shows the exact precise battery percentage, so it's completely about software.

Do you have any idea how macOS or iOS gathers exact battery info?

@SpriteOvO
Copy link
Owner

SpriteOvO commented Jun 18, 2021

Because the unencrypted part of the BLE advertisement packet broadcast by AirPods seems to contain only battery values in steps of 10% (only 4 bits).

uint8_t curr : 4; // Battery remaining [0, 10], otherwise unavailable
uint8_t anot : 4; // Battery remaining [0, 10], otherwise unavailable
uint8_t caseBox : 4; // Battery remaining [0, 10], otherwise unavailable

As for the units digit, some people think it is faked by iOS or macOS, and I think it is also possible that it is contained in the encrypted part (if it is not a hash), or communicated in some other way.

In the future, I'll try to start a timer when the AirPods battery value changes for the first time and also do a fake units digit value with time, I want it to change in 1% steps, but if it doesn't work well, I might make it change in 5% steps.

If anyone has a better idea or would like to contribute, please feel free to comment here or open a PR.

@SpriteOvO SpriteOvO added ✨ enhancement New feature or request 🌈 good first issue Good for newcomers labels Jun 18, 2021
@DrJedikiah
Copy link
Author

I can ensure you it's not faked. Maybe reversing macOS' IOBluetoothFamily would help but I'm not that familiar with macOS.

@SpriteOvO
Copy link
Owner

SpriteOvO commented Jun 18, 2021

I'm also not familiar with macOS, and I've never even used it, so I have no idea about the reverse of that system :/

@SpriteOvO SpriteOvO removed the 🌈 good first issue Good for newcomers label Nov 15, 2021
@UltimateTanA
Copy link

Yes even i think if you can make the battery info more precise by making the increments of 5 or even 1 if possible
that'd be really nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants