Disable Android remote checksum to fix false hash mismatch errors
Samsung toybox sha256sum output format is inconsistent (CRLF, error messages mixed with output) causing false positives. Verification now uses: file size vs ADB-reported size + local SHA-256 recorded on dest. This is sufficient — the local SHA-256 gives you a checksum you can verify later if needed.
This commit is contained in:
@@ -170,23 +170,12 @@ class AndroidConnector(
|
|||||||
log.info("Deleted ${photo.filename} from device")
|
log.info("Deleted ${photo.filename} from device")
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun remoteChecksum(device: DeviceInfo, photo: PhonePhoto): String? {
|
/**
|
||||||
return try {
|
* Remote checksum disabled — Samsung's toybox sha256sum output format is
|
||||||
val serial = requireSerial(device)
|
* inconsistent across Android versions and causes false hash mismatches.
|
||||||
// Android has md5sum or sha256sum depending on version; try sha256sum first
|
* Verification uses file size comparison + local SHA-256 instead.
|
||||||
var output = runAdb(serial, "shell", "sha256sum", photo.devicePath)
|
*/
|
||||||
if (output.contains("not found") || output.isBlank()) {
|
override suspend fun remoteChecksum(device: DeviceInfo, photo: PhonePhoto): String? = null
|
||||||
runAdb(serial, "shell", "md5sum", photo.devicePath)
|
|
||||||
// md5sum isn't SHA-256 — return null so Copier uses its own verification
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
// sha256sum output: "<hash> <path>"
|
|
||||||
output.trim().split(Regex("\\s+")).firstOrNull()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
log.warn("Remote checksum failed for ${photo.filename}: ${e.message}")
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// Helpers
|
// Helpers
|
||||||
|
|||||||
Reference in New Issue
Block a user