[Nut-upsdev] libusb_get_string: invalid argument

Charles Lepple clepple at gmail.com
Wed Jun 10 03:10:44 UTC 2015

On Jun 9, 2015, at 4:55 PM, Greg Hersch wrote:

> (gdb) bt
> #0  libusb_get_string (udev=0x43110, StringIdx=0, buf=0x40204 <buf>
> "", buflen=20) at libusb.c:496
> #1  0x00015330 in HIDGetIndexString (udev=<optimized out>,
> Index=<optimized out>, buf=0x40204 <buf> "", buflen=<optimized out>)
> at libhid.c:407
> #2  0x00012e18 in ups_infoval_set (item=0x3ee48 <tripplite_hid2nut>,
> value=<optimized out>) at usbhid-ups.c:1552
> #3  0x00013da8 in upsdrv_updateinfo () at usbhid-ups.c:835
> #4  0x00012410 in main (argc=<optimized out>, argv=<optimized out>) at
> main.c:708

You did everything right on the backtrace, but that is puzzling.

At #2, ups_infoval_set() apparently calls HIDGetIndexString(), but I don't see where it does that in the code. There must be some pointers, or something.

The easiest thing might be to crank the debug output up a bit more (5x -D, even) but since that will be a bit more output, please redirect it to a file, and gzip the log before attaching it. Doesn't need to be long, just enough to see one or two errors.

Another idea is to recompile without optimizations, to see if that helps the gdb backtrace. NUT apparently sets CFLAGS=-O if it is not set already, so adding "CFLAGS=-g" to the ./configure line should do it.

Arnaud, am I missing something obvious here? After making "device.part" HU_STATIC, there shouldn't be any other string descriptors retrieved in drivers/tripplite-hid.c.

Charles Lepple
clepple at gmail

More information about the Nut-upsdev mailing list