Skip to content

Add lid detection for Retroid Pocket Flip 2#120

Merged
nchapman merged 1 commit into
developfrom
feature/fix-retroid-flip2-lid
Jan 28, 2026
Merged

Add lid detection for Retroid Pocket Flip 2#120
nchapman merged 1 commit into
developfrom
feature/fix-retroid-flip2-lid

Conversation

@nchapman
Copy link
Copy Markdown
Collaborator

Implements sleep/wake on lid close/open using the gpio-keys-lid input device and SW_LID events. Key changes:

  • Fix udev_find_device_by_name to read name from parent device
  • Add udev_open_device_by_name helper function
  • Handle EV_SW lid events in PLAT_pollInput and PLAT_shouldWake
  • Add PLAT_initLid to detect sensor and read initial state
  • Add device name variants for Flip2 (with/without space)

Copilot AI review requested due to automatic review settings January 28, 2026 00:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements lid detection for the Retroid Pocket Flip 2 using the device's Hall effect sensor. The sensor is exposed as a gpio-keys-lid input device that emits SW_LID events, enabling automatic sleep when the lid closes and wake when it opens.

Changes:

  • Fixed udev_find_device_by_name to correctly read device names from parent input devices
  • Added lid detection support via SW_LID events in input polling and wake detection
  • Added device name variants for Flip 2 (with and without space in "Flip2")

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
workspace/retroid/platform/platform.c Adds lid detection logic to PLAT_pollInput and PLAT_shouldWake, implements PLAT_initLid for initial state detection, and adds device name variants for Flip2
workspace/all/common/udev_input.h Declares new helper function udev_open_device_by_name for opening specific input devices by name
workspace/all/common/udev_input.c Fixes bug in udev_find_device_by_name to read name from parent device, implements udev_open_device_by_name, and adds detailed logging for device enumeration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread workspace/all/common/udev_input.c Outdated
@nchapman nchapman force-pushed the feature/fix-retroid-flip2-lid branch from 48846dc to dde3393 Compare January 28, 2026 16:36
Implements sleep/wake on lid close/open using the gpio-keys-lid input
device and SW_LID events. Key changes:

- Fix udev_find_device_by_name to read name from parent device
- Add udev_open_device_by_name helper function
- Handle EV_SW lid events in PLAT_pollInput and PLAT_shouldWake
- Add PLAT_initLid to detect sensor and read initial state
- Fix Flip2 device name strings (no space before "2")
@nchapman nchapman force-pushed the feature/fix-retroid-flip2-lid branch from dde3393 to ddaeb1a Compare January 28, 2026 17:53
@nchapman nchapman merged commit 0a55d5c into develop Jan 28, 2026
6 checks passed
@nchapman nchapman deleted the feature/fix-retroid-flip2-lid branch January 28, 2026 17:58
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