fix(iio-sensor-proxy): reply to repeated sensor claims#12
Open
DeXtroTip wants to merge 1 commit into
Open
Conversation
mxc6655_set_polling returned early when want_polling already matched the requested state, so a repeated ClaimAccelerometer call never delivered a sample to its callback and the D-Bus reply hung. Send a synthetic reading on that no-op path, using cur_orient with a fallback to MXC_ORIENT_RIGHT (matching the original first-claim value). Adds test-mxc6655-accel-claim covering both the known-orientation and unknown (-1) fallback cases.
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.
This PR fixes a hang where the MXC6655 driver never replied to a
ClaimAccelerometercall in its default (non-lazy) polling mode, which crashed iio-niri on startup.The proxy starts polling at boot. When a client later claims the accelerometer, iio-sensor-proxy calls
set_polling(TRUE)again. The MXC6655 driver saw that polling was already enabled and returned early, without sending the sample the proxy waits for before completing the D-Bus reply. The pendingClaim()then blocked until the device was physically tilted, and iio-niri gave up and exited.Repeated enabled requests now send a synthetic reading using the current orientation, falling back to
right-upwhen no orientation has been classified yet (matching the previous first-claim value). The driver otherwise behaves the same. A regression test covers both the known-orientation and unknown-orientation cases, and the Arch package release is bumped.I tested this on a MiniBook X running CachyOS and Niri. Against the unpatched proxy, iio-niri crashed with an unable-to-claim message;
--lazymode worked, because its first claim is a real start instead of a no-op. With this fix, iio-niri claims immediately in the default mode, rotation works, and it survives a logout and back in. The Meson test suite passes (4/4).