gnokii-users
[Top][All Lists]
Advanced

[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'
/tmp/libusb-1.0.8/examples/dpfp.c
/tmp/libusb-1.0.8/examples/dpfp_threaded.c
/tmp/libusb-1.0.8/examples/lsusb.c
/tmp/libusb-1.0.8/libusb/core.c
/tmp/libusb-1.0.8/libusb/descriptor.c
/tmp/libusb-1.0.8/libusb/io.c
/tmp/libusb-1.0.8/libusb/os/darwin_usb.c
/tmp/libusb-1.0.8/libusb/os/linux_usbfs.c
/tmp/libusb-1.0.8/libusb/sync.c
/tmp/libusb-compat-0.1.3/examples/lsusb.c
/tmp/libusb-compat-0.1.3/examples/testlibusb.c
/tmp/libusb-compat-0.1.3/libusb/core.c

Function usb_get_string_simple is defined in
libusb-compat-0.1.3/libusb/core.c:

address@hidden:~# for f in $( find /tmp -name '*.c' )
  do buf=$( grep usb_get_string_simple $f)
  [[ $buf ]] && echo $f:$'\n'"$buf"
done
/tmp/libusb-compat-0.1.3/examples/testlibusb.c:
      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));
/tmp/libusb-compat-0.1.3/libusb/core.c:
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))
            break;

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

But that does not compile:

address@hidden:/tmp/libusb-1.0.8# make
[snip]
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’
[snip]



reply via email to

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