mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-04-24 23:55:52 +03:00
[PR #449] feat: Auto-detect L2CAP function offsets via dlsym for Android #403
Labels
No labels
android
bug
documentation
enhancement
good first issue
help wanted
linux
pull-request
reverse-engineering
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librepods#403
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kavishdevar/librepods/pull/449
Author: @ayaanngandhi
Created: 2/6/2026
Status: 🔄 Open
Base:
main← Head:main📝 Commits (2)
241a1a0feat: Auto-detect L2CAP function offsets via dlsym61253cafix: Remove static keyword from functions declared in header, add ndkVersion📊 Changes
2 files changed (+163 additions, -6 deletions)
View changed files
📝
android/app/build.gradle.kts(+1 -0)📝
android/app/src/main/cpp/l2c_fcr_hook.cpp(+162 -6)📄 Description
Summary
Adds automatic offset detection for L2CAP hook functions, eliminating the need for users to manually find and set offsets on most custom ROMs.
Problem
The hardcoded fallback offset
0x00a55e30doesn't work on most custom ROMs, causing L2CAP connection failures. Users had to manually extract offsets from theirlibbluetooth_jni.sousing tools likenmorreadelf.Solution
Added runtime symbol lookup using
dlsym()to automatically find function offsets when the ROM exports them in the dynamic symbol table.Changes
findSymbolOffset()— usesdlsymto look up symbols at runtimefindLibraryPath()— locates the Bluetooth library via/proc/self/mapsdlsymlookup (auto-detection)Symbols auto-detected
l2c_fcr_chk_chan_modesl2cu_process_our_cfg_reql2c_csm_executel2cu_send_peer_info_reqTesting
Tested on Project Elixir v4.2 (Android 14, Realme 6) with AirPods Pro, 1st Generation, where symbols are exported. Auto-detection correctly found offset
0x7f2ac0without manual configuration.Backward Compatibility
persist.librepods.hook_offset, etc.)Summary by CodeRabbit
Release Notes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.