Skip to content

fix(iio-sensor-proxy): reply to repeated sensor claims#12

Open
DeXtroTip wants to merge 1 commit into
fstanis:mainfrom
DeXtroTip:fix/mxc6655-claim
Open

fix(iio-sensor-proxy): reply to repeated sensor claims#12
DeXtroTip wants to merge 1 commit into
fstanis:mainfrom
DeXtroTip:fix/mxc6655-claim

Conversation

@DeXtroTip

Copy link
Copy Markdown

This PR fixes a hang where the MXC6655 driver never replied to a ClaimAccelerometer call 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 pending Claim() 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-up when 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; --lazy mode 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).

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.
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.

1 participant