[PR #84] [MERGED] [Linux] Add Battery Class and Fix Battery Level Assignment #269

Closed
opened 2026-03-02 12:40:23 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kavishdevar/librepods/pull/84
Author: @tim-gromeyer
Created: 3/25/2025
Status: Merged
Merged: 3/26/2025
Merged by: @kavishdevar

Base: mainHead: linux-battery-class


📝 Commits (2)

📊 Changes

4 files changed (+167 additions, -26 deletions)

View changed files

📝 linux/CMakeLists.txt (+1 -0)
📝 linux/airpods_packets.h (+19 -0)
linux/battery.hpp (+127 -0)
📝 linux/main.cpp (+20 -26)

📄 Description

This PR addresses an issue where the battery levels for the left and right AirPods were sometimes incorrectly switched. The problem stemmed from a hardcoded assumption in the previous code: it assumed the left AirPod was always the first in the data, when in fact, the primary AirPod (which could be either left or right) is reported first. This led to misassigned levels when the primary AirPod didn’t align with the hardcoded order. The new Battery class resolves this by dynamically identifying the components based on the actual data provided, eliminating the switching issue.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kavishdevar/librepods/pull/84 **Author:** [@tim-gromeyer](https://github.com/tim-gromeyer) **Created:** 3/25/2025 **Status:** ✅ Merged **Merged:** 3/26/2025 **Merged by:** [@kavishdevar](https://github.com/kavishdevar) **Base:** `main` ← **Head:** `linux-battery-class` --- ### 📝 Commits (2) - [`a6dbbd4`](https://github.com/kavishdevar/librepods/commit/a6dbbd4f0ccc9656960e4dd363f4b95bd23a21e8) Simple code cleanup - [`5396041`](https://github.com/kavishdevar/librepods/commit/53960417b641dfa355f713481c5dd38502f7c89c) Add battery class ### 📊 Changes **4 files changed** (+167 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `linux/CMakeLists.txt` (+1 -0) 📝 `linux/airpods_packets.h` (+19 -0) ➕ `linux/battery.hpp` (+127 -0) 📝 `linux/main.cpp` (+20 -26) </details> ### 📄 Description This PR addresses an issue where the battery levels for the left and right AirPods were sometimes incorrectly switched. The problem stemmed from a hardcoded assumption in the previous code: it assumed the left AirPod was always the first in the data, when in fact, the primary AirPod (which could be either left or right) is reported first. This led to misassigned levels when the primary AirPod didn’t align with the hardcoded order. The new Battery class resolves this by dynamically identifying the components based on the actual data provided, eliminating the switching issue. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 12:40:23 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librepods#269
No description provided.