librepods icon indicating copy to clipboard operation
librepods copied to clipboard

L2CAP Connection Fails on Pixel 7a with Both Xposed and Magisk Methods

Open MaizeShark opened this issue 2 months ago • 15 comments

Device Information:

  • Device: Google Pixel 7a
  • Android Version: 16 (BP3A.250905.014)
  • Root: Magisk
  • Magisk Version 29
  • Xposed Framework: ReLSPosed (v1.0.1)
  • LibrePods started with v0.1.0-rc.4 and them moved to v0.2.0-alpha

Describe the bug: The LibrePods app is unable to establish an L2CAP connection to my AirPods Pro 2 on my Pixel 7a, despite trying both the recommended Xposed and Magisk module methods. The symptoms are slightly different depending on the method used.

I do have to say that own AirReps but that shouldn't be the issue here, it works fine on my Ubuntu 24.04 Maschine. And the "Pro 2 V5.2 TB" are also compatible with IOS so...

Steps to Reproduce & Troubleshooting Journey:

  1. Initial State (No Fix):

    • I had in ReLSPosed enabled Bluetooth (com.google.android.bluetooth) and Settings (com.google.android.settings) and used Magisks Zygisk
    • The logcat shows java.lang.SecurityException: ... has no android.permission.BLUETOOTH_PRIVILEGED and android.bluetooth.BluetoothSocketException.
  2. Method 1: Xposed Hook (Recommended):

    • I just enabled Bluetooth and used ReZygisk dont know which fixed it
    • the BLUETOOTH_PRIVILEGED security exception is gone.
    • The system logs confirm the hook is active with the message: I AirPodsHook: l2c_fcr_chk_chan_modes hooked, returning true.
    • Result: The connection now silently times out. The app shows the error "Your AirPods are connected via Bluetooth, but LibrePods couldn't connect to AirPods using L2CAP. Error: Socket created, but not connected." There is no longer a No PSM available or BLUETOOTH_PRIVILEGED error in the logs. This indicates the initial check is bypassed, but a deeper part of the stack is dropping the connection.
  3. Method 2: btl2capfix Magisk Module:

    • I disabled the Xposed module and installed the btl2capfix (from you comment) Magisk module instead.
    • Result: The BLUETOOTH_PRIVILEGED error is also resolved with this method. However, the connection now fails immediately with the error android.bluetooth.BluetoothSocketException: No PSM available.
  4. SELinux:

    • I have also tested with SELinux set to Permissive (setenforce 0), and it did not solve the issue in either case.

latest_log.txt

Thank you for your work on this project! Please let me know if there is any further information I can provide.

MaizeShark avatar Oct 14 '25 18:10 MaizeShark

what is your setup when you collected the logs?

kavishdevar avatar Oct 15 '25 05:10 kavishdevar

what is your setup when you collected the logs?

the log is with the btl2capfix Magisk module (https://github.com/kavishdevar/librepods/issues/67#issuecomment-2842353549) if that is what you ment

MaizeShark avatar Oct 15 '25 20:10 MaizeShark

I am not really sure what's going on, but I can see neither of the two:

  • App's logs (I can only see Bluetooth) logs,
  • Something along the lines of L2CAP Registered service classic PSM: 0x1001 (0x1001 is the PSM that is used for controlling AirPods).

So, I doubt if my app is active and trying to connect. I doubt that your AirPods being fake matters, because I can't even see logs like Received Bluetooth connection broadcast. Could you try a clean install of the app, without the A16 module, and skip the onboarding (setting up hooks part). And, run the log collection?

kavishdevar avatar Oct 19 '25 14:10 kavishdevar

I had a similar crash as well, this is the log I collected from your app:

_data_user_0_me.kavishdevar.librepods_files_logs_airpods_log_20251019_202438.txt

Could you check it out once? Im using airpods 4 on pixel 7a (A16) Also, I do get an error that the app isnt 16KB compatible. this is the screenshot:

Image

Also I did get a notification with error that said, failed to establish connection: read failed, socket might closed or timeout, read ret: -1 Please let me know if you need any other logs! Thanks a lot for the hardwork! @kavishdevar

shailantani avatar Oct 19 '25 14:10 shailantani

@shailantani you don't have the xposed hook active? There are no logs from the xposed module.

kavishdevar avatar Oct 19 '25 15:10 kavishdevar

And, that 16KB alignment: i'll fix it. thanks for pointing it out! I don't run A16, and had dismissed the warning on Android Studio a long time ago.

kavishdevar avatar Oct 19 '25 15:10 kavishdevar

@shailantani you don't have the xposed hook active? There are no logs from the xposed module.

I do have it enabled:

Image Image

I can send logs from lsposed if that helps?

shailantani avatar Oct 19 '25 15:10 shailantani

And, that 16KB alignment: i'll fix it. thanks for pointing it out! I don't run A16, and had dismissed the warning on Android Studio a long time ago.

haha no worries atall! :)

shailantani avatar Oct 19 '25 15:10 shailantani

sorry, for the spam, i just opened the app and it randomly connected haha! I'll try to work out what I did. And let you know if I face a similar bug again :))

shailantani avatar Oct 19 '25 15:10 shailantani

sorry, for the spam, i just opened the app and it randomly connected haha! I'll try to work out what I did. And let you know if I face a similar bug again :))

It's alright! You probably restarted your Bluetooth :) Anyway, enjoy!

kavishdevar avatar Oct 19 '25 15:10 kavishdevar

I have this issue too, no PSM available, also 5.2 TB reps.

_data_user_0_me.kavishdevar.librepods_files_logs_airpods_log_20251118_182702.txt

mint1246 avatar Nov 18 '25 16:11 mint1246

_data_user_0_me.kavishdevar.librepods_files_logs_airpods_log_20251118_182702.txt

Same here, 5.4 Huilian reps, on LSPosed, it consistently complains about "MAC address must be 6 bytes"

Image

Xpl0itU avatar Nov 18 '25 18:11 Xpl0itU

@Xpl0itU please try https://github.com/kavishdevar/librepods/actions/runs/19412004970

kavishdevar avatar Nov 18 '25 19:11 kavishdevar

@Xpl0itU please try https://github.com/kavishdevar/librepods/actions/runs/19412004970

Same notification, but app sometimes crashes when connecting to the airpods

LSPosed_2025-11-18T20_14_08.059414.zip

(Same error, just scrolling horizontally)

Image Image Image

Xpl0itU avatar Nov 18 '25 19:11 Xpl0itU

@Xpl0itU please try https://github.com/kavishdevar/librepods/actions/runs/19412004970

Same notification, but app sometimes crashes when connecting to the airpods

LSPosed_2025-11-18T20_14_08.059414.zip

(Same error, just scrolling horizontally)

Image Image Image

Using LineageOS 23.0-20251114-NIGHTLY-lynx on a Pixel 7a btw, not stock OS

Xpl0itU avatar Nov 19 '25 17:11 Xpl0itU