Skip to content

fw/services/touch: release an active touch when the last subscriber leaves - #1892

Draft
Mearman wants to merge 1 commit into
coredevices:mainfrom
Mearman:fix/touch-liftoff-on-last-unsubscribe
Draft

fw/services/touch: release an active touch when the last subscriber leaves#1892
Mearman wants to merge 1 commit into
coredevices:mainfrom
Mearman:fix/touch-liftoff-on-last-unsubscribe

Conversation

@Mearman

@Mearman Mearman commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Draft — still validating on hardware.

While playing around with the touch navigation a few weeks ago I kept catching the backlight staying lit well past its timeout, in cases where an app had exited (or otherwise dropped its touch subscription) while my finger was still on the screen.

The last-unsubscribe path powers the sensor down mid-gesture, so the in-progress touch never gets a Liftoff. The Touchdown's backlight hold (light_touch_down -> light_button_pressed) then never unwinds: the button refcount stays pinned, the light never enters its timed state, and with the sensor off no later touch can clear it.

This synthesises the Liftoff with the last coordinates when the subscriber count reaches zero — the same teardown touch_service_set_globally_enabled(false) already performs for exactly this reason, per its own comment.

Covered by test_touch__last_unsubscribe_with_finger_down_emits_liftoff (and a no-finger guard test) in tests/fw/services/test_touch.c; full unit suite green.

…eaves

The last subscriber going away powers the touch sensor down mid-gesture,
so a finger that was down at teardown never produces a Liftoff. The
Touchdown's backlight hold (light_touch_down -> light_button_pressed)
then never unwinds: the button refcount stays pinned, the light never
enters its timed state, and with the sensor off no later touch can clear
it.

Synthesise the Liftoff with the last coordinates when the subscriber
count reaches zero, mirroring the teardown the global disable path
already performs for the same reason.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
@Mearman
Mearman force-pushed the fix/touch-liftoff-on-last-unsubscribe branch from 3cdb187 to 93451ee Compare August 19, 2026 21:04
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