drivers/mge-hid.c: refactor, treat ABM unknown as disabled#4
Merged
masterwishx merged 6 commits intomasterwishx:work/246-add-battery.charger.status+modefrom Nov 12, 2024
desertwitch:work/246-add-battery.charger.status+mode
Merged
drivers/mge-hid.c: refactor, treat ABM unknown as disabled#4masterwishx merged 6 commits intomasterwishx:work/246-add-battery.charger.status+modefrom desertwitch:work/246-add-battery.charger.status+mode
masterwishx merged 6 commits intomasterwishx:work/246-add-battery.charger.status+modefrom
desertwitch:work/246-add-battery.charger.status+mode
Conversation
Signed-off-by: desertwitch <24509509+desertwitch@users.noreply.github.com>
Signed-off-by: desertwitch <24509509+desertwitch@users.noreply.github.com>
Signed-off-by: desertwitch <24509509+desertwitch@users.noreply.github.com>
Signed-off-by: desertwitch <24509509+desertwitch@users.noreply.github.com>
Signed-off-by: desertwitch <24509509+desertwitch@users.noreply.github.com>
…-add-battery.charger.status+mode Signed-off-by: desertwitch <24509509+desertwitch@users.noreply.github.com>
eb6eeb7
into
masterwishx:work/246-add-battery.charger.status+mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I tried to illustrate here my code review/comments on the PR: networkupstools#2660
We've seen non-ABM capable devices with partial ABM paths, these were previously sent into ABM parsing functions. Treating
ABM_UNKNOWNasABM_DISABLEDresolves this problem, ABM parsing functions should only be executed if ABM is explicitlyABM_ENABLED. This also allows for graceful transition fromABM_UNKNOWN/ABM_DISABLEDtoABM_ENABLED.Removed
ABM_ENABLED_TYPEas an additional way of enabling ABM, this is just a textual value for the battery charger type and ABM disabled/enabled is already handled through the correct HID path (x.ABMEnable) in another function. An ABM battery charger type can still be ABM disabled, so it makes no sense to assume enable ABM based on the charger type.Improved the two ABM decision paths (old + new) with clear structure, comments, improved function and variable names.
Improved the checking of ABM enabled-ness by checking for known values, rather than assigning any values directly.
Improved debug messages to be more clear and condensed, as they seemed to be partially overlapping in some areas.
Improved multiple implicitly casted variables to explicit casting in a single place where it felt correct to do so.