im soo stupid ;-;

This commit is contained in:
Kavish Devar
2025-01-11 01:10:59 +05:30
parent d197a05a07
commit a72cbf129f
4 changed files with 65 additions and 40 deletions

BIN
root-module/btl2capfix.zip Normal file

Binary file not shown.

View File

@@ -21,12 +21,12 @@ if [ -f "/apex/com.android.btservices/lib64/libbluetooth_jni.so" ]; then
SOURCE_FILE="/apex/com.android.btservices/lib64/libbluetooth_jni.so"
LIBRARY_NAME="libbluetooth_jni.so"
PATCHED_FILE_NAME="libbluetooth_jni_patched.so"
log "Detected Qualcomm library: libbluetooth_jni.so in /apex/com.android.btservices/lib64/"
log "Detected library: libbluetooth_jni.so in /apex/com.android.btservices/lib64/"
elif [ -f "/system/lib64/libbluetooth_jni.so" ]; then
SOURCE_FILE="/system/lib64/libbluetooth_jni.so"
LIBRARY_NAME="libbluetooth_jni.so"
PATCHED_FILE_NAME="libbluetooth_jni_patched.so"
log "Detected Qualcomm library: libbluetooth_jni.so in /system/lib64/"
log "Detected library: libbluetooth_jni.so in /system/lib64/"
elif [ -f "/system/lib64/libbluetooth_qti.so" ]; then
SOURCE_FILE="/system/lib64/libbluetooth_qti.so"
LIBRARY_NAME="libbluetooth_qti.so"
@@ -44,20 +44,18 @@ fi
# Upload the library to the API
log "Uploading $LIBRARY_NAME to the API for patching..."
RESPONSE=$(curl -s -X POST "$API_URL" \
PATCHED_FILE_NAME="patched_$LIBRARY_NAME"
curl -s -X POST "$API_URL" \
-F "file=@$SOURCE_FILE" \
-F "qti=$( [ "$LIBRARY_NAME" = "libbluetooth_qti.so" ] && echo "1" || echo "0")")
-F "library_name=$LIBRARY_NAME" \
-o "$TEMP_DIR/$PATCHED_FILE_NAME" \
-D "$TEMP_DIR/headers.txt"
# Check if the response is a file (patched .so)
if echo "$RESPONSE" | grep -q "Content-Disposition"; then
# Extract the patched .so file name from Content-Disposition header
PATCHED_FILE_NAME="patched_$LIBRARY_NAME"
# Check if the patched file was downloaded successfully
if [ -f "$TEMP_DIR/$PATCHED_FILE_NAME" ]; then
log "Received patched file from the API."
# Save the patched .so file
echo "$RESPONSE" > "$TEMP_DIR/$PATCHED_FILE_NAME"
# Note: Depending on how the server sends the file, you might need to handle binary data appropriately.
# Move the patched file to the module's directory
log "Installing patched file to the module's directory..."
mkdir -p "$MODPATH/system/lib/"
@@ -68,8 +66,7 @@ if echo "$RESPONSE" | grep -q "Content-Disposition"; then
log "Patched file has been successfully installed at $MODPATH/system/lib/$PATCHED_FILE_NAME"
else
# Assume JSON response with error
ERROR_MESSAGE=$(echo "$RESPONSE" | grep -oP '(?<="error": ")[^"]+')
ERROR_MESSAGE=$(grep -oP '(?<="error": ")[^"]+' "$TEMP_DIR/headers.txt")
log "API Error: $ERROR_MESSAGE"
rm -rf "$TEMP_DIR"
exit 1