Allow system server to access sysfs node of led lights.

To support input device lights manager feature in frameworks, provide
sysfs node access to system server process.
DD: go/pk_backlight_control (For keyboard backlight control for external
keyboards)

Similar CL: ag/20102346

Kernel provides a standardized LED interface to expose LED controls
over sysfs: https://docs.kernel.org/leds/leds-class.html
The feature will be provided for devices with kernel sysfs class led
support and vendor kernel driver for input controllers that do have
lights. The kernel sysfs class led support is a kernel config option
(LEDS_CLASS), and an input device driver will create the sysfs class
node interface.
By giving system_server the access to these sysfs nodes, the feature
will work on devices with the kernel option and kernel input/hid driver
support. We do use CTS tests to enforce the kernel options and the
input device drivers.

What's already supported:
- We already expose paths for UHID based LED nodes which covers all
bluetooth based peripherals that have custom vendor drivers to expose
LED sysfs nodes. (see CL aosp/1546377)

What's included in this CL:
- Exposing paths for sysfs nodes for external USB based devices that
expose LED nodes using vendor specific drivers using standard LED
interface provided by Kernel
- We are using specific paths for USB devices instead of
/sys/class/leds to avoid giving access to system LED nodes that would
also appear under /sys/class/leds (see discussion in aosp/1546377)

NOTE: Light HAL should never touch the HID device sysfs light, as the
light HAL only defines a number of lights supported
(https://android.googlesource.com/platform/hardware/interfaces/+/master/light/2.0/types.hal)
but not include input device lights, so we shouldn't have conflict
for managing these lights.

NOTE: External keyboard backlight is different for HAL light type
KEYBOARD which is for devices with attached keyboards.

Test: manual
Bug: 245506418
Change-Id: I17031179b7c1e56b0e841d4047859006d005fd21
This commit is contained in:
Vaibhav Devmurari 2022-11-21 17:47:38 +00:00
parent 4e3f62823d
commit 0f9dcda519

View file

@ -222,3 +222,9 @@
# ODPM # ODPM
/sys/bus/iio/devices/iio:device* enabled_rails 0660 system system /sys/bus/iio/devices/iio:device* enabled_rails 0660 system system
# sysfs LED nodes for external USB devices
/sys/devices/platform/11210000.usb/11210000.dwc3/xhci-hcd-exynos.5.auto/usb2/2-1/*/*/leds/* brightness 0664 system system
/sys/devices/platform/11210000.usb/11210000.dwc3/xhci-hcd-exynos.5.auto/usb2/2-1/*/*/leds/* multi_intensity 0664 system system
/sys/devices/platform/11210000.usb/11210000.dwc3/xhci-hcd-exynos.4.auto/usb2/2-1/*/*/leds/* brightness 0664 system system
/sys/devices/platform/11210000.usb/11210000.dwc3/xhci-hcd-exynos.4.auto/usb2/2-1/*/*/leds/* multi_intensity 0664 system system