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)

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: I2e9f3cbce55f3f894ca346bafa5ded280086a3ca
This commit is contained in:
Vaibhav Devmurari 2022-10-03 13:04:41 +00:00
parent 2b7c6714f1
commit a690698afa

View file

@ -214,3 +214,9 @@
# Raw HID devices # Raw HID devices
/dev/hidraw* 0660 system system /dev/hidraw* 0660 system system
# sysfs LED nodes for external USB devices
/sys/devices/platform/11110000.usb/11110000.dwc3/xhci-hcd-exynos.5.auto/usb2/2-1/*/*/leds/* brightness 0664 system system
/sys/devices/platform/11110000.usb/11110000.dwc3/xhci-hcd-exynos.5.auto/usb2/2-1/*/*/leds/* multi_intensity 0664 system system
/sys/devices/platform/11110000.usb/11110000.dwc3/xhci-hcd-exynos.4.auto/usb2/2-1/*/*/leds/* brightness 0664 system system
/sys/devices/platform/11110000.usb/11110000.dwc3/xhci-hcd-exynos.4.auto/usb2/2-1/*/*/leds/* multi_intensity 0664 system system