[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnokii 0.6.29 and 0.6.32 master segfaults

From: Charles
Subject: Re: gnokii 0.6.29 and 0.6.32 master segfaults
Date: Wed, 25 Apr 2012 10:15:51 +0530
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120404 Thunderbird/11.0.1

On 24/04/12 21:30, address@hidden wrote:
> the other place to check is in libusb
> if you can compile it from sources with debug symbols, then gdb will
> tell the exact line else you will need to add printf's in file usb.c
> in function usb_get_string_simple()
> eg. printf("%d %d %d\n", di, si, tbuf[0]); just inside the for loop
> (line 261 in my copy):
>   for (di = 0, si = 2; si < tbuf[0]; si += 2) {

Tried that but ther eis nu usb.c in the source.

The sources distributed with Slackware64 13.37 are:
325K May  5  2010 libusb-1.0.8.tar.bz2
246K Dec  1  2009 libusb-compat-0.1.3.tar.bz2
 322 Mar 25  2011 libusb.fix.debug.log.level.diff.gz

After running the standard build, I could not find usb.c:

address@hidden:~# find /tmp -name '*.c'

Function usb_get_string_simple is defined in

address@hidden:~# for f in $( find /tmp -name '*.c' )
  do buf=$( grep usb_get_string_simple $f)
  [[ $buf ]] && echo $f:$'\n'"$buf"
      ret = usb_get_string_simple(udev, dev->descriptor.iManufacturer,
string, sizeof(string));
      ret = usb_get_string_simple(udev, dev->descriptor.iProduct,
string, sizeof(string));
      ret = usb_get_string_simple(udev, dev->descriptor.iSerialNumber,
string, sizeof(string));
API_EXPORTED int usb_get_string_simple(usb_dev_handle *dev, int desc_index,

But that is a compatibility function with no for loop:

API_EXPORTED int usb_get_string_simple(usb_dev_handle *dev, int desc_index,
    char *buf, size_t buflen)
    int r;
    r = libusb_get_string_descriptor_ascii(dev->handle, desc_index & 0xff,
        buf, (int) buflen);
    if (r >= 0)
        return r;
    return compat_err(r);

Presumably the new function is libusb_get_string_descriptor_ascii which
is defined in libusb-1.0.8/libusb/descriptor.c and includes a for loop
matching your description.  After adding the debug it looks like:

    for (di = 0, si = 2; si < tbuf[0]; si += 2) {
        printf("%d %d %d\n", di, si, tbuf[0]);
        if (di >= (length - 1))

        if (tbuf[si + 1]) /* high byte */
            data[di++] = '?';
            data[di++] = tbuf[si];

But that does not compile:

address@hidden:/tmp/libusb-1.0.8# make
descriptor.c: In function ‘libusb_get_string_descriptor_ascii’:
descriptor.c:707:1: error: implicit declaration of function ‘printf’
descriptor.c:707:1: warning: incompatible implicit declaration of
built-in function ‘printf’

reply via email to

[Prev in Thread] Current Thread [Next in Thread]