[Lunar-commits] <moonbase-other> libftdi1: fix critical bug

v4hn me at v4hn.de
Mon Sep 1 18:59:50 CEST 2014


commit b5ca1ce5b6b47e1cb7e52170fe8041c0ede8d470
Author: v4hn <me at v4hn.de>
Date: Mon, 01 Sep 2014 18:57:56 +0200
URL: https://github.com/lunar-linux/moonbase-other/commit/b5ca1ce5b6b47e1cb7e52170fe8041c0ede8d470

libftdi1: fix critical bug

This broke the standard Context::open function...
---
  devel/libftdi1/PRE_BUILD                        | +3/-1     
  devel/libftdi1/libftdi1-1.1-no-double-open.diff | +21/-0    
  2 files changed, 24 insertions(+), 1 deletion(-)

--- a/devel/libftdi1/PRE_BUILD
+++ b/devel/libftdi1/PRE_BUILD
@@ -1,4 +1,6 @@
 default_pre_build &&
 
 # make cmake report correct C++ library
-sedit 's/ftdi1pp/ftdipp1/' CMakeLists.txt
+sedit 's/ftdi1pp/ftdipp1/' CMakeLists.txt &&
+
+patch_it $SCRIPT_DIRECTORY/libftdi1-1.1-no-double-open.diff 1
--- /dev/null
+++ b/devel/libftdi1/libftdi1-1.1-no-double-open.diff
@@ -0,0 +1,21 @@
+commit bc3841238bac9cb6955848fd661bbf19a5ed42c6
+Author: Denis Sirotkin <reg.libftdi at demitel.ru>
+Date:   Fri May 16 17:40:13 2014 +0200
+
+    ftdi_usb_get_strings(): Don't try to open an already open device
+
+diff --git a/src/ftdi.c b/src/ftdi.c
+index b6caf6c..add6dc2 100644
+--- a/src/ftdi.c
++++ b/src/ftdi.c
+@@ -413,8 +413,8 @@ int ftdi_usb_get_strings(struct ftdi_context * ftdi, struct libusb_device * dev,
+     if ((ftdi==NULL) || (dev==NULL))
+         return -1;
+ 
+-    if (libusb_open(dev, &ftdi->usb_dev) < 0)
+-        ftdi_error_return(-4, "libusb_open() failed");
++    if (ftdi->usb_dev == NULL && libusb_open(dev, &ftdi->usb_dev) < 0)
++            ftdi_error_return(-4, "libusb_open() failed");
+ 
+     if (libusb_get_device_descriptor(dev, &desc) < 0)
+         ftdi_error_return(-11, "libusb_get_device_descriptor() failed");




More information about the Lunar-commits mailing list