Skip to content

libusb{0,1}: if the tried "rdlen" did not succeed, fall back to the other value we had in mind#3149

Merged
jimklimov merged 6 commits intonetworkupstools:masterfrom
jimklimov:issue-3136
Nov 7, 2025
Merged

libusb{0,1}: if the tried "rdlen" did not succeed, fall back to the other value we had in mind#3149
jimklimov merged 6 commits intonetworkupstools:masterfrom
jimklimov:issue-3136

Conversation

@jimklimov
Copy link
Copy Markdown
Member

Closes: #3136

In libusb1.c also fix printout of rdlen variables from %d to %PRIi32

CC @desertwitch - can you get this tested please? :)

@jimklimov jimklimov added this to the 2.8.5 milestone Oct 27, 2025
@jimklimov jimklimov added enhancement need testing Code looks reasonable, but the feature would better be tested against hardware or OSes USB Connection stability issues Issues about driver<->device and/or networked connections (upsd<->upsmon...) going AWOL over time labels Oct 27, 2025
Comment thread drivers/libusb1.c Fixed
Comment thread drivers/libusb1.c Fixed
Comment thread drivers/libusb1.c Fixed
Comment thread drivers/libusb1.c Fixed
Comment thread drivers/libusb0.c Fixed
Comment thread drivers/libusb0.c Fixed
Comment thread drivers/libusb0.c Fixed
Comment thread drivers/libusb0.c Fixed
…d, fall back to the other value we had in mind [networkupstools#3136]

In libusb1.c also fix printout of rdlen variables from %d to %PRIi32

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ext_device" now that we have a loop and "continue" to try another rdlen [networkupstools#3136]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@AppVeyorBot
Copy link
Copy Markdown

@jimklimov
Copy link
Copy Markdown
Member Author

Alas, can't fully check the PR myself. The driver still works, but (also without the PR changes) the Eaton Ellipse PRO 650 returns same rdlen in both code paths:

   0.492438     [D2] Retrieved HID descriptor (expected 9, got 9)
   0.492460     [D3] HID descriptor, method 1: (9 bytes) => 09 21 10 10 21 01 22 8d 03
   0.492466     [D3] HID descriptor length (method 1) 909
   0.492472     [D4] i=0, extra[i]=09, extra[i+1]=21
   0.492478     [D3] HID descriptor, method 2: (9 bytes) => 09 21 10 10 21 01 22 8d 03
   0.492489     [D3] HID descriptor length (method 2) 909
   0.492493     [D2] HID descriptor length 909
   3.662468     [D2] Report Descriptor size = 909

@jimklimov
Copy link
Copy Markdown
Member Author

Bumped the PR to sync with other improvements recently merged to master...

@desertwitch
Copy link
Copy Markdown
Contributor

desertwitch commented Nov 6, 2025

Just heard back from the 9PX user, it works for them now. Many thanks for the patch and patience.

@jimklimov
Copy link
Copy Markdown
Member Author

Great to hear, thanks! Driver startup logs to see it trying one option and retrying with another would be great too :)

@desertwitch
Copy link
Copy Markdown
Contributor

Here we go:

0.140182 [D2] Checking device 3 of 8 (0463/FFFF)
0.141095 [D2] - VendorID: 0463
0.141096 [D2] - ProductID: ffff
0.141097 [D2] - Manufacturer: EATON
0.141098 [D2] - Product: Eaton 9PX
0.141098 [D2] - Serial Number: REMOVED
0.141099 [D2] - Bus: 001
0.141099 [D2] - Bus Port: 003
0.141100 [D2] - Device: 003
0.141100 [D2] - Device release number: 0202
0.141101 [D2] Trying to match device
0.141102 [D2] match_function_subdriver (non-SHUT mode): matching a device...
0.141103 [D3] match_function_regex: matching a device...
0.141104 [D2] Device matches
0.141105 [D2] Reading configuration descriptor 1 of 1
0.141107 [D3] libusb_kernel_driver_active() returned 0: Success
0.141113 [D2] Claimed interface 0 successfully
0.141114 [D3] nut_libusb_set_altinterface: skipped libusb_set_interface_alt_setting(udev, 0, 0)
0.141255 [D2] Retrieved HID descriptor (expected 9, got 9)
0.141257 [D3] HID descriptor, method 1: (9 bytes) => 09 21 10 01 21 01 22 5f 12
0.141258 [D3] HID descriptor length (method 1) 4703
0.141258 [D4] i=0, extra[i]=09, extra[i+1]=21
0.141259 [D3] HID descriptor, method 2: (9 bytes) => 09 21 10 01 21 01 22 84 04
0.141260 [D3] HID descriptor length (method 2) 1156
0.141261 [D1] Eaton device v2.02. Using full report descriptor
0.141261 [D2] Warning: two different HID descriptors retrieved (Reportlen = 4703 vs. 1156)
0.141262 [D2] Trying HID descriptor length 4703
0.141269 [D2] Unable to get Report descriptor: Resource temporarily unavailable
0.141269 [D2] Trying HID descriptor length 1156
0.147121 [D2] Report Descriptor size = 1156

(sent from mobile, sorry about formatting)

@jimklimov
Copy link
Copy Markdown
Member Author

Cool, thanks!

@jimklimov jimklimov added the Eaton label Nov 7, 2025
@jimklimov jimklimov merged commit c7198d5 into networkupstools:master Nov 7, 2025
55 of 58 checks passed
@jimklimov jimklimov deleted the issue-3136 branch November 7, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Connection stability issues Issues about driver<->device and/or networked connections (upsd<->upsmon...) going AWOL over time Eaton enhancement need testing Code looks reasonable, but the feature would better be tested against hardware or OSes USB

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eaton 9PX Resource unavailable, HID length mismatch

4 participants