Skip to content

sensor: fix lower-critical threshold status mask#55

Merged
datdenkikniet merged 1 commit into
datdenkikniet:mainfrom
nuclearcat:fix/lower-critical-threshold-mask
Jul 10, 2026
Merged

sensor: fix lower-critical threshold status mask#55
datdenkikniet merged 1 commit into
datdenkikniet:mainfrom
nuclearcat:fix/lower-critical-threshold-mask

Conversation

@nuclearcat

Copy link
Copy Markdown
Contributor

The Get Sensor Reading threshold-status decoder tested lower critical with 0x20. That is bit 5, so lower critical incorrectly mirrored upper non-recoverable: an isolated lower-critical status (0x02) was missed, while an upper-non-recoverable status (0x20) produced a false lower-critical result.

IPMI v2.0 specification reference:

  • Section 35.14, Get Sensor Reading Command
  • Table 35-15
  • Printed page 468 (PDF page 494)
  • Response data byte 4: For threshold-based sensors Present threshold comparison status

The specification defines:

[7:6 reserved]
[5] upper non-recoverable
[4] upper critical
[3] upper non-critical
[2] lower non-recoverable
[1] lower critical
[0] lower non-critical

Therefore:

lower_critical = (status & 0x02) != 0;

ipmi-rs implementation used 0x20 in ipmi-rs-core/src/sensor_event/sensor_reading/mod.rs, which is bit 5: upper non-recoverable, so it need minor fix.

Use the correct 0x02 mask and add a regression test proving that bits 1 and 5 independently set lower-critical and upper-non-recoverable status.

The Get Sensor Reading threshold-status decoder tested lower critical with 0x20. That is bit 5, so lower critical incorrectly mirrored upper non-recoverable: an isolated lower-critical status (0x02) was missed, while an upper-non-recoverable status (0x20) produced a false lower-critical result.

IPMI v2.0 specification reference:

- Section 35.14, Get Sensor Reading Command
- Table 35-15
- Printed page 468 (PDF page 494)
- Response data byte 4, “Present threshold comparison status”

The specification defines:

[5] upper non-recoverable
[4] upper critical
[3] upper non-critical
[2] lower non-recoverable
[1] lower critical
[0] lower non-critical

Therefore:

lower_critical = (status & 0x02) != 0;

The previous ipmi-rs implementation used 0x20 in ipmi-rs-core/src/sensor_event/sensor_reading/mod.rs, which is bit 5: upper non-recoverable.

Use the correct 0x02 mask and add a regression test proving that bits 1 and 5 independently set lower-critical and upper-non-recoverable status.
@datdenkikniet
datdenkikniet force-pushed the fix/lower-critical-threshold-mask branch from ccd950a to feb5c2d Compare July 10, 2026 19:21
@datdenkikniet
datdenkikniet merged commit feb5c2d into datdenkikniet:main Jul 10, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants