summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Shvits2020-06-06 19:48:55 +0300
committerEvgeny Shvits2020-06-06 19:48:55 +0300
commita6fae6c03f375fa448d796647f9e14c51e28c3a2 (patch)
treebfa9e10435fb577fc41f04616a7f57adf33522e3
parent832bd98a841943d731e26180f88d73b18493e6c5 (diff)
downloadaur-ch341eepromtool.tar.gz
PATCH: fix ch341funcs.c for new libusb and add extern in *readbuf
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD16
-rw-r--r--extern_readbuf.patch13
-rw-r--r--libusb_set_option.patch18
4 files changed, 49 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 96bee779031e..24b2fdb388e2 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,14 +1,18 @@
pkgbase = ch341eepromtool
pkgdesc = An i2c serial EEPROM programming tool for the WCH CH341A
pkgver = 0.5
- pkgrel = 2
+ pkgrel = 3
url = https://github.com/stefanct/ch341eepromtool
arch = i686
arch = x86_64
license = GPL3
depends = libusb>=1
source = git+https://github.com/stefanct/ch341eepromtool.git#commit=6b41e07
+ source = libusb_set_option.patch
+ source = extern_readbuf.patch
md5sums = SKIP
+ md5sums = 9c2db0e0c9e72be4d9d8e6544e75c34b
+ md5sums = 5409cb99d67bbe4decab130e4c688c74
pkgname = ch341eepromtool
diff --git a/PKGBUILD b/PKGBUILD
index 3acd37ee2e98..ee9f968bc4fa 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,15 +2,25 @@
pkgname=ch341eepromtool
pkgver=0.5
-pkgrel=2
+pkgrel=3
_git_commit="6b41e07"
pkgdesc="An i2c serial EEPROM programming tool for the WCH CH341A"
arch=('i686' 'x86_64')
url="https://github.com/stefanct/ch341eepromtool"
license=('GPL3')
depends=('libusb>=1')
-source=("git+https://github.com/stefanct/ch341eepromtool.git#commit=${_git_commit}")
-md5sums=('SKIP')
+source=("git+https://github.com/stefanct/ch341eepromtool.git#commit=${_git_commit}"
+ "libusb_set_option.patch"
+ "extern_readbuf.patch")
+md5sums=('SKIP'
+ '9c2db0e0c9e72be4d9d8e6544e75c34b'
+ '5409cb99d67bbe4decab130e4c688c74')
+
+prepare() {
+ cd "${srcdir}/${pkgname}"
+ patch -p1 --input="${srcdir}/libusb_set_option.patch"
+ patch -p1 --input="${srcdir}/extern_readbuf.patch"
+}
build() {
cd "${srcdir}/${pkgname}"
diff --git a/extern_readbuf.patch b/extern_readbuf.patch
new file mode 100644
index 000000000000..c0cdebf212cb
--- /dev/null
+++ b/extern_readbuf.patch
@@ -0,0 +1,13 @@
+diff --git a/ch341funcs.c b/ch341funcs.c
+index 3bed06b..55ba7cf 100644
+--- a/ch341funcs.c
++++ b/ch341funcs.c
+@@ -30,7 +30,7 @@ extern FILE *debugout, *verbout;
+ uint32_t getnextpkt; // set by the callback function
+ uint32_t syncackpkt; // synch / ack flag used by BULK OUT cb function
+ uint16_t byteoffset;
+-uint8_t *readbuf;
++extern uint8_t *readbuf;
+
+ // --------------------------------------------------------------------------
+ // ch341configure()
diff --git a/libusb_set_option.patch b/libusb_set_option.patch
new file mode 100644
index 000000000000..c0020538c91c
--- /dev/null
+++ b/libusb_set_option.patch
@@ -0,0 +1,18 @@
+diff --git a/ch341funcs.c b/ch341funcs.c
+index 23c5236..3bed06b 100644
+--- a/ch341funcs.c
++++ b/ch341funcs.c
+@@ -58,8 +58,12 @@ struct libusb_device_handle *ch341configure(uint16_t vid, uint16_t pid) {
+ fprintf(stderr, "Couldnt initialise libusb\n");
+ return NULL;
+ }
+-
++
++#if LIBUSB_API_VERSION < 0x01000106
+ libusb_set_debug(NULL, 3); // maximum debug logging level
++#else
++ libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, 3);
++#endif
+
+ fprintf(verbout, "Searching USB buses for WCH CH341a i2c EEPROM programmer [%04x:%04x]\n",
+ USB_LOCK_VENDOR, USB_LOCK_PRODUCT);