Add lid detection for Retroid Pocket Flip 2#120
Merged
Conversation
There was a problem hiding this comment.
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.
48846dc to
dde3393
Compare
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")
dde3393 to
ddaeb1a
Compare
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.
Implements sleep/wake on lid close/open using the gpio-keys-lid input device and SW_LID events. Key changes: