aboutsummaryrefslogtreecommitdiffstats
path: root/community/stlink/0001-Fix-libusb-function-deprecation-used-for-stlinkv1.patch
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2018-04-14 15:53:46 +0200
committerSören Tempel <soeren+git@soeren-tempel.net>2018-04-14 15:53:46 +0200
commit4f0c2f0544679d9970e8107633125eab0cc7caa0 (patch)
tree76dbcc62996bd63cf2afded37c1de78672347a5b /community/stlink/0001-Fix-libusb-function-deprecation-used-for-stlinkv1.patch
parent41dc189d256d90aa5efaef1a858991133482767e (diff)
downloadaports-4f0c2f0544679d9970e8107633125eab0cc7caa0.tar.bz2
aports-4f0c2f0544679d9970e8107633125eab0cc7caa0.tar.xz
community/stlink: fix build with libusb >= 1.0.22
See: https://github.com/texane/stlink/issues/703
Diffstat (limited to 'community/stlink/0001-Fix-libusb-function-deprecation-used-for-stlinkv1.patch')
-rw-r--r--community/stlink/0001-Fix-libusb-function-deprecation-used-for-stlinkv1.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/community/stlink/0001-Fix-libusb-function-deprecation-used-for-stlinkv1.patch b/community/stlink/0001-Fix-libusb-function-deprecation-used-for-stlinkv1.patch
new file mode 100644
index 0000000000..e9e9161d91
--- /dev/null
+++ b/community/stlink/0001-Fix-libusb-function-deprecation-used-for-stlinkv1.patch
@@ -0,0 +1,40 @@
+From aaf8e92075811e6b78cd7f68b636c642f27749bf Mon Sep 17 00:00:00 2001
+From: Slyshyk Oleksiy <alexSlyshyk@gmail.com>
+Date: Sun, 1 Apr 2018 20:16:49 +0300
+Subject: [PATCH] Fix libusb function deprecation used for stlinkv1
+
+Fixes #703
+---
+ src/sg.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/src/sg.c b/src/sg.c
+index 541ef55..90a1441 100644
+--- a/src/sg.c
++++ b/src/sg.c
+@@ -944,6 +944,10 @@ static stlink_t* stlink_open(const int verbose) {
+ struct stlink_libsg *slsg = malloc(sizeof (struct stlink_libsg));
+ if (sl == NULL || slsg == NULL) {
+ WLOG("Couldn't malloc stlink and stlink_sg structures out of memory!\n");
++ if(sl != NULL)
++ free(sl);
++ if(slsg != NULL)
++ free(slsg);
+ return NULL;
+ }
+
+@@ -954,7 +958,11 @@ static stlink_t* stlink_open(const int verbose) {
+ return NULL;
+ }
+
++#if LIBUSBX_API_VERSION < 0x01000106
+ libusb_set_debug(slsg->libusb_ctx, 3);
++#else
++ libusb_set_option(slsg->libusb_ctx, LIBUSB_OPTION_LOG_LEVEL, 3);
++#endif
+
+ slsg->usb_handle = libusb_open_device_with_vid_pid(slsg->libusb_ctx, STLINK_USB_VID_ST, STLINK_USB_PID_STLINK);
+ if (slsg->usb_handle == NULL) {
+--
+2.17.0
+