libftdi-git Archives

Subject: A library to talk to FTDI chips branch, master, updated. v0.17-7-g7af8680

From: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
To: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 4 Jan 2010 10:49:30 +0100 (CET)
The branch, master has been updated
       via  7af868049039b92400d0e3819179bc636c5aa715 (commit)
       via  3d0099ee1c704388a5300474900daed44f18f75e (commit)
       via  c56d1f385d1f03f7e55b91dfc3f07007a6a562f4 (commit)
      from  3c287e728650079b6024521c6d06b17a707c2f62 (commit)


- Log -----------------------------------------------------------------
commit 7af868049039b92400d0e3819179bc636c5aa715
Author: Mike Frysinger <vapier@xxxxxxxxxx>
Date:   Tue Dec 29 03:48:59 2009 -0500

    AX_BOOST_BASE: fix host boost search when cross-compiling
    
    The AX_BOOST_BASE macro likes to do searches in the host paths (/usr and
    such) which is obviously incorrect for cross-compiling.  So disable these
    fallback searches when cross-compiling.
    
    Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>

commit 3d0099ee1c704388a5300474900daed44f18f75e
Author: Mike Frysinger <vapier@xxxxxxxxxx>
Date:   Tue Dec 29 03:37:15 2009 -0500

    avoid PATH_MAX/string copies usage
    
    The new ftdi_usb_open_string() func breaks mingw builds where PATH_MAX is
    not defined.  Rather than adding fallback code, compare the path strings
    piece by piece to avoid the string copy overhead in the process.
    
    Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>

commit c56d1f385d1f03f7e55b91dfc3f07007a6a562f4
Author: Mike Frysinger <vapier@xxxxxxxxxx>
Date:   Tue Dec 29 02:44:36 2009 -0500

    python: fix typo in top_builddir
    
    Missing a "d" in the var name.
    
    Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>

-----------------------------------------------------------------------

Summary of changes:
 acinclude.m4                |   41 ++++++++++++++++++++++-------------------
 bindings/python/setup.py.in |    2 +-
 src/ftdi.c                  |   16 ++++++++++++----
 3 files changed, 35 insertions(+), 24 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 80b33bf..6d10141 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -86,7 +86,7 @@ if test "x$want_boost" = "xyes"; then
        if test "$ac_boost_path" != ""; then
                BOOST_LDFLAGS="-L$ac_boost_path/lib"
                BOOST_CPPFLAGS="-I$ac_boost_path/include"
-       else
+       elif test "$cross_compiling" != yes; then
                for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
                        if test -d "$ac_boost_path_tmp/include/boost" && test 
-r "$ac_boost_path_tmp/include/boost"; then
                                BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
@@ -146,25 +146,28 @@ if test "x$want_boost" = "xyes"; then
                                done
                        fi
                else
-                       for ac_boost_path in /usr /usr/local /opt /opt/local ; 
do
-                               if test -d "$ac_boost_path" && test -r 
"$ac_boost_path"; then
-                                       for i in `ls -d 
$ac_boost_path/include/boost-* 2>/dev/null`; do
-                                               _version_tmp=`echo $i | sed 
"s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
-                                               V_CHECK=`expr $_version_tmp \> 
$_version`
-                                               if test "$V_CHECK" = "1" ; then
-                                                       _version=$_version_tmp
-                                                       best_path=$ac_boost_path
-                                               fi
-                                       done
+                       if test "$cross_compiling" != yes; then
+                               for ac_boost_path in /usr /usr/local /opt 
/opt/local ; do
+                                       if test -d "$ac_boost_path" && test -r 
"$ac_boost_path"; then
+                                               for i in `ls -d 
$ac_boost_path/include/boost-* 2>/dev/null`; do
+                                                       _version_tmp=`echo $i | 
sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+                                                       V_CHECK=`expr 
$_version_tmp \> $_version`
+                                                       if test "$V_CHECK" = 
"1" ; then
+                                                               
_version=$_version_tmp
+                                                               
best_path=$ac_boost_path
+                                                       fi
+                                               done
+                                       fi
+                               done
+
+                               VERSION_UNDERSCORE=`echo $_version | sed 
's/\./_/'`
+                               
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
+                               if test "$ac_boost_lib_path" = ""
+                               then
+                                       BOOST_LDFLAGS="-L$best_path/lib"
                                fi
-                       done
-
-                       VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
-                       
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
-            if test "$ac_boost_lib_path" = ""
-            then
-               BOOST_LDFLAGS="-L$best_path/lib"
-            fi
+
+                       fi
 
                        if test "x$BOOST_ROOT" != "x"; then
                                if test -d "$BOOST_ROOT" && test -r 
"$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r 
"$BOOST_ROOT/stage/lib"; then
diff --git a/bindings/python/setup.py.in b/bindings/python/setup.py.in
index b9ed07e..0cc7c4a 100644
--- a/bindings/python/setup.py.in
+++ b/bindings/python/setup.py.in
@@ -12,6 +12,6 @@ setup(name='@PACKAGE_NAME@',
       py_modules=['ftdi'],
       ext_modules=[Extension('_ftdi', ['ftdi_wrap.c'],
                              include_dirs=['@top_srcdir@/src'],
-                             
library_dirs=['@top_buildir@/src/.libs','lib','/usr/lib'],
+                             
library_dirs=['@top_builddir@/src/.libs','lib','/usr/lib'],
                              libraries=['ftdi'])],
       )
diff --git a/src/ftdi.c b/src/ftdi.c
index 6068e7e..9740fca 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -715,7 +715,6 @@ int ftdi_usb_open_string(struct ftdi_context *ftdi, const 
char* description)
     {
         struct usb_bus *bus;
         struct usb_device *dev;
-        char dev_name[PATH_MAX+1];
 
         usb_init();
 
@@ -728,9 +727,18 @@ int ftdi_usb_open_string(struct ftdi_context *ftdi, const 
char* description)
         {
             for (dev = bus->devices; dev; dev = dev->next)
             {
-                snprintf(dev_name, sizeof(dev_name), 
"%s/%s",bus->dirname,dev->filename);
-                if (strcmp(description+2,dev_name) == 0)
-                    return ftdi_usb_open_dev(ftdi, dev);
+                /* XXX: This doesn't handle symlinks/odd paths/etc... */
+                const char *desc = description + 2;
+                size_t len = strlen(bus->dirname);
+                if (strncmp(desc, bus->dirname, len))
+                    continue;
+                desc += len;
+                if (desc[0] != '/')
+                    continue;
+                ++desc;
+                if (strcmp(desc, dev->filename))
+                    continue;
+                return ftdi_usb_open_dev(ftdi, dev);
             }
         }
 


hooks/post-receive
-- 
A library to talk to FTDI chips

--
libftdi-git - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi-git+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread
  • A library to talk to FTDI chips branch, master, updated. v0.17-7-g7af8680, libftdi-git <=