Skip to content

Allow mapping functions to return EINVAL for setvar/instcmd to abort consistently#3017

Merged
jimklimov merged 9 commits intonetworkupstools:masterfrom
jimklimov:issue-3017
Jul 17, 2025
Merged

Allow mapping functions to return EINVAL for setvar/instcmd to abort consistently#3017
jimklimov merged 9 commits intonetworkupstools:masterfrom
jimklimov:issue-3017

Conversation

@jimklimov
Copy link
Copy Markdown
Member

@jimklimov jimklimov commented Jul 14, 2025

Note that errno=EINVAL means unsupported parameter value for us here.

Inspired by discussion and fixes for PR #2956; follows up from PR #2957.

Updates usbhid-ups, snmp-ups and to an extent nutdrv_qx to have similar functionality with their mappings handling.

@jimklimov jimklimov added this to the 2.8.4 milestone Jul 14, 2025
@jimklimov jimklimov added enhancement SNMP USB Incorrect or missing readings On some devices driver-reported values are systemically off (e.g. x10, x0.1, const+Value, etc.) labels Jul 14, 2025
…ally for common RESULT [networkupstools#2957]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…AT_INSTCMD_*

Be pedantically correct about these, even if they map
to same numbers for logical names at the moment.

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…licable; use upslog_*_RESULT() in callers su_setvar()/su_instcmd() for maintainability

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…t EINVAL for unsupported arguments, and bail out [networkupstools#3017]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
jimklimov added a commit to jimklimov/nut that referenced this pull request Jul 14, 2025
…ort EINVAL for unsupported arguments, and bail out [networkupstools#3017]

Made for progresing on PR networkupstools#2956

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
jimklimov added a commit to jimklimov/nut that referenced this pull request Jul 14, 2025
…ractical [networkupstools#3017]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
jimklimov added a commit to jimklimov/nut that referenced this pull request Jul 14, 2025
…qx_process() methods to report EINVAL for unsupported arguments, and bail out [networkupstools#3017]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov jimklimov added the Qx protocol driver Driver based on Megatec Q<number> such as new nutdrv_qx, or obsoleted blazer and some others label Jul 14, 2025
…ort EINVAL for unsupported arguments, and bail out [networkupstools#3017]

Made for progresing on PR networkupstools#2956

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ractical [networkupstools#3017]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…qx_process() methods to report EINVAL for unsupported arguments, and bail out [networkupstools#3017]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
jimklimov added a commit to masterwishx/nut that referenced this pull request Jul 14, 2025
…ort EINVAL for unsupported arguments, and bail out [networkupstools#3017]

Made for progresing on PR networkupstools#2956

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

jimklimov added a commit to masterwishx/nut that referenced this pull request Jul 14, 2025
…ls#2956]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ls#2956]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
jimklimov added a commit to masterwishx/nut that referenced this pull request Jul 14, 2025
…ls#2956]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…etworkupstools#3017]

Avoid error claimed by clang-20 et al:

    conditional expression between different enumeration types
    ('enum (unnamed at ./upshandler.h:25:1)' and
     'enum (unnamed at ./upshandler.h:34:1)')
    [-Werror,-Wanon-enum-enum-conversion]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov jimklimov merged commit 9f76f3f into networkupstools:master Jul 17, 2025
29 of 30 checks passed
@jimklimov jimklimov deleted the issue-3017 branch July 17, 2025 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Incorrect or missing readings On some devices driver-reported values are systemically off (e.g. x10, x0.1, const+Value, etc.) Qx protocol driver Driver based on Megatec Q<number> such as new nutdrv_qx, or obsoleted blazer and some others SNMP USB

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants