1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-24 03:35:38 +03:00

community/heimdall: fix for modern devices

This commit is contained in:
Maxim Karasev 2021-07-03 23:02:55 +03:00 committed by Bart Ribbers
parent 43dfdc5458
commit 9099117632
2 changed files with 58 additions and 4 deletions

View file

@ -2,8 +2,8 @@
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=heimdall
pkgver=1.4.2
pkgrel=0
pkgdesc="Flasher for Samsung Galaxy S devices"
pkgrel=1
pkgdesc="Free implementation of Samsung Galaxy devices flashing protocol"
url="https://gitlab.com/BenjaminDobell/Heimdall"
arch="all"
license="MIT"
@ -11,6 +11,7 @@ makedepends="libusb-dev cmake"
source="https://gitlab.com/BenjaminDobell/Heimdall/-/archive/v$pkgver/Heimdall-v$pkgver.tar.gz
heimdall_flash_kernel.sh
heimdall_wait_for_device.sh
reset-device-before-handshake.patch
"
options="!check" # No tests
builddir="$srcdir/Heimdall-v$pkgver"
@ -29,6 +30,9 @@ package() {
done
}
sha512sums="ed9c5cc7e9377647474ba1af8b7a06d7bbc2371d379d83c2e5cd8463637c52c08c269ab18b6a0a0bec91be8101978748b2d10dd78629ba567bd2c2e452633f63 Heimdall-v1.4.2.tar.gz
sha512sums="
ed9c5cc7e9377647474ba1af8b7a06d7bbc2371d379d83c2e5cd8463637c52c08c269ab18b6a0a0bec91be8101978748b2d10dd78629ba567bd2c2e452633f63 Heimdall-v1.4.2.tar.gz
f2cae8ee8bd598ca7e2ca8ccb01318dc3b7b049f6177e41a1a3b82906de86cae4f789438d9ed319ec06fd957814d59ec8b5a0f0096630cad0f2ef89825d4fd1a heimdall_flash_kernel.sh
45e742bb3a8c8d0bc6806a4e9f860b04f255cad72a8602c04759178284c66e0a90d3ea22249b5fa69de1dd1d6ecd6221adaa63d611aa20d2a54aa20868e86a9f heimdall_wait_for_device.sh"
45e742bb3a8c8d0bc6806a4e9f860b04f255cad72a8602c04759178284c66e0a90d3ea22249b5fa69de1dd1d6ecd6221adaa63d611aa20d2a54aa20868e86a9f heimdall_wait_for_device.sh
56bc1d52324b8bad167dcd34a587dadf2cf5cd508badce5095da6aee8315ac459200c4ce92ac8454c2747d40b9c07bb7897c0f5e73deec70ee4381b253a18014 reset-device-before-handshake.patch
"

View file

@ -0,0 +1,50 @@
From 745dbb46004a328f0db04cc75b6d4124562591a2 Mon Sep 17 00:00:00 2001
From: Jesse Chan <jc@linux.com>
Date: Tue, 5 May 2020 16:14:46 +0800
Subject: [PATCH] InitialiseProtocol: reset device before handshake
Heimdall fails to handshake with device on my Linux installation:
Initialising protocol...
ERROR: libusb error -7 whilst sending bulk transfer. Retrying...
ERROR: libusb error -7 whilst sending bulk transfer. Retrying...
ERROR: libusb error -7 whilst sending bulk transfer. Retrying...
ERROR: libusb error -7 whilst sending bulk transfer. Retrying...
ERROR: libusb error -7 whilst sending bulk transfer. Retrying...
ERROR: libusb error -7 whilst sending bulk transfer.
ERROR: Failed to send handshake!
ERROR: Failed to receive handshake response. Result: -7
ERROR: Protocol initialisation failed!
However, with the same USB cable, port and device, Heimdall
successfully handshake with the device on Windows via WinUSB.
This indicates handling of USB devices of host (AMD X570) on
Linux might lead to undesired results. Though, without further
testing, the interference from userspace (Ubuntu 20.04, KDE) can
not be ruled out.
Thus, this patch calls libusb_reset_device to ensure
the USB port is in a clean state before we send the data.
Fixes issues with newer devices and hosts.
Signed-off-by: Jesse Chan <jc@linux.com>
---
heimdall/source/BridgeManager.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/heimdall/source/BridgeManager.cpp b/heimdall/source/BridgeManager.cpp
index 1b658c8..1ad217c 100644
--- a/heimdall/source/BridgeManager.cpp
+++ b/heimdall/source/BridgeManager.cpp
@@ -303,6 +303,11 @@ bool BridgeManager::InitialiseProtocol(void)
memcpy(dataBuffer, "ODIN", 4);
memset(dataBuffer + 4, 0, 1);
+ if (libusb_reset_device(deviceHandle))
+ {
+ Interface::PrintError("Failed to reset device!");
+ }
+
if (!SendBulkTransfer(dataBuffer, 4, 1000))
{
Interface::PrintError("Failed to send handshake!");