Skip to content

Commit 987b798

Browse files
author
Jan Unger
committed
docs: added more detailed setup instruction for linux and linted the most markdown errors
1 parent 8088594 commit 987b798

4 files changed

Lines changed: 130 additions & 46 deletions

File tree

AAP Definitions.md

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,23 @@
22

33
AAP runs on top of L2CAP, with a PSM of 0x1001 or 4097.
44

5-
# Handshake
5+
## Handshake
6+
67
This packet is necessary to establish a connection with the AirPods. Or else, the AirPods will not respond to any packets.
78

89
```plaintext
910
00 00 04 00 01 00 02 00 00 00 00 00 00 00 00 00
1011
```
1112

12-
# Setting specific features for AirPods Pro 2
13+
## Setting specific features for AirPods Pro 2
1314

1415
> *may work for airpods 4 anc also, not tested*
1516
16-
Since apple likes to wall off some features behind specific OS versions, and apple silicon devices, some packets are necessary to enable these features.
17+
Since apple likes to wall off some features behind specific OS versions, and apple silicon devices, some packets are
18+
necessary to enable these features.
1719

18-
I captured the following packet only accidentally, because Apple being Apple decided to hide *this* and *the handshake* from packetlogger, but sometimes it shows up.
20+
I captured the following packet only accidentally, because Apple being Apple decided to hide *this* and *the
21+
handshake* from packetlogger, but sometimes it shows up.
1922

2023
*Captured using PacketLogger on an Intel Mac running macOS Sequoia 15.0.1*
2124
```plaintext
@@ -24,11 +27,13 @@ I captured the following packet only accidentally, because Apple being Apple dec
2427

2528
This packet enables conversational awareness when playing audio. (CA works without this packet only when no audio is playing)
2629

27-
It also enables the Adaptive Transparency feature. (We can set Adaptive Transparency, but it doesn't respond with the same packet See [Noise Cancellation](#changing-noise-control))
30+
It also enables the Adaptive Transparency feature. (We can set Adaptive Transparency, but it doesn't respond with the
31+
same packet See [Noise Cancellation](#changing-noise-control))
2832

29-
# Requesting notifications
33+
## Requesting notifications
3034

31-
This packet is necessary to receive notifications from the AirPods like ear detection, noise control mode, conversational awareness, battery status, etc.
35+
This packet is necessary to receive notifications from the AirPods like ear detection, noise control mode,
36+
conversational awareness, battery status, etc.
3237

3338
*Captured using PacketLogger on an Intel Mac running macOS Sequoia 15.0.1*
3439
```plaintext
@@ -41,7 +46,7 @@ This packet also works.
4146
04 00 04 00 0F 00 FF FF FF FF
4247
```
4348

44-
# Notifications
49+
## Notifications
4550

4651
## Battery
4752

@@ -92,7 +97,8 @@ Example packet from AirPods Pro 2
9297

9398
## Noise Control
9499

95-
The AirPods Pro 2 send noise control packets when the noise control mode is changed (either by a stem long press or by the connected device, see [Changing noise control](#changing-noise-control)). The packet format is as follows:
100+
The AirPods Pro 2 send noise control packets when the noise control mode is changed (either by a stem long press or
101+
by the connected device, see [Changing noise control](#changing-noise-control)). The packet format is as follows:
96102

97103
```plaintext
98104
04 00 04 00 09 00 0D [mode] 00 00 00
@@ -108,11 +114,13 @@ The AirPods Pro 2 send noise control packets when the noise control mode is chan
108114
## Ear Detection
109115

110116
AirPods send ear detection packets when the ear detection status changes. The packet format is as follows:
117+
111118
```plaintext
112119
04 00 04 00 06 00 [primary pod] [secondary pod]
113120
```
114121

115-
If primary is removed, mic will be changed and the secondary will be the new primary, so the primary will be the one in the ear, and the packet will be sent again.
122+
If primary is removed, mic will be changed and the secondary will be the new primary, so the primary will be the one
123+
in the ear, and the packet will be sent again.
116124

117125
| Pod Status | Byte value |
118126
|------------|------------|
@@ -134,9 +142,11 @@ AirPods send conversational awareness packets when the person wearing them start
134142
| 03 | Person Stopped Speaking; increase volume back to normal |
135143
| Intermediate values | Intermediate volume levels |
136144
| 08/09 | Normal Volume |
145+
137146
### Reading Conversational Awareness State
138147

139-
After requesting notifications, the AirPods send a packet indicating the current state of Conversational Awareness (CA). This packet is only sent once after notifications are requested, not when the CA state is changed.
148+
After requesting notifications, the AirPods send a packet indicating the current state of Conversational Awareness
149+
(CA). This packet is only sent once after notifications are requested, not when the CA state is changed.
140150

141151
The packet format is:
142152

@@ -150,9 +160,11 @@ The packet format is:
150160
- Any other value — Unknown/undetermined state
151161

152162
**Example:**
163+
153164
```plaintext
154165
04 00 04 00 09 00 28 01 00 00 00
155166
```
167+
156168
Here, `01` at the 8th byte (offset 7) means CA is enabled.
157169

158170
## Metadata
@@ -166,7 +178,7 @@ This packet contains device information like name, model number, etc. The packet
166178
The strings are null-terminated UTF-8 strings in the following order:
167179

168180
1. Bluetooth advertising name (varies in length)
169-
2. Model number
181+
2. Model number
170182
3. Manufacturer
171183
4. Serial number
172184
5. Firmware version
@@ -180,15 +192,16 @@ The strings are null-terminated UTF-8 strings in the following order:
180192
13. Additional encrypted data
181193

182194
Example packet:
195+
183196
```plaintext
184197
040004001d0002d5000400416972506f64732050726f004133303438004170706c6520496e632e0051584e524848595850360036312e313836383034303030323030303030302e323731330036312e313836383034303030323030303030302e3237313300312e302e3000636f6d2e6170706c652e6163636573736f72792e757064617465722e6170702e3731004859394c5432454632364a59004833504c5748444a32364b3000363335373533360089312a6567a5400f84a3ca234947efd40b90d78436ae5946748d70273e66066a2589300035333935303630363400```
185198
186199
The packet contains device identification and version information followed by some encrypted data whose format is not known.
187200
```
188201

189-
# Writing to the AirPods
202+
## Writing to the AirPods
190203

191-
## Changing Noise Control
204+
### Changing Noise Control
192205

193206
We can send a packet to change the noise control mode. The packet format is as follows:
194207

@@ -205,7 +218,8 @@ We can send a packet to change the noise control mode. The packet format is as f
205218

206219
The airpods will respond with the same packet after the mode has been changed.
207220

208-
> But if your airpods support Adaptive Transparency, and you haven't sent that [special packet](#setting-specific-features-for-airpods-pro-2) to enable it, the airpods will respond with the same packet but with a different mode (like 0x02).
221+
> But if your airpods support Adaptive Transparency, and you haven't sent that [special packet](#setting-specific-features-for-airpods-pro-2)
222+
to enable it, the airpods will respond with the same packet but with a different mode (like 0x02).
209223

210224
## Renaming AirPods
211225

@@ -217,7 +231,8 @@ We can send a packet to rename the AirPods. The packet format is as follows:
217231

218232
## Toggle case charging sounds
219233

220-
> *This feature is only for cases with a speaker, i.e. the AirPods Pro 2 and the new AirPods 4. Tested only on AirPods Pro 2*
234+
> *This feature is only for cases with a speaker, i.e. the AirPods Pro 2 and the new AirPods 4. Tested only on
235+
AirPods Pro 2*
221236

222237
We can send a packet to toggle if sounds should be played when the case is connected to a charger. The packet format is as follows:
223238

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
## LibrePods root module changelog
2+
23
_[See here](https://github.com/kavishdevar/librepods/releases)_

README.md

Lines changed: 58 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
## What is LibrePods?
44

5-
LibrePods unlocks Apple's exclusive AirPods features on non-Apple devices. Get access to noise control modes, adaptive transparency, ear detection, hearing aid, customized transparency mode, battery status, and more - all the premium features you paid for but Apple locked to their ecosystem.
5+
Troubleshooting
6+
LibrePods unlocks Apple's exclusive AirPods features on non-Apple devices. Get access to noise control modes,
7+
adaptive transparency, ear detection, hearing aid, customized transparency mode, battery status, and more - all the
8+
premium features you paid for but Apple locked to their ecosystem.
69

710
## Device Compatibility
811

@@ -13,12 +16,15 @@ LibrePods unlocks Apple's exclusive AirPods features on non-Apple devices. Get a
1316
|| AirPods Max | Fully supported (client shows unsupported features) |
1417
| ⚠️ | Other AirPods models | Basic features (battery status, ear detection) should work |
1518

16-
Most features should work with any AirPods. Currently, I've only got AirPods Pro 2 to test with. But, I believe the protocol remains the same for all other AirPods (based on analysis of the bluetooth stack on macOS).
19+
Most features should work with any AirPods. Currently, I've only got AirPods Pro 2 to test with. But, I believe the
20+
protocol remains the same for all other AirPods (based on analysis of the bluetooth stack on macOS).
1721

1822
## Key Features
1923

20-
- **Noise Control Modes**: Easily switch between noise control modes without having to reach out to your AirPods to long press
21-
- **Ear Detection**: Controls your music automatically when you put your AirPods in or take them out, and switch to phone speaker when you take them out
24+
- **Noise Control Modes**: Easily switch between noise control modes without having to reach out to your AirPods to
25+
long press
26+
- **Ear Detection**: Controls your music automatically when you put your AirPods in or take them out, and switch to
27+
phone speaker when you take them out
2228
- **Battery Status**: Accurate battery levels
2329
- **Head Gestures**: Answer calls just by nodding your head
2430
- **Conversational Awareness**: Volume automatically lowers when you speak
@@ -36,7 +42,20 @@ Most features should work with any AirPods. Currently, I've only got AirPods Pro
3642
## Platform Support
3743

3844
### Linux
39-
for the old version see the [Linux README](/linux/README.md). (doesn't have many features, maintainer didn't have time to work on it)
45+
46+
#### How are you install librepods on Linux?
47+
48+
First, you need to clone the entire Git repository. After this, create a build folder inside `linux/` **not in the
49+
root of the repository.**
50+
51+
Once the folder structure is prepared, run CMake inside the build directory, pointing to the `CMakeLists.txt` file
52+
located in the `linux` folder.
53+
54+
Next, compile the generated Makefiles created by the previous step. After the compilation finishes, you should have a
55+
`librepods` executable. Running this file completes the setup and starts LibrePods.
56+
57+
If you need more help, check the [Linux README](/linux/README.md), which provides a more detailed,
58+
copy-and-paste-ready instruction. (doesn't have many features, maintainer didn't have time to work on it)
4059

4160
new version in development ([#241](https://github.com/kavishdevar/librepods/pull/241))
4261

@@ -61,44 +80,63 @@ https://github.com/user-attachments/assets/43911243-0576-4093-8c55-89c1db5ea533
6180

6281
#### Root Requirement
6382

64-
If you are using ColorOS/OxygenOS 16, you don't need root except for customizing transparency mode, setting up hearing aid, and use Bluetooth Multipoint. Changing ANC, conversational awareness, ear detection, and other customizations will work without root. For everyone else:
83+
If you are using ColorOS/OxygenOS 16, you don't need root except for customizing transparency mode, setting up
84+
hearing aid, and use Bluetooth Multipoint. Changing ANC, conversational awareness, ear detection, and other
85+
customizations will work without root. For everyone else:
6586

6687
> [!CAUTION]
67-
> **You must have a rooted device with Xposed to use LibrePods on Android.** This is due to a [bug in the Android Bluetooth stack](https://issuetracker.google.com/issues/371713238). Please upvote the issue by clicking the '+1' icon on the IssueTracker page. I don't know a fix for Android versions <13 either. So, this needs a phone running A13+.
68-
>
88+
> **You must have a rooted device with Xposed to use LibrePods on Android.** This is due to a [bug in the Android
89+
Bluetooth stack](https://issuetracker.google.com/issues/371713238). Please upvote the issue by clicking the '+1' icon
90+
on the IssueTracker page. I don't know a fix for Android versions <13 either. So, this needs a phone running A13+.
91+
>
6992
> There are **no exceptions** to the root requirement until Google/your OEM figures out a fix.
7093
71-
Until then, you must xposed. I used to provide a non-xposed method too, where the module used overlayfs to replace the bluetooth library with a locally patched one, but that was broken due to how various devices handled overlayfs and a patched library. With xposed, you can also enable the DID hook enabling a few extra features.
94+
Until then, you must xposed. I used to provide a non-xposed method too, where the module used overlayfs to replace
95+
the bluetooth library with a locally patched one, but that was broken due to how various devices handled overlayfs
96+
and a patched library. With xposed, you can also enable the DID hook enabling a few extra features.
7297

7398
## Changing VendorID in the DID profile to that of Apple
7499

75100
Turns out, if you change the VendorID in DID Profile to that of Apple, you get access to several special features!
76101

77-
You can do this on Linux by editing the DeviceID in `/etc/bluetooth/main.conf`. Add this line to the config file `DeviceID = bluetooth:004C:0000:0000`. For android you can enable the `act as Apple device` setting in the app's settings.
102+
You can do this on Linux by editing the DeviceID in `/etc/bluetooth/main.conf`. Add this line to the config file
103+
`DeviceID = bluetooth:004C:0000:0000`. For android you can enable the `act as Apple device` setting in the app's settings.
78104

79105
### Multi-device Connectivity
80106

81-
Upto two devices can be simultaneously connected to AirPods, for audio and control both. Seamless connection switching. The same notification shows up on Apple device when Android takes over the AirPods as if it were an Apple device ("Move to iPhone"). Android also shows a popup when the other device takes over.
107+
Upto two devices can be simultaneously connected to AirPods, for audio and control both. Seamless connection
108+
switching. The same notification shows up on Apple device when Android takes over the AirPods as if it were an Apple
109+
device ("Move to iPhone"). Android also shows a popup when the other device takes over.
82110

83111
### Accessibility Settings and Hearing Aid
84112

85-
Accessibility settings like customizing transparency mode (amplification, balance, tone, conversation boost, and ambient noise reduction), and loud sound reduction can be configured.
113+
Accessibility settings like customizing transparency mode (amplification, balance, tone, conversation boost, and
114+
ambient noise reduction), and loud sound reduction can be configured.
86115

87-
All hearing aid customizations can be done from Android (linux soon), including setting the audiogram result. The app doesn't provide a way to take a hearing test because it requires much more precision. It is much better to use an already available audiogram result.
116+
All hearing aid customizations can be done from Android (linux soon), including setting the audiogram result. The app
117+
doesn't provide a way to take a hearing test because it requires much more precision. It is much better to use an
118+
already available audiogram result.
88119

89120
#### A few notes
90121

91-
- Due to recent AirPods' firmware upgrades, you must enable `Off listening mode` to switch to `Off`. This is because in this mode, loud sounds are not reduced.
122+
- Due to recent AirPods' firmware upgrades, you must enable `Off listening mode` to switch to `Off`. This is because
123+
in this mode, loud sounds are not reduced.
92124

93-
- If you have take both AirPods out, the app will automatically switch to the phone speaker. But, Android might keep on trying to connect to the AirPods because the phone is still connected to them, just the A2DP profile is not connected. The app tries to disconnect the A2DP profile as soon as it detects that Android has connected again if they're not in the ear.
125+
- If you have take both AirPods out, the app will automatically switch to the phone speaker. But, Android might keep
126+
on trying to connect to the AirPods because the phone is still connected to them, just the A2DP profile is not
127+
connected. The app tries to disconnect the A2DP profile as soon as it detects that Android has connected again if
128+
they're not in the ear.
94129

95-
- When renaming your AirPods through the app, you'll need to re-pair them with your phone for the name change to take effect. This is a limitation of how Bluetooth device naming works on Android.
130+
- When renaming your AirPods through the app, you'll need to re-pair them with your phone for the name change to take
131+
effect. This is a limitation of how Bluetooth device naming works on Android.
96132

97-
- If you want the AirPods icon and battery status to show in Android Settings app, install the app as a system app by using the root module.
133+
- If you want the AirPods icon and battery status to show in Android Settings app, install the app as a system app by
134+
using the root module.
98135

99136
## Supporters
100137

101138
A huge thank you to everyone supporting the project!
139+
102140
- @davdroman
103141
- @tedsalmon
104142
- @wiless
@@ -107,6 +145,7 @@ A huge thank you to everyone supporting the project!
107145
- @ressiwage
108146

109147
## Special thanks
148+
110149
- @tyalie for making the first documentation on the protocol! ([tyalie/AAP-Protocol-Definition](https://github.com/tyalie/AAP-Protocol-Defintion))
111150
- @rithvikvibhu and folks over at lagrangepoint for helping with the hearing aid feature ([gist](https://gist.github.com/rithvikvibhu/45e24bbe5ade30125f152383daf07016))
112151
- @devnoname120 for helping with the first root patch
@@ -141,4 +180,5 @@ GNU General Public License for more details.
141180
You should have received a copy of the GNU General Public License
142181
along with this program. If not, see <https://www.gnu.org/licenses/>.
143182

144-
All trademarks, logos, and brand names are the property of their respective owners. Use of them does not imply any affiliation with or endorsement by them. All AirPods images, symbols, and the SF Pro font are the property of Apple Inc.
183+
All trademarks, logos, and brand names are the property of their respective owners. Use of them does not imply any
184+
affiliation with or endorsement by them. All AirPods images, symbols, and the SF Pro font are the property of Apple Inc.

0 commit comments

Comments
 (0)