Fix/libirecovery api compatibility - #66
Open
rarebyteforge wants to merge 4 commits into
Open
Conversation
- Replace info->pid with info->cpid for new libirecovery versions - Add #ifdef guards for HAVE_PID_FIELD to support older libirecovery - Wrap IRECV_SEND_OPT_DFU_NOTIFY_FINISH in #ifdef for compatibility - Fallback to irecv_send_file(client, path, 0) when flag is unavailable Fixes compilation against modern Ubuntu/Arch with current libirecovery headers Maintains backward compatibility with older libirecovery versions
Explains API differences between old and new libirecovery versions and how tr4mpass handles both through the compatibility layer
Centralized version detection and API normalization for: - PID vs CPID field differences between old and new libirecovery - DFU notify finish flag availability Provides single point of truth for compatibility handling
- path_b_identity.c: Replace direct info->pid with irecv_get_device_id() macro - path_a_ramdisk.c: Use compatibility layer for DFU_NOTIFY_FINISH flag - Both files now import compat/libirecovery_compat.h for API normalization - Works transparently with both old (pid) and new (cpid) libirecovery versions - Update Makefile with automatic API detection during build All changes maintain the same functionality while being cleaner and more maintainable.
Author
Merge Justification – Fix/libirecovery API CompatibilityThis PR resolves critical build failures caused by breaking changes in modern libirecovery (2024+). Without these fixes, Key Issues Addressed
Solution
Benefits
Recommendation |
ihustlex3
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add compatibility layer to support both legacy and modern versions of libirecovery.
Problem
Modern libirecovery (2024+) introduced breaking API changes:
pidfield tocpidinirecv_device_infostructIRECV_SEND_OPT_DFU_NOTIFY_FINISHconstantThis caused compilation failures on systems with the updated libirecovery, while the codebase was previously only compatible with older versions.
Solution
Implement a centralized compatibility layer that:
pkg-configirecv_get_device_id(info)to abstract device ID field accessIRECV_SEND_OPT_DFU_NOTIFY_FINISH→ 0)Changes
include/compat/libirecovery_compat.h– Compatibility header with macros and inline functionsCOMPATIBILITY.md– Detailed guide for both APIs, build configuration, and troubleshootingMakefile– Auto-detection of libirecovery features via grep on pkg-config headerssrc/bypass/path_a_ramdisk.c– Use compatibility layer for DFU notify flagsrc/bypass/path_b_identity.c– Use compatibility layer for device ID fieldCompatibility
Works with: