Skip to content

drivers/usbhid-ups.c: try to detect "Driver stale" situations when in "pollonly" mode#1630

Merged
jimklimov merged 2 commits intonetworkupstools:masterfrom
jimklimov:issue-1624
Apr 29, 2025
Merged

drivers/usbhid-ups.c: try to detect "Driver stale" situations when in "pollonly" mode#1630
jimklimov merged 2 commits intonetworkupstools:masterfrom
jimklimov:issue-1624

Conversation

@jimklimov
Copy link
Copy Markdown
Member

Currently the driver code does not seem to have any concept of "staleness" if it is not in interrupt mode (and failing those requests). Unplugging the USB cable has no effect on driver's ability and eagerness to report info about the device, even an hour later. I did not yet test if this is a platform issue (seen with Windows builds) or a generic one.

Not sure in practical terms however, if the trick in this PR helps - e.g. it might be prudent to actively re-request static fields known to have been served during initial startup, to make sure they are still served or the device is AWOL (assuming libusb actually requests that, and does not cache responses), but I am not quickly sure how to do that.

More expert eyes are welcome :)

…h "pollonly" mode, re-read HU_FLAG_SEMI_STATIC and HU_FLAG_STATIC entries to detect "Driver stale" situations [networkupstools#1624]
@jimklimov jimklimov requested review from aquette and clepple August 28, 2022 12:53
@jimklimov jimklimov marked this pull request as draft August 29, 2022 07:04
@jimklimov jimklimov added question need testing Code looks reasonable, but the feature would better be tested against hardware or OSes need more info labels Sep 2, 2022
@jimklimov
Copy link
Copy Markdown
Member Author

UPDATE: PR #2010 introduces state entry timestamping, so if it gets merged - we have another approach to the staleness detection problem generally (can just test in every loop if non-(semi)static values were last written longer than SOME_TIMEOUT ago).

@jimklimov
Copy link
Copy Markdown
Member Author

Resyncing with main NUT code base after v2.8.3 release.

@jimklimov jimklimov marked this pull request as ready for review April 25, 2025 08:30
@AppVeyorBot
Copy link
Copy Markdown

@jimklimov
Copy link
Copy Markdown
Member Author

CI faults irrelevant (free space problems on an agent).

@jimklimov jimklimov merged commit 59ff716 into networkupstools:master Apr 29, 2025
27 of 37 checks passed
@jimklimov jimklimov deleted the issue-1624 branch April 29, 2025 14:40
@jimklimov jimklimov added this to the 2.8.4 milestone May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug need more info need testing Code looks reasonable, but the feature would better be tested against hardware or OSes question USB

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants