Skip to content

fix(sensors): poll ACPI ALS instead of using IIO buffer - #127

Open
Ed-web-d wants to merge 1 commit into
FedeDP:masterfrom
Ed-web-d:fix/als-acpi-poll-fallback
Open

Ed-web-d wants to merge 1 commit into
FedeDP:masterfrom
Ed-web-d:fix/als-acpi-poll-fallback

Conversation

@Ed-web-d

Copy link
Copy Markdown

Summary

Use the poll path for acpi-als instead of the IIO buffer path.

Root cause

The ACPI ALS on MacBookPro12,1 (iio:device0, name acpi-als) exposes
scan_elements/ and trigger/current_trigger, so validate_dev() selects
the buffer implementation. The trigger never fires, so
iio_buffer_refill() blocks forever and clightd stops answering
Sensor.Capture; Clight automatic brightness freezes.

in_illuminance_input can be read reliably in the same setup.

Reproduction

busctl --system call org.clightd.clightd /org/clightd/clightd/Sensor \
  org.clightd.clightd.Sensor Capture "sis" "iio:device0" 5 "i=20"

Before: hangs. After: returns 5 values in milliseconds.

Changes

  • In capture(), if the device name is acpi-als and a poll attribute is
    available, use iio_poll_capture().
  • Other ALS devices keep the existing buffer-first behavior.

Testing

MacBookPro12,1 / Fedora 45 / kernel 7.3.4; Captured [5/5] at every
15/30s Clight capture. No change for other IIO ALS devices tested.

acpi-als exposes scan_elements and a trigger, but the trigger never
fires.  iio_buffer_refill() then blocks forever and clightd stops
answering Sensor.Capture, which freezes Clight automatic brightness on
MacBookPro12,1.

For acpi-als, use the poll path (in_illuminance_input), which returns
valid values in milliseconds.  Other ALS devices keep the buffer-first
behaviour.
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