Skip to content

[Celestica] rma-showtech: get GPIO line value of current direction in rma-showtech GPIO show#1209

Open
CliffyWong wants to merge 1 commit into
facebook:mainfrom
CliffyWong:gpio_line_get_value
Open

[Celestica] rma-showtech: get GPIO line value of current direction in rma-showtech GPIO show#1209
CliffyWong wants to merge 1 commit into
facebook:mainfrom
CliffyWong:gpio_line_get_value

Conversation

@CliffyWong
Copy link
Copy Markdown
Contributor

@CliffyWong CliffyWong commented May 19, 2026

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run
image

Summary

This pull introduces a safe method for reading GPIO line values without altering the pin's current direction.

Motivation

rma-showtech invokes GpiodLine::getValue() to display GPIO pin states. However, getValue() internally calls gpiod_line_request_input(), which forcibly changes the GPIO pin direction to input mode. This behavior can lead to a mismatch with the actual hardware state and may even disrupt ongoing services.
Therefore, introduce a function,GpiodLine::getLineValue(), which reads the GPIO state while respecting its currently direction and integrates it into rma-showtech. This ensures that the rma-showtech GPIO display is non-disruptive.

The modifications include:

  • Implemented the new function GpiodLine::getLineValue() to read the value of a GPIO line based on its current direction.
  • Updated the Utils::printGpio utility to use the new GpiodLine::getLineValue() function

Test Plan

  1. Catch the santa platform snapshot via rma-showtech succesfully.
  2. Change several GPIO line to output direction via cmd gpioset, show GPIO information via rma-showtech GPIO show. The value of output direction of these GPIO Lines could be shown correctly.

Before gpioset:
image

After gpioset:
image

@CliffyWong CliffyWong requested review from a team as code owners May 19, 2026 08:33
@meta-cla meta-cla Bot added the CLA Signed label May 19, 2026
@CliffyWong CliffyWong changed the title [Celestica] rma_showtech: get GPIO line value of current direction in rma_showtech [Celestica] rma-showtech: get GPIO line value of current direction in rma_showtech May 20, 2026
@CliffyWong CliffyWong changed the title [Celestica] rma-showtech: get GPIO line value of current direction in rma_showtech [Celestica] rma-showtech: get GPIO line value of current direction in rma-showtech GPIO show May 20, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented May 22, 2026

@mikechoifb has imported this pull request. If you are a Meta employee, you can view this in D106028029.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant