diff options
author | Tim Schumacher | 2021-03-23 01:19:30 +0100 |
---|---|---|
committer | Tim Schumacher | 2021-03-23 01:19:30 +0100 |
commit | 6d89df5458ae52b9f03316c17a11b6c592a9a102 (patch) | |
tree | 910cc1cfddd2d0d7fefbbb5a4d7edafc4f2c6e48 | |
parent | e156af5d078caa15729822c2534626def230756a (diff) | |
download | aur-heimdall-git.tar.gz |
Add a patch to reset the device before flashing
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 16 | ||||
-rw-r--r-- | reset-device.patch | 50 |
3 files changed, 64 insertions, 6 deletions
@@ -1,6 +1,6 @@ pkgbase = heimdall-git pkgdesc = Tool suite used to flash firmware (ROMs) onto Samsung Galaxy S devices - pkgver = 1.4.2.r9.g92be54f + pkgver = 1.4.2.r10.g3997d5c pkgrel = 1 url = https://glassechidna.com.au/heimdall/ arch = i686 @@ -14,8 +14,10 @@ pkgbase = heimdall-git conflicts = heimdall source = Heimdall::git+https://github.com/Benjamin-Dobell/Heimdall source = heimdall.desktop + source = reset-device.patch sha256sums = SKIP sha256sums = 439cea1a8976b9b589ffe4030a084243bcc5e937dcb9c571cdb94d3ff08b4fb4 + sha256sums = 42d3b86206d6ab80c79a16d7c1dcdcd478cb975d5155c9971744c2dd981c4577 pkgname = heimdall-git @@ -6,7 +6,7 @@ pkgname=heimdall-git _pkgname=Heimdall -pkgver=1.4.2.r9.g92be54f +pkgver=1.4.2.r10.g3997d5c pkgrel=1 pkgdesc="Tool suite used to flash firmware (ROMs) onto Samsung Galaxy S devices" arch=("i686" "x86_64") @@ -20,17 +20,23 @@ provides=("heimdall") source=( "$_pkgname::git+https://github.com/Benjamin-Dobell/Heimdall" "heimdall.desktop" + "reset-device.patch" ) -sha256sums=( - "SKIP" - "439cea1a8976b9b589ffe4030a084243bcc5e937dcb9c571cdb94d3ff08b4fb4" -) +sha256sums=('SKIP' + '439cea1a8976b9b589ffe4030a084243bcc5e937dcb9c571cdb94d3ff08b4fb4' + '42d3b86206d6ab80c79a16d7c1dcdcd478cb975d5155c9971744c2dd981c4577') pkgver() { cd $_pkgname git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' } +prepare() { + cd "$srcdir/$_pkgname" + + patch -p1 -i "$srcdir/reset-device.patch" +} + build() { cd "$srcdir/$_pkgname" diff --git a/reset-device.patch b/reset-device.patch new file mode 100644 index 000000000000..6ca2e620cad4 --- /dev/null +++ b/reset-device.patch @@ -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!"); |