Get information about lights and control their brightness and color.
Usage
lights-cli <device_path> print <id>
lights-cli <device_path> set <id> <brightness>
lights-cli <device_path> set <id> <red> <green> <blue>
lights-cli <device_path> summary
lights-cli list
Commands
lights-cli <device_path> print <id>
View the brightness and color (if applicable) of a light. The reported values
are floating point numbers between 0.0
(completely off) and 1.0
(completely
on).
set
lights-cli <device_path> set <id> <brightness>
Set the brightness of a light. For lights that support pulse-width modulation
<brightness>
can be any number between 0.0
(completely off) and 1.0
(completely on). For lights that only support simple on and off states
<brightness>
should only be 0.0
(off) or 1.0
(on).
lights-cli <device_path> set <id> <red> <green> <blue>
Set the color of a light. <red>
<green>
and <blue>
can be any number
between 0.0
and 1.0
to control the intensity of each color component.
summary
lights-cli <device_path> summary
View the total light count as well as the brightness and capabilities of each
light. Currently supported capabilities are Brightness
, Rgb
, and Simple
.
Brightness
is a value between 0.0
and 1.0
as explained in the set
command's description. Rgb
is the RGB value of the light. Simple
indicates
whether the light supports pulse-width modulation or only simple on and off
states.
list
lights-cli list
List the device paths of all lights.
Examples
All examples for node "123" (to check available nodes type ls /dev/class/light
).
View the brightness of a light
$ lights-cli /dev/class/light/123 print AMBER_LED
Value of AMBER_LED: Brightness 1.000000
View the brightness and color of a light
$ lights-cli /dev/class/light/123 print 1
Value of lp50xx-led-1: Brightness 0.745098 RGB 0.235294 0.176471 0.164706
Set the brightness of a light
$ lights-cli /dev/class/light/123 set AMBER_LED 0.5
# This command exits silently.
Set a light to display the color purple
$ lights-cli /dev/class/light/123 set 5 0.5 0 0.5
# This command exits silently.
View the total light count and each light's brightness and capabilities
$ lights-cli /dev/class/light/123 summary
Total 1 lights
Value of AMBER_LED: Brightness 0.500000
Capabilities: Brightness
List the device paths of all lights
$ lights-cli list
/dev/class/light/123
Notes
Accessing this command
This command is only available on certain diagnostic and testing Fuchsia builds.
This is a device-side command, not a host-side command like fx
or ffx
.
In other words before calling this command you must first access the
shell of the Fuchsia device.
To interactively access the Fuchsia device's shell:
ffx component explore <component>
Replace <component>
with the name of the component that has access to
the command documented on this page.
To call a single command and return the output to the host:
ffx component explore <component> -c "<command>"
Replace <command>
with one of the commands documented on this page.
Source code
Source code for lights-cli
: //src/ui/light/bin/lights-cli/