Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/ci-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ on:
type: string
workflow_call:

jobs:
jobs:
linting:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: use DavidAnson/markdownlint-action
uses: DavidAnson/markdownlint-cli2-action@v21
continue-on-error: true
with:
globs: '**/*.md'
build-debug-apk:
runs-on: ubuntu-latest
steps:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/ci-linux-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ on:
workflow_dispatch:

jobs:
linting:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: use DavidAnson/markdownlint-action
uses: DavidAnson/markdownlint-cli2-action@v21
continue-on-error: true
with:
globs: '**/*.md'
build:
runs-on: ubuntu-latest

Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ on:
# - '*'

jobs:
linting:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: use DavidAnson/markdownlint-action
uses: DavidAnson/markdownlint-cli2-action@v21
continue-on-error: true
with:
globs: '**/*.md'

build-linux:
runs-on: ubuntu-latest

Expand Down
98 changes: 64 additions & 34 deletions AAP Definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,42 @@

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

# Handshake
## Handshake

This packet is necessary to establish a connection with the AirPods. Or else, the AirPods will not respond to any packets.

```plaintext
00 00 04 00 01 00 02 00 00 00 00 00 00 00 00 00
```

# Setting specific features for AirPods Pro 2
## Setting specific features for AirPods Pro 2

> *may work for airpods 4 anc also, not tested*

Since apple likes to wall off some features behind specific OS versions, and apple silicon devices, some packets are necessary to enable these features.
Since Apple likes to wall off some features behind specific OS versions, and Apple silicon devices, some packets are
necessary to enable these features.

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.
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.

*Captured using PacketLogger on an Intel Mac running macOS Sequoia 15.0.1*

```plaintext
04 00 04 00 4d 00 ff 00 00 00 00 00 00 00
```

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

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))
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))

# Requesting notifications
## Requesting notifications

This packet is necessary to receive notifications from the AirPods like ear detection, noise control mode, conversational awareness, battery status, etc.
This packet is necessary to receive notifications from the AirPods like ear detection, noise control mode,
conversational awareness, battery status, etc.

*Captured using PacketLogger on an Intel Mac running macOS Sequoia 15.0.1*

```plaintext
04 00 04 00 0F 00 FF FF FE FF
```
Expand All @@ -41,7 +48,7 @@ This packet also works.
04 00 04 00 0F 00 FF FF FF FF
```

# Notifications
## Notifications

## Battery

Expand All @@ -64,7 +71,6 @@ AirPods occasionally send battery status packets. The packet format is as follow
| Discharging | 02 |
| Disconnected | 04 |


Example packet from AirPods Pro 2

```plaintext
Expand Down Expand Up @@ -92,7 +98,8 @@ Example packet from AirPods Pro 2

## Noise Control

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:
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:

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

AirPods send ear detection packets when the ear detection status changes. The packet format is as follows:

```plaintext
04 00 04 00 06 00 [primary pod] [secondary pod]
```

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.
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.

| Pod Status | Byte value |
|------------|------------|
Expand All @@ -134,9 +143,11 @@ AirPods send conversational awareness packets when the person wearing them start
| 03 | Person Stopped Speaking; increase volume back to normal |
| Intermediate values | Intermediate volume levels |
| 08/09 | Normal Volume |

### Reading Conversational Awareness State

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.
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.

The packet format is:

Expand All @@ -145,14 +156,16 @@ The packet format is:
```

- `[status]` is a single byte at offset 7 (zero-based), immediately after the header.
- `0x01` — Conversational Awareness is **enabled**
- `0x02` — Conversational Awareness is **disabled**
- Any other value — Unknown/undetermined state
- `0x01` — Conversational Awareness is **enabled**
- `0x02` — Conversational Awareness is **disabled**
- Any other value — Unknown/undetermined state

**Example:**

```plaintext
04 00 04 00 09 00 28 01 00 00 00
```

Here, `01` at the 8th byte (offset 7) means CA is enabled.

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

1. Bluetooth advertising name (varies in length)
2. Model number
2. Model number
3. Manufacturer
4. Serial number
5. Firmware version
Expand All @@ -180,15 +193,16 @@ The strings are null-terminated UTF-8 strings in the following order:
13. Additional encrypted data

Example packet:

```plaintext
040004001d0002d5000400416972506f64732050726f004133303438004170706c6520496e632e0051584e524848595850360036312e313836383034303030323030303030302e323731330036312e313836383034303030323030303030302e3237313300312e302e3000636f6d2e6170706c652e6163636573736f72792e757064617465722e6170702e3731004859394c5432454632364a59004833504c5748444a32364b3000363335373533360089312a6567a5400f84a3ca234947efd40b90d78436ae5946748d70273e66066a2589300035333935303630363400```

The packet contains device identification and version information followed by some encrypted data whose format is not known.
```

# Writing to the AirPods
## Writing to the AirPods

## Changing Noise Control
### Changing Noise Control

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

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

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

> 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).
> 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).

## Renaming AirPods

Expand All @@ -217,9 +232,11 @@ We can send a packet to rename the AirPods. The packet format is as follows:

## Toggle case charging sounds

> *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*
> *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*

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:
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:

```plaintext
12 3A 00 01 00 08 [setting]
Expand All @@ -234,7 +251,9 @@ We can send a packet to toggle if sounds should be played when the case is conne

> *This feature is only for AirPods Pro 2 and the new AirPods 4 with ANC. Tested only on AirPods Pro 2*

We can send a packet to toggle Conversational Awareness. If enabled, the AirPods will switch to Transparency mode when the person wearing them starts speaking (and sends packet for notifying the device to reduce volume). The packet format is as follows:
We can send a packet to toggle Conversational Awareness. If enabled, the AirPods will switch to Transparency mode
when the person wearing them starts speaking (and sends packet for notifying the device to reduce volume). The
packet format is as follows:

```plaintext
04 00 04 00 09 00 28 [setting] 00 00 00
Expand All @@ -249,22 +268,27 @@ We can send a packet to toggle Conversational Awareness. If enabled, the AirPods

> *This feature is only for AirPods Pro 2 and the new AirPods 4 with ANC. Tested only on AirPods Pro 2*

The new firmware `7A305` for app2 has a new feature called Adaptive Audio Noise. This allows us to control how much noise is passed through the AirPods when the noise control mode is set to Adaptive. The packet format is as follows:
The new firmware `7A305` for app2 has a new feature called Adaptive Audio Noise. This allows us to control how
much noise is passed through the AirPods when the noise control mode is set to Adaptive. The packet format is as follows:

```plaintext
04 00 04 00 09 00 2E [level] 00 00 00
```

The level can be any value between 0 and 100, 0 to allow maximum noise (i.e. minimum noise filtering), and 100 to filter out more noise.
The level can be any value between 0 and 100, 0 to allow maximum noise (i.e. minimum noise filtering), and 100 to
filter out more noise.

> This feature is only effective when the noise control mode is set to Adaptive.

*I find it quite funny how I have greater control over the noise control on the AirPods on non-Apple devices than on Apple devices, becuase on Apple Devices, there are just 3 options More Noise (0), Midway through (50), and Less Noise (100), but here I can set any value between 0 and 100.*
*I find it quite funny how I have greater control over the noise control on the AirPods on non-Apple devices than
on Apple devices, becuase on Apple Devices, there are just 3 options More Noise (0), Midway through (50), and Less
Noise (100), but here I can set any value between 0 and 100.*

## Accessiblity Settings

## Headphone Accomodation
```

```plaintext
04 00 04 00 53 00 84 00 02 02 [Phone] [Media]
[EQ1][EQ2][EQ3][EQ4][EQ5][EQ6][EQ7][EQ8]
duplicated thrice for some reason
Expand All @@ -278,7 +302,7 @@ duplicated thrice for some reason

## Customize Transparency mode

```
```plaintext
12 18 00 [enabled]
<left bud>
[EQ1][EQ2][EQ3][EQ4][EQ5][EQ6][EQ7][EQ8]
Expand All @@ -289,8 +313,8 @@ duplicated thrice for some reason
<repeat for right bud>
```


All values are formatted as IEEE 754 floats in little endian order.

| Data | Type | Range |
|-------------------------|---------------|-------|
| Enabled | IEEE754 Float | 0/1 |
Expand All @@ -304,12 +328,16 @@ All values are formatted as IEEE 754 floats in little endian order.
> [!IMPORTANT]
> Also send the [Headphone Accomodation](#headphone-accomodation) after this.


## Configure Stem Long Press

I have noted all the packets sent to configure what the press and hold of the steam should do. The packets sent are specific to the current state. And are probably overwritten everytime the AirPods are connected to a new (apple) device that is not synced with icloud (i think)... So, for non-Apple devices too, the configuration needs to be stored and overwritten everytime the AirPods are connected to the device. That is the only way to keep the configuration.
I have noted all the packets sent to configure what the press and hold of the steam should do. The packets sent
are specific to the current state. And are probably overwritten everytime the AirPods are connected to a new
(Apple) device that is not synced with icloud (i think)... So, for non-Apple devices too, the configuration needs
to be stored and overwritten everytime the AirPods are connected to the device. That is the only way to keep the
configuration.

This is also the only way to control the configuration as the previous state needs to be known, and then the new state can be set.
This is also the only way to control the configuration as the previous state needs to be known, and then the new
state can be set.

The packets sent (based on the previous states) are as follows:

Expand Down Expand Up @@ -375,11 +403,12 @@ The packets sent (based on the previous states) are as follows:

> *i do hate apple for not hardcoding these, like there are literally only 4^2 - ${\binom{4}{1}}$ - $\binom{4}{2}$*

# Head Tracking
## Head Tracking

## Start Tracking
### Start Tracking

This packet initiates head tracking. When sent, the AirPods begin streaming head tracking data (e.g. orientation and acceleration) for live plotting and analysis.
This packet initiates head tracking. When sent, the AirPods begin streaming head tracking data (e.g. orientation
and acceleration) for live plotting and analysis.

```plaintext
04 00 04 00 17 00 00 00 10 00 10 00 08 A1 02 42 0B 08 0E 10 02 1A 05 01 40 9C 00 00
Expand All @@ -392,6 +421,7 @@ This packet stops the head tracking data stream.
```plaintext
04 00 04 00 17 00 00 00 10 00 11 00 08 7E 10 02 42 0B 08 4E 10 02 1A 05 01 00 00 00 00
```

## Received Head Tracking Sensor Data

Once tracking is active, the AirPods stream sensor packets with the following common structure:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
## LibrePods root module changelog

_[See here](https://github.com/kavishdevar/librepods/releases)_
Loading