Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support LIBUSB_DEBUG=NUM setting in ups.conf #2649

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

jimklimov
Copy link
Member

@jimklimov jimklimov commented Oct 2, 2024

Addresses part of #2616

A quick hack for that issue, to setenv() the envvar during configuration parsing, so hopefully the library would see it:

:; ./drivers/usbhid-ups -a eco650 -x LIBUSB_DEBUG=qqq -d 1
Network UPS Tools 2.8.2.1082.2-1084-g0520091ac (development iteration after 2.8.2) - Generic HID driver 0.57
USB communication driver (libusb 1.0) 0.49
WARNING : Invalid LIBUSB_DEBUG value found in ups.conf for the driver, defaulting to 4
Enabling LIBUSB_DEBUG=4 from ups.conf
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000011] [001a9956] libusb: debug [libusb_init] created default context
[ 0.000019] [001a9956] libusb: debug [libusb_init] libusb v1.0.24.11584
...
ups.timer.shutdown: -1
ups.timer.start: -1
ups.vendorid: 0463
[ 7.381093] [001aa8d0] libusb: debug [libusb_close]
[ 7.381098] [001aa8d0] libusb: debug [usbi_remove_event_source] remove fd 8
[ 7.381120] [001aa8d0] libusb: debug [libusb_exit]
[ 7.381123] [001aa8d0] libusb: debug [libusb_exit] destroying default context
[ 7.381126] [001aa8d0] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 7.381129] [001aa8d0] libusb: debug [handle_events] event sources modified, reallocating event data
[ 7.381134] [001aa8d0] libusb: debug [usbi_wait_for_events] poll() 2 fds with timeout in 0ms
[ 7.381137] [001aa8d0] libusb: debug [usbi_wait_for_events] poll() returned 0
[ 7.381140] [001aa8d0] libusb: debug [libusb_unref_device] destroy device 6.1
[ 7.381143] [001aa8d0] libusb: debug [libusb_unref_device] destroy device 5.1
[ 7.381146] [001aa8d0] libusb: debug [libusb_unref_device] destroy device 4.1
[ 7.381149] [001aa8d0] libusb: debug [libusb_unref_device] destroy device 3.7
[ 7.381153] [001aa8d0] libusb: debug [libusb_unref_device] destroy device 3.6
[ 7.381157] [001aa8d0] libusb: debug [libusb_unref_device] destroy device 3.1
[ 7.381160] [001aa8d0] libusb: debug [libusb_unref_device] destroy device 2.1
[ 7.381165] [001aa8d0] libusb: debug [libusb_unref_device] destroy device 1.4
[ 7.381167] [001aa8d0] libusb: debug [libusb_unref_device] destroy device 1.1
[ 7.381170] [001aa8d0] libusb: debug [usbi_remove_event_source] remove fd 7
[ 7.381177] [001aa8d0] libusb: debug [usbi_remove_event_source] remove fd 6
[ 7.381198] [001aa8d1] libusb: debug [linux_udev_event_thread_main] udev event thread exiting

A cleaner solution would be to call libusb_set_debug() specifically, when initializing a context for device communications, but needs some more careful coding :) so can be a follow-up sometime later.

FYI : CC @masterwishx @tormodvolden

@jimklimov jimklimov added this to the 2.8.3 milestone Oct 2, 2024
@jimklimov jimklimov merged commit fd6f418 into networkupstools:master Oct 2, 2024
30 checks passed
@jimklimov jimklimov deleted the issue-2616 branch October 2, 2024 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant