The ctypes.util.find_library() function in Python 2.6.4 is currently
broken on MIPS platforms.
Which mostly affects OpenWrt users running Linux on MIPS based access points.

The attached patches include a quick fix around that problem for PyUSB 1.0.

cu andreas
Index: usb/backend/libusb01.py
===================================================================
--- a/usb/backend/libusb01.py	2010-04-13 20:15:19.000000000 +0200
+++ b/usb/backend/libusb01.py	2010-06-23 14:24:04.614797173 +0200
@@ -176,6 +176,14 @@
                 return CDLL('cygusb0.dll')
             except:
                 _logger.error('Libusb 0 could not be loaded in cygwin', exc_info=True)
+        
+        # Fix for broken util.find_library on OpenWRT / MIPS plattforms       
+        elif os.uname()[4] == 'mips':
+            try:
+                return CDLL('libusb-0.1.so.4')
+            except:
+                _logger.error('Libusb 0 could not be loaded', exc_info=True)
+            
 
         raise OSError('USB library could not be found')
     return CDLL(libname)
Index: usb/backend/libusb10.py
===================================================================
--- a/usb/backend/libusb10.py	2010-04-13 20:15:19.000000000 +0200
+++ b/usb/backend/libusb10.py	2010-06-23 14:24:04.614797173 +0200
@@ -28,6 +28,7 @@
 
 from ctypes import *
 import ctypes.util
+import os
 import usb.util
 import array
 import sys
@@ -156,6 +157,12 @@
                 return CDLL('cygusb-1.0-0.dll')
             except Exception:
                 _logger.error('Libusb 1.0 could not be loaded in cygwin', exc_info=True)
+        # Fix for broken util.find_library on OpenWRT / MIPS plattforms       
+        elif os.uname()[4] == 'mips':
+            try:
+                return CDLL('libusb-1.0.so')
+            except:
+                _logger.error('Libusb 1.0 could not be loaded', exc_info=True)
 
         raise OSError('USB library could not be found')
     # Windows backend uses stdcall calling convention
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to