networkupstools / nut

The Network UPS Tools repository. UPS management protocol Informational RFC 9271 published by IETF at https://www.rfc-editor.org/info/rfc9271 Please star NUT on GitHub, this helps with sponsorships!
https://networkupstools.org/
Other
1.96k stars 348 forks source link

nut_libusb_get_interrupt: Connection timed out on debug #2644

Open masterwishx opened 1 week ago

masterwishx commented 1 week ago

Using NUT plugin for Unraid When debug is on have many interrupt transfers :

have a lot of nut_libusb_get_interrupt: Connection timed out in debug log and maybe also affect on https://github.com/networkupstools/nut/issues/2643 or its just closing connection every time for cycle of reading data?

From https://github.com/libusb/libusb/issues/1548#issuecomment-2378734313 by @tormodvolden (have issues with interrupt transfers )

Mostly looks like this :

send_to_all: SETINFO driver.state "quiet"
Sep 27 09:37:30 DaRKNaS usbhid-ups[24218]: [D6:24218] send_to_all: write 29 bytes to socket 16 succeeded (ret=29): SETINFO driver.state "quiet"
Sep 27 09:37:31 DaRKNaS usbhid-ups[24218]: [D5:24218] send_to_all: SETINFO driver.state "updateinfo"
Sep 27 09:37:31 DaRKNaS usbhid-ups[24218]: [D6:24218] send_to_all: write 34 bytes to socket 16 succeeded (ret=34): SETINFO driver.state "updateinfo"
Sep 27 09:37:31 DaRKNaS usbhid-ups[24218]: [D1:24218] upsdrv_updateinfo...
Sep 27 09:37:32 DaRKNaS usbhid-ups[24218]: [D2:24218] nut_libusb_get_interrupt: Connection timed out
Sep 27 09:37:32 DaRKNaS usbhid-ups[24218]: [D1:24218] Got 0 HID objects...
Sep 27 09:37:32 DaRKNaS usbhid-ups[24218]: [D1:24218] Quick update...
Sep 27 09:37:32 DaRKNaS usbhid-ups[24218]: [D4:24218] 

image

masterwishx commented 4 days ago

@tormodvolden @jimklimov do you think it's related to how nut proccess libusb or I can test it with xusb if it related to libusb itself?

I have also nut client on windows that read values from nut, also telegraf that read values and write to influxdbv2 for grafana dashboard. Not shure if it can affect on isshue...

tormodvolden commented 4 days ago

Is this causing a problem or is it just that you see the debug message in the log? You'll have to find out what the nut code tries to do, then what to expect from the device and libusb calls.

If you have suspicions about a libusb issue, you must provide LIBUSB_DEBUG=4 logs to start.

xusb can do some HID interrupt transfers, but I don't know if it fits with your device.

masterwishx commented 3 days ago

Is this causing a problem or is it just that you see the debug message in the log? You'll have to find out what the nut code tries to do, then what to expect from the device and libusb calls.

Yes the problem upsrw commands not working for me , hovewer it write OK or Success https://github.com/networkupstools/nut/issues/2643

masterwishx commented 3 days ago

Is this causing a problem or is it just that you see the debug message in the log? You'll have to find out what the nut code tries to do, then what to expect from the device and libusb calls.

If you have suspicions about a libusb issue, you must provide LIBUSB_DEBUG=4 logs to start.

xusb can do some HID interrupt transfers, but I don't know if it fits with your device.

image

tormodvolden commented 3 days ago

Personally I am allergic to text being pasted as images :) There are so many great tools to efficiently search and process textual information.

masterwishx commented 3 days ago

Sorry, got it, will post the log here..

masterwishx commented 3 days ago

Personally I am allergic to text being pasted as images :) There are so many great tools to efficiently search and process textual information.

nut debug log 1.10.24.txt

masterwishx commented 3 days ago

Also tryed to add exported LIBUSB_DEBUG = 4 to ups.conf with debug_min = 6 but seems no effect with LIBUSB_DEBUG = 4

tormodvolden commented 3 days ago

Please see #2616.

masterwishx commented 3 days ago

Please see #2616.

Thanks, by #2616 I tryed to add LIBUSB_DEBUG = 4, but seems not worked for, I mean only debug_min=6 working by log I posted

tormodvolden commented 3 days ago

Maybe bring that up in #2616, if you can't figure out how to enable this, the documentation is definitely not good enough.

tormodvolden commented 3 days ago

Did you already read docs/man/nut.conf.txt ?

masterwishx commented 3 days ago

Did you already read docs/man/nut.conf.txt ?

No just was reading #2616

masterwishx commented 3 days ago

exported LIBUSB_DEBUG = 4

seems exported LIBUSB_DEBUG = 4 not documented yet in docs/man/nut.conf.txt im using nut plugin for Unraid , So i just select UPS Driver Debug Level: 6 and its adding debug_min = 6 in ups.cong file

tormodvolden commented 3 days ago

The LIBUSB_DEBUG variable is mentioned in docs/man/nut_usb_addvars.txt but docs/man/nut.conf.txt explains more in general how to set variables correctly.

masterwishx commented 3 days ago

The LIBUSB_DEBUG variable is mentioned in docs/man/nut_usb_addvars.txt but docs/man/nut.conf.txt explains more in general how to set variables correctly.

So i added exported LIBUSB_DEBUG = 4 like in https://github.com/networkupstools/nut/blob/1560afe330d09479370f3ed25e3289392c7aebc5/docs/man/nut_usb_addvars.txt#L136

my bad was i added to ups.conf instead of nut.conf

and nut started OK, if wrong variable was set in ups.conf NUT will not start . So i added to nut.conf same effect ...

and from both logs , no info about libusb debug :

0.000000#011[D1:24188] debug level is '6'
0.000008#011[D5:24188] send_to_all: SETINFO driver.debug "6"
0.000021#011[D5:24188] send_to_all: SETFLAGS driver.debug RW NUMBER
tormodvolden commented 3 days ago

What does docs/man/nut.conf.txt say about spaces? :)

masterwishx commented 3 days ago

What does docs/man/nut.conf.txt say about spaces? :)

:) OK Got it, i will try it but in nut plugin for Unraid that im using all config with spaces around equal , sorry for picture:

image

image