Skip to content

About

Bluetooth audio (A2DP) for a Rabbit R1 running an Android 13 GSI: AOSP's audio module over MediaTek's

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

r1-bluetooth-audio

Makes a Rabbit R1 running an Android 13 GSI play music over Bluetooth.

On that setup headphones pair and connect, but no audio reaches them. The R1's vendor partition ships MediaTek's audio.bluetooth.default.so, which only reads sessions opened by MediaTek's Bluetooth stack. A GSI uses AOSP's stack, which opens its sessions through the standard interface. These scripts put AOSP's version of that one library over MediaTek's. The full explanation is in Getting Bluetooth audio out of a Rabbit R1 on Android 13.

What you need

  • A Rabbit R1 (MT6765), bootloader unlocked, Android 13 GSI, root over adb (su).
  • Its original vendor partition, build SP1A.210812.016. Check with adb shell getprop ro.vendor.build.fingerprint.
  • On your computer: adb, curl, unzip, python3, and e2fsprogs (debugfs, dumpe2fs, e2fsck).

Use

Read the scripts first: they run commands as root on your device.

./fetch.sh   # downloads Google's Pixel 3 factory image (about 2 GB), checks it, keeps one 130 KB file
./apply.sh   # pushes it, bind-mounts it over the vendor's and restarts the audio service

Then reconnect your headphones. With several devices attached, set ANDROID_SERIAL.

Try it first: apply.sh

Changes nothing on disk. The library is bind-mounted from a tmpfs over /vendor/lib64/hw/audio.bluetooth.default.so, so a reboot undoes it. Use it to check that your headphones play before writing anything.

Make it permanent: permanent.sh

./permanent.sh        # then: adb reboot
./permanent.sh undo   # writes the original blocks back; then: adb reboot

It writes to the vendor partition, so read it before you run it. What it does:

  1. Copies the vendor partition to your computer and checks the copy against the device.
  2. Replaces the one file in that copy with debugfs, keeping its owner, mode, dates and SELinux label, and runs e2fsck on the result. It stops if the image shares blocks between files, has errors, or does not check clean.
  3. Finds the 4 KB blocks that differ (36 on my device, 144 KB) and keeps both versions of them in ./backup.
  4. Writes only those blocks from Android itself, then reads the whole partition back and compares its SHA-256 with the image it built. If it does not match, it puts the old blocks back.

No bootloader, no fastboot, no full image. Keep ./backup: it is what undo uses. If the device ever failed to boot you would need a full backup of the partition and MediaTek's download mode, so make one first if you do not have it. Writing under a mounted partition is only tolerable here because it is mounted read-only and you reboot right after: do not keep using the device in between.

Limits

  • Tested on one R1, with music (A2DP) and the media volume slider. Calls over Bluetooth were not tested. permanent.sh and its undo were both run on that device, with a reboot after each.
  • Only the 64-bit library is replaced; the R1's audio service is 64-bit.
  • apply.sh refuses to run on another chipset or vendor build.
  • The library itself is not in this repository: fetch.sh takes it from Google's own image and checks its SHA-256 (3576b51ff4d8099d161f5cdb0893ec19f476715de1cb537553ef553b66fad148).

MIT licence. Not affiliated with Rabbit, MediaTek or Google.

About

Bluetooth audio (A2DP) for a Rabbit R1 running an Android 13 GSI: AOSP's audio module over MediaTek's

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages