[Nut-upsdev] libusb_get_string: invalid argument
Greg Hersch
hersch.greg at gmail.com
Tue Jun 9 20:55:08 UTC 2015
On Mon, Jun 8, 2015 at 11:20 PM, Charles Lepple <clepple at gmail.com> wrote:
> On Jun 8, 2015, at 8:23 PM, Greg Hersch <hersch.greg at gmail.com> wrote:
>
>> Hi Charles. I patched, reconfigured, remake'd, remake install'd - but
>> no change. however, some more likely helpful information below for
>> you. Thank you
>
> Odd. Are you sure that the new version of usbhid-ups got installed to the same path you are running? Also, there is no protection against running two drivers if one is in debug mode. Please check that usbhid-ups is not still running in the background from an earlier run.
>
> You can also add some text to the version string in drivers/tripplite-hid.c - it will show up as "Using subdriver: TrippLite HID 0.81" in the stock version.
I have done this and verified - here is my output from
/usr/local/ups/sbin/upsdrvctl start:. You can see the "MODIFIED" tag i
placed in the code
Network UPS Tools - UPS driver controller 2.7.3
Network UPS Tools - Generic HID driver 0.39 (2.7.3)
USB communication driver 0.32
Using subdriver: TrippLite HID 0.81_MODIFIED
>
>> On Mon, Jun 8, 2015 at 12:34 PM, Greg Hersch <hersch.greg at gmail.com> wrote:
>>>
>>>
>>> On Sun, 7 Jun 2015, Charles Lepple wrote:
>>>
>>>> [please use reply-all to include the list, as the list does not override
>>>> the Reply-To header.]
>>>>
>>>> On Jun 7, 2015, at 5:02 PM, Greg Hersch <hersch.greg at gmail.com> wrote:
>>>>
>>>>> Here is the driver debug log. If I just let it run, it pops up with
>>>>> libusb_get_string_invalid argument over and over again, mixed in the
>>>>> debug output. seems to be several issues reported in the log, but they
>>>>> arent easily interpreted.
>>>>
>>>>
>>>> Does the libusb_get_string error occur only every 30 seconds or so?
>>>
>>>
>>> Yes - thats correct. perhaps more like every 15 sec.
>>
>> I was incorrect. they occur every 6 seconds. and there are two of them
>> each time.
>> hopefully that narrows it down!
>
> Unfortunately, no. I was thinking either every 30 seconds or every two seconds, and I'm not sure why they would occur two at a time every six seconds.
>
> I'm not sure if we have enough log messages in the code already. If you can use GDB, you could do something like the following:
>
> gdb /usr/local/ups/bin/usbhid-ups
> ...
> (gdb) break libusb_get_string
> (gdb) run -DD -a tripplite
> ...
> (gdb) c
> ...
> (gdb) bt
>
> Keep pressing "c" until you get past the initial detection, which probably succeeds.
>
> That last line should print a backtrace showing which function called the offending function.
>
Okay - here is my attempt at doing that. i did a backtrace after i saw
the invalid argument line come up. let me know if thats right.
>~ % sudo gdb /usr/local/ups/bin/usbhid-ups
GNU gdb (GDB) 7.9.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "armv5tel-unknown-linux-gnueabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/ups/bin/usbhid-ups...done.
(gdb) break libusb_get_string
Breakpoint 1 at 0x16134: file libusb.c, line 496.
(gdb) run -DD -a tripplite
Starting program: /usr/local/ups/bin/usbhid-ups -DD -a tripplite
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Network UPS Tools - Generic HID driver 0.39 (2.7.3)
USB communication driver 0.32
0.000000 debug level is '2'
0.066603 upsdrv_initups...
0.080042 Checking device (09AE/1007) (001/006)
0.249698 - VendorID: 09ae
0.250669 - ProductID: 1007
0.251615 - Manufacturer: Tripp Lite
0.252487 - Product: TRIPP LITE UPS
0.253342 - Serial Number: FW-2263 E
0.254194 - Bus: 001
0.254709 Trying to match device
0.255059 Device matches
0.274850 HID descriptor length 447
0.752620 Report Descriptor size = 447
0.753610 Using subdriver: TrippLite HID 0.81_MODIFIED
0.769401 Path: UPS.PowerSummary.iProduct, Type: Feature,
ReportID: 0x28, Offset: 0, Size: 8, Value: 1
0.786121 Path: UPS.PowerSummary.iSerialNumber, Type: Feature,
ReportID: 0x29, Offset: 0, Size: 8, Value: 2
0.802865 Path: UPS.PowerSummary.iManufacturer, Type: Feature,
ReportID: 0x2b, Offset: 0, Size: 8, Value: 3
0.819524 Path: UPS.PowerSummary.Input.ConfigVoltage, Type:
Feature, ReportID: 0x30, Offset: 0, Size: 8, Value: 120
0.836279 Path: UPS.PowerSummary.AudibleAlarmControl, Type:
Feature, ReportID: 0x11, Offset: 0, Size: 8, Value: 2
0.852997 Path: UPS.PowerSummary.iDeviceChemistry, Type:
Feature, ReportID: 0x2a, Offset: 0, Size: 8, Value: 24
0.869730 Path: UPS.PowerSummary.CapacityMode, Type: Feature,
ReportID: 0x33, Offset: 0, Size: 8, Value: 2
0.886509 Path: UPS.PowerSummary.RunTimeToEmpty, Type: Input,
ReportID: 0x35, Offset: 0, Size: 16, Value: 1440
0.886923 Path: UPS.PowerSummary.RunTimeToEmpty, Type: Feature,
ReportID: 0x35, Offset: 0, Size: 16, Value: 1440
0.903240 Path: UPS.PowerSummary.RemainingCapacity, Type: Input,
ReportID: 0x34, Offset: 0, Size: 8, Value: 100
0.903393 Path: UPS.PowerSummary.RemainingCapacity, Type:
Feature, ReportID: 0x34, Offset: 0, Size: 8, Value: 100
0.919985 Path: UPS.PowerSummary.FullChargeCapacity, Type:
Feature, ReportID: 0x37, Offset: 0, Size: 8, Value: 100
0.936759 Path: UPS.PowerSummary.PresentStatus.ShutdownImminent,
Type: Input, ReportID: 0x32, Offset: 0, Size: 1, Value: 0
0.936859 Path: UPS.PowerSummary.PresentStatus.TLACPresent,
Type: Input, ReportID: 0x32, Offset: 1, Size: 1, Value: 1
0.936931 Path: UPS.PowerSummary.PresentStatus.TLCharging, Type:
Input, ReportID: 0x32, Offset: 2, Size: 1, Value: 1
0.936996 Path: UPS.PowerSummary.PresentStatus.TLDischarging,
Type: Input, ReportID: 0x32, Offset: 3, Size: 1, Value: 0
0.937062 Path:
UPS.PowerSummary.PresentStatus.TLNeedReplacement, Type: Input,
ReportID: 0x32, Offset: 4, Size: 1, Value: 0
0.937129 Path: UPS.PowerSummary.PresentStatus.ShutdownImminent,
Type: Feature, ReportID: 0x32, Offset: 0, Size: 1, Value: 0
0.937199 Path: UPS.PowerSummary.PresentStatus.ACPresent, Type:
Feature, ReportID: 0x32, Offset: 1, Size: 1, Value: 1
0.937265 Path: UPS.PowerSummary.PresentStatus.Charging, Type:
Feature, ReportID: 0x32, Offset: 2, Size: 1, Value: 1
0.937334 Path: UPS.PowerSummary.PresentStatus.Discharging,
Type: Feature, ReportID: 0x32, Offset: 3, Size: 1, Value: 0
0.937401 Path: UPS.PowerSummary.PresentStatus.NeedReplacement,
Type: Feature, ReportID: 0x32, Offset: 4, Size: 1, Value: 0
0.953533 Path: UPS.BatterySystem.Battery.ConfigVoltage, Type:
Feature, ReportID: 0x04, Offset: 0, Size: 16, Value: 12
0.970234 Path:
UPS.BatterySystem.Battery.PresentStatus.Charging, Type: Feature,
ReportID: 0x23, Offset: 0, Size: 1, Value: 1
0.970796 Path:
UPS.BatterySystem.Battery.PresentStatus.Discharging, Type: Feature,
ReportID: 0x23, Offset: 1, Size: 1, Value: 0
0.970928 Path:
UPS.BatterySystem.Battery.PresentStatus.NeedReplacement, Type:
Feature, ReportID: 0x23, Offset: 2, Size: 1, Value: 0
0.987027 Path: UPS.BatterySystem.Test, Type: Feature, ReportID:
0x10, Offset: 0, Size: 8, Value: 0
1.003749 Path: UPS.Flow.ConfigVoltage, Type: Feature, ReportID:
0x01, Offset: 0, Size: 8, Value: 120
1.020490 Path: UPS.Flow.ConfigFrequency, Type: Feature,
ReportID: 0x02, Offset: 0, Size: 8, Value: 60
1.037271 Path: UPS.Flow.ConfigApparentPower, Type: Feature,
ReportID: 0x03, Offset: 0, Size: 16, Value: 900
1.054007 Path: UPS.OutletSystem.Outlet.DelayBeforeShutdown,
Type: Feature, ReportID: 0x15, Offset: 0, Size: 16, Value: 65535
1.070622 Path: UPS.OutletSystem.Outlet.ffff0091, Type: Feature,
ReportID: 0x51, Offset: 0, Size: 8, Value: 0
1.087506 Path: UPS.OutletSystem.Outlet.TLWatchdog, Type:
Feature, ReportID: 0x52, Offset: 0, Size: 8, Value: 0
1.104124 Path: UPS.OutletSystem.Outlet.ffff00c7, Type: Feature,
ReportID: 0xb6, Offset: 0, Size: 8, Value: 1
1.121003 Path: UPS.TLCustom.[1].CommunicationProtocolVersion,
Type: Feature, ReportID: 0x6c, Offset: 0, Size: 16, Value: 4103
1.137767 Path: UPS.ffff0015.[1].ffff00c0, Type: Feature,
ReportID: 0x96, Offset: 0, Size: 8, Value: 255
1.154468 refresh_report_buffer: expected 5 bytes, but got 2 instead
1.154581 Path: UPS.ffff0015.[1].ffff00d2, Type: Feature,
ReportID: 0xb4, Offset: 0, Size: 32, Value: 255
1.171262 Path: UPS.ffff0015.[1].ffff00c1, Type: Feature,
ReportID: 0x97, Offset: 0, Size: 16, Value: 255
1.188284 Path: UPS.ffff0015.[1].ffff00c2, Type: Feature,
ReportID: 0x98, Offset: 0, Size: 8, Value: 255
1.205022 Path: UPS.ffff0015.[1].ffff00c3, Type: Feature,
ReportID: 0x99, Offset: 0, Size: 16, Value: 255
1.221761 Path: UPS.ffff0015.[1].ffff00c5, Type: Feature,
ReportID: 0x9b, Offset: 0, Size: 16, Value: 3
1.230623 libusb_get_report: Value too large for defined data type
1.231014 Can't retrieve Report c2: Value too large for defined data type
1.231393 Path: UPS.ffff0015.[1].ffff00d6, Type: Feature,
ReportID: 0xc2, Offset: 0, Size: 32
1.238633 libusb_get_report: Value too large for defined data type
1.238766 Can't retrieve Report 9a: Value too large for defined data type
1.239023 Path: UPS.ffff0015.[1].ffff00c4, Type: Feature,
ReportID: 0x9a, Offset: 0, Size: 32
1.239478 Report descriptor retrieved (Reportlen = 447)
1.239577 Found HID device
1.239934 Detected a UPS: Tripp Lite /TRIPP LITE UPS
1.240468 Path: UPS.PowerSummary.RemainingCapacity, Type:
Feature, ReportID: 0x34, Offset: 0, Size: 8, Value: 100
1.241196 Path: UPS.PowerSummary.RunTimeToEmpty, Type: Feature,
ReportID: 0x35, Offset: 0, Size: 16, Value: 1440
1.241629 Path: UPS.BatterySystem.Battery.ConfigVoltage, Type:
Feature, ReportID: 0x04, Offset: 0, Size: 16, Value: 12
1.242090 Path: UPS.PowerSummary.iDeviceChemistry, Type:
Feature, ReportID: 0x2a, Offset: 0, Size: 8, Value: 24
[New Thread 0x40b51460 (LWP 8120)]
Breakpoint 1, libusb_get_string (udev=0x43110, StringIdx=24,
buf=0x40400 <buf> "", buflen=20) at libusb.c:496
496 if (!udev) {
(gdb) c
Continuing.
27.433807 Path: UPS.OutletSystem.Outlet.DelayBeforeShutdown,
Type: Feature, ReportID: 0x15, Offset: 0, Size: 16, Value: 65535
27.450415 Path: UPS.BatterySystem.Test, Type: Feature, ReportID:
0x10, Offset: 0, Size: 8, Value: 0
27.467292 Path: UPS.PowerSummary.AudibleAlarmControl, Type:
Feature, ReportID: 0x11, Offset: 0, Size: 8, Value: 2
27.483919 Path: UPS.Flow.ConfigApparentPower, Type: Feature,
ReportID: 0x03, Offset: 0, Size: 16, Value: 900
27.500786 Path: UPS.OutletSystem.Outlet.TLWatchdog, Type:
Feature, ReportID: 0x52, Offset: 0, Size: 8, Value: 0
27.517668 Path: UPS.PowerSummary.PresentStatus.ShutdownImminent,
Type: Feature, ReportID: 0x32, Offset: 0, Size: 1, Value: 0
27.517877 Path: UPS.PowerSummary.PresentStatus.ACPresent, Type:
Feature, ReportID: 0x32, Offset: 1, Size: 1, Value: 1
27.518369 Path: UPS.PowerSummary.PresentStatus.Charging, Type:
Feature, ReportID: 0x32, Offset: 2, Size: 1, Value: 1
27.518752 Path: UPS.PowerSummary.PresentStatus.Discharging,
Type: Feature, ReportID: 0x32, Offset: 3, Size: 1, Value: 0
27.519154 Path: UPS.PowerSummary.PresentStatus.NeedReplacement,
Type: Feature, ReportID: 0x32, Offset: 4, Size: 1, Value: 0
27.534423 Path: UPS.PowerSummary.Input.ConfigVoltage, Type:
Feature, ReportID: 0x30, Offset: 0, Size: 8, Value: 120
27.551295 Path: UPS.Flow.ConfigVoltage, Type: Feature, ReportID:
0x01, Offset: 0, Size: 8, Value: 120
27.568055 Path: UPS.Flow.ConfigFrequency, Type: Feature,
ReportID: 0x02, Offset: 0, Size: 8, Value: 60
27.568535 Path: UPS.BatterySystem.Test, Type: Feature, ReportID:
0x10, Offset: 0, Size: 8, Value: 0
27.568978 Path: UPS.BatterySystem.Test, Type: Feature, ReportID:
0x10, Offset: 0, Size: 8, Value: 0
27.569349 Path: UPS.BatterySystem.Test, Type: Feature, ReportID:
0x10, Offset: 0, Size: 8, Value: 0
27.569789 Path: UPS.OutletSystem.Outlet.DelayBeforeShutdown,
Type: Feature, ReportID: 0x15, Offset: 0, Size: 16, Value: 65535
27.569999 Path: UPS.OutletSystem.Outlet.DelayBeforeShutdown,
Type: Feature, ReportID: 0x15, Offset: 0, Size: 16, Value: 65535
27.570458 Path: UPS.OutletSystem.Outlet.TLWatchdog, Type:
Feature, ReportID: 0x52, Offset: 0, Size: 8, Value: 0
27.570831 Path: UPS.OutletSystem.Outlet.TLWatchdog, Type:
Feature, ReportID: 0x52, Offset: 0, Size: 8, Value: 0
27.571228 Path: UPS.PowerSummary.AudibleAlarmControl, Type:
Feature, ReportID: 0x11, Offset: 0, Size: 8, Value: 2
27.571645 Path: UPS.PowerSummary.AudibleAlarmControl, Type:
Feature, ReportID: 0x11, Offset: 0, Size: 8, Value: 2
27.572021 Path: UPS.PowerSummary.AudibleAlarmControl, Type:
Feature, ReportID: 0x11, Offset: 0, Size: 8, Value: 2
27.572224 Path: UPS.PowerSummary.AudibleAlarmControl, Type:
Feature, ReportID: 0x11, Offset: 0, Size: 8, Value: 2
27.572590 Path: UPS.PowerSummary.AudibleAlarmControl, Type:
Feature, ReportID: 0x11, Offset: 0, Size: 8, Value: 2
27.572935 find_nut_info: unknown info type: load.on.delay
27.573263 find_nut_info: unknown info type: load.on.delay
27.573458 upsdrv_initinfo...
27.573842 upsdrv_updateinfo...
27.581201 Got 1 HID objects...
27.581559 Path: UPS.PowerSummary.RemainingCapacity, Type: Input,
ReportID: 0x34, Offset: 0, Size: 8, Value: 100
27.581677 Quick update...
27.582023 Path: UPS.OutletSystem.Outlet.DelayBeforeShutdown,
Type: Feature, ReportID: 0x15, Offset: 0, Size: 16, Value: 65535
27.582160 Path: UPS.PowerSummary.PresentStatus.ACPresent, Type:
Feature, ReportID: 0x32, Offset: 1, Size: 1, Value: 1
27.582675 Path: UPS.PowerSummary.PresentStatus.Charging, Type:
Feature, ReportID: 0x32, Offset: 2, Size: 1, Value: 1
27.583327 Path: UPS.PowerSummary.PresentStatus.Discharging,
Type: Feature, ReportID: 0x32, Offset: 3, Size: 1, Value: 0
27.584090 dstate_init: sock /var/state/ups/usbhid-ups-tripplite
open on fd 13
27.584935 upsdrv_updateinfo...
27.613190 Got 1 HID objects...
27.613602 Path: UPS.PowerSummary.RunTimeToEmpty, Type: Input,
ReportID: 0x35, Offset: 0, Size: 16, Value: 1440
27.613931 Quick update...
27.614057 Path: UPS.OutletSystem.Outlet.DelayBeforeShutdown,
Type: Feature, ReportID: 0x15, Offset: 0, Size: 16, Value: 65535
27.614467 Path: UPS.PowerSummary.PresentStatus.ACPresent, Type:
Feature, ReportID: 0x32, Offset: 1, Size: 1, Value: 1
27.614838 Path: UPS.PowerSummary.PresentStatus.Charging, Type:
Feature, ReportID: 0x32, Offset: 2, Size: 1, Value: 1
27.615222 Path: UPS.PowerSummary.PresentStatus.Discharging,
Type: Feature, ReportID: 0x32, Offset: 3, Size: 1, Value: 0
29.585702 upsdrv_updateinfo...
29.597279 Got 5 HID objects...
29.597393 Path: UPS.PowerSummary.PresentStatus.ShutdownImminent,
Type: Input, ReportID: 0x32, Offset: 0, Size: 1, Value: 0
29.597484 Path: UPS.PowerSummary.PresentStatus.TLACPresent,
Type: Input, ReportID: 0x32, Offset: 1, Size: 1, Value: 1
Breakpoint 1, libusb_get_string (udev=0x43110, StringIdx=1,
buf=0x40204 <buf> "", buflen=20) at libusb.c:496
496 if (!udev) {
(gdb) c
Continuing.
41.813239 Path: UPS.PowerSummary.PresentStatus.TLCharging, Type:
Input, ReportID: 0x32, Offset: 2, Size: 1, Value: 1
Breakpoint 1, libusb_get_string (udev=0x43110, StringIdx=1,
buf=0x40204 <buf> "TRIPP LITE UPS ", buflen=20) at libusb.c:496
496 if (!udev) {
(gdb) c
Continuing.
48.812952 Path: UPS.PowerSummary.PresentStatus.TLDischarging,
Type: Input, ReportID: 0x32, Offset: 3, Size: 1, Value: 0
Breakpoint 1, libusb_get_string (udev=0x43110, StringIdx=0,
buf=0x40204 <buf> "TRIPP LITE UPS ", buflen=20) at libusb.c:496
496 if (!udev) {
(gdb) c
Continuing.
50.329396 libusb_get_string: Invalid argument
50.329543 Path:
UPS.PowerSummary.PresentStatus.TLNeedReplacement, Type: Input,
ReportID: 0x32, Offset: 4, Size: 1, Value: 0
Breakpoint 1, libusb_get_string (udev=0x43110, StringIdx=0,
buf=0x40204 <buf> "", buflen=20) at libusb.c:496
496 if (!udev) {
(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
More information about the Nut-upsdev
mailing list