]> git.zerfleddert.de Git - usb-driver/commitdiff
Dynamically search for /proc/sys/dev/parport/%s/base-addr
authorMichael Gernoth <michael@gernoth.net>
Mon, 24 May 2010 13:12:14 +0000 (15:12 +0200)
committerMichael Gernoth <michael@gernoth.net>
Mon, 24 May 2010 13:12:14 +0000 (15:12 +0200)
usb-driver.c

index 69ee972c46169a186d3043f9df41742125949c76..ed7893262da4be37b5daf90c2b3fb5fe27634b9e 100644 (file)
@@ -677,25 +677,22 @@ long int _Z14isModuleLoadedPci(char *module_name, int i) {
 /* XilCommNS::CPortResources::Instance() */
 void* _ZN9XilCommNS14CPortResources8InstanceEv() {
        static void* (*func) (void) = NULL;
-       static char *NetString = NULL;
-       static char *NetString2 = NULL;
        char *filename = NULL;
        void *ret;
+       int i;
 
-       if (!func)
+       if (!func) {
                func = (void* (*) (void)) dlsym(RTLD_NEXT, "_ZN9XilCommNS14CPortResources8InstanceEv");
 
-       if (!NetString)
-               NetString = (char*)dlsym(RTLD_NEXT, "_ZTSN9XilCommNS9NetStringE");
-
-       if (!NetString2)
-               NetString2 = (char*)dlsym(RTLD_NEXT, "_ZTIN9XilCommNS9NetStringE");
-       
-       if (NetString && (!strcmp((char*)(NetString+0xb0), "/proc/sys/dev/parport/%s/base-addr")))
-               filename = (char*)(NetString+0xb0);
-
-       if (NetString2 && (!strcmp((char*)(NetString2+0xa4), "/proc/sys/dev/parport/%s/base-addr")))
-               filename = (char*)(NetString2+0xa4);
+               DPRINTF("Searching for filename starting at %p\n", func);
+               for(i = 0; i < 16384; i++) {
+                       if (!strcmp(((char*)func)+i, "/proc/sys/dev/parport/%s/base-addr")) {
+                               filename = ((char*)func)+i;
+                               DPRINTF("Filename found at offset %p\n", (void*)(filename - ((char*)func)));
+                               break;
+                       }
+               }
+       }
 
        if (filename) {
                long pagesize;
Impressum, Datenschutz