From: Michael Gernoth Date: Sat, 29 Mar 2008 12:51:08 +0000 (+0100) Subject: Fix 32-bit ISE 10.1 on 64-bit platform. X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/usb-driver/commitdiff_plain/c42237a305a64d46ed4fa4cf2c974abd09486be7?ds=sidebyside Fix 32-bit ISE 10.1 on 64-bit platform. When trying to access a cable with this combination, ISE displays the following error: "Cable operation is not supported when running the 32-bit version of the application on a 64-bit platform." This is fixed by additionally overloading the uname function and replacing x86_64 by i686 in the returned struct in the 32-bit version of this library. The 64-bit version will still correctly return x86_64. --- diff --git a/usb-driver.c b/usb-driver.c index 5d1528e..def52db 100644 --- a/usb-driver.c +++ b/usb-driver.c @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include "usb-driver.h" #include "config.h" @@ -937,3 +939,21 @@ int access(const char *pathname, int mode) { return (*func)(pathname, mode); } } + +#if __WORDSIZE == 32 +int uname (struct utsname *__name) { + static int (*func) (struct utsname*); + int ret; + + if (!func) + func = (int (*) (struct utsname*)) dlsym(RTLD_NEXT, "uname"); + + ret = (*func)(__name); + + if (ret == 0 && (!strcmp(__name->machine, "x86_64"))) { + strcpy(__name->machine, "i686"); + } + + return ret; +} +#endif