Bug report:

while compiling ccid.0.9.2 on a Red Hat Enterprise Linux AS Release 3 (Taroon Update 
2), with the following usb RPM's:

libusb-devel-0.1.6-3
usbutils-0.11-1
libusb-0.1.6-3


ccid complains about a compile error. 

parse.c: In function `ccid_parse_interface_descriptor':
parse.c:104: warning: implicit declaration of function `usb_get_string_simple'
/bin/sh ../libtool --mode=link gcc  -g -O2 -Wall   -o parse  parse-tokenparser.o 
parse-parse.o parse-debug.o libccid.la
gcc -g -O2 -Wall -o .libs/parse parse-tokenparser.o parse-parse.o parse-debug.o  
./.libs/libccid.so -Wl,--rpath -Wl,/local/lib
parse-parse.o(.text+0xe0): In function `ccid_parse_interface_descriptor':
/local/pcsc/src/ccid-0.9.2/src/parse.c:104: undefined reference to 
`usb_get_string_simple'
parse-parse.o(.text+0x110):/local/pcsc/src/ccid-0.9.2/src/parse.c:110: undefined 
reference to `usb_get_string_simple'
collect2: ld returned 1 exit status
make: *** [parse] Error 1





Apparently /usr/include/usb.h does not have definitions for 

        usb_get_string_simple
and
        usb_get_string

They are also missing from the library.


I fixed the problem by adding the following ugly UGLY patch. I simply cut 
and pasted the missing routines from libusb-0.1.7 into parse.c and put a ifdef around 
it.

I don't know how you want to handle it, but I figured I'd post the patch here for 
archival purposes, in case someone else needs to do the same thing.





--- parse.c.~1~ 2004-10-08 11:36:20.000000000 -0400
+++ parse.c     2004-10-13 15:20:02.000000000 -0400
@@ -33,6 +33,15 @@
 #include "ccid_ifdhandler.h"
 #include "ccid.h"
 
+#define OLD_USB
+#ifdef OLD_USB
+#include <asm/errno.h>
+int usb_get_string(usb_dev_handle *dev, int index, int langid, char *buf,
+        size_t buflen);
+int usb_get_string_simple(usb_dev_handle *dev, int index, char *buf,
+        size_t buflen);
+#endif
+
 #ifndef TRUE
 #define TRUE 1
 #define FALSE 0
@@ -101,6 +110,7 @@
        /*
         * Vendor/model name
         */
+
        if (usb_get_string_simple(handle, dev->descriptor.iManufacturer,
                buffer, sizeof(buffer)) < 0)
                printf(" Can't get iManufacturer string\n");
@@ -262,3 +272,43 @@
        return FALSE;
 } /* ccid_parse_interface_descriptor */
 
+
+#ifdef OLD_USB
+int usb_get_string(usb_dev_handle *dev, int index, int langid, char *buf, size_t 
buflen)
+{
+  return usb_control_msg(dev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR,
+                        (USB_DT_STRING << 8) + index, langid, buf, buflen, 1000);
+}
+                                                                                
+int usb_get_string_simple(usb_dev_handle *dev, int index, char *buf, size_t buflen)
+{
+  char tbuf[256];
+  int ret, langid, si, di;
+                                                                                
+  ret = usb_get_string(dev, index, 0, tbuf, sizeof(tbuf));
+  if (ret < 0)
+    return ret;
+                                                                                
+ if (ret < 4)
+    return -EIO;
+                                                                                
+  langid = tbuf[2] | (tbuf[3] << 8);
+                                                                                
+  ret = usb_get_string(dev, index, langid, tbuf, sizeof(tbuf));
+  if (ret < 0)
+    return ret;
+                                                                                
+  for (di = 0, si = 2; si < ret; si += 2) {
+    if (di >= (buflen - 1))
+      break;
+                                                                                
+    if (tbuf[si + 1])   /* high byte */
+      buf[di++] = '?';
+    else
+      buf[di++] = tbuf[si];
+  }
+                                                                                
+  buf[di] = 0;
+  return di;
+}
+#endif
_______________________________________________
Muscle mailing list
[EMAIL PROTECTED]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to