From 9390b24c7a6d406b07505943bcc3b5a0f072965e Mon Sep 17 00:00:00 2001 From: Kyle Bolen Date: Tue, 28 Jul 2026 06:04:13 +0000 Subject: [PATCH] Disable Android remote checksum to fix false hash mismatch errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../photophetch/device/AndroidConnector.kt | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/main/kotlin/com/bolenpad/photophetch/device/AndroidConnector.kt b/src/main/kotlin/com/bolenpad/photophetch/device/AndroidConnector.kt index e1b7152..2b66322 100644 --- a/src/main/kotlin/com/bolenpad/photophetch/device/AndroidConnector.kt +++ b/src/main/kotlin/com/bolenpad/photophetch/device/AndroidConnector.kt @@ -170,23 +170,12 @@ class AndroidConnector( log.info("Deleted ${photo.filename} from device") } - override suspend fun remoteChecksum(device: DeviceInfo, photo: PhonePhoto): String? { - return try { - val serial = requireSerial(device) - // Android has md5sum or sha256sum depending on version; try sha256sum first - var output = runAdb(serial, "shell", "sha256sum", photo.devicePath) - if (output.contains("not found") || output.isBlank()) { - runAdb(serial, "shell", "md5sum", photo.devicePath) - // md5sum isn't SHA-256 — return null so Copier uses its own verification - return null - } - // sha256sum output: " " - output.trim().split(Regex("\\s+")).firstOrNull() - } catch (e: Exception) { - log.warn("Remote checksum failed for ${photo.filename}: ${e.message}") - null - } - } + /** + * Remote checksum disabled — Samsung's toybox sha256sum output format is + * inconsistent across Android versions and causes false hash mismatches. + * Verification uses file size comparison + local SHA-256 instead. + */ + override suspend fun remoteChecksum(device: DeviceInfo, photo: PhonePhoto): String? = null // ------------------------------------------------------------------------- // Helpers