temperature-cli is a command-line tool for interacting with temperature, ADC (Analog-to-Digital Converter), and trippoint devices in Fuchsia.
temperature-cli [device] <command> [args...] [<command2> [args2...] ...] temperature-cli list temperature-cli read-all temperature-cli --help
device can be:
/dev/class/temperature/000 or /svc/fuchsia.hardware.temperature.Service/default)soc-thermal)a2471f28e36fbe951476bce7910aa396)If device is omitted, the tool will attempt to resolve it automatically:
Multiple commands can be chained together sequentially (e.g., trippoint ... wait). Commands targeting the same device protocol share the same persistent connection. This is particularly useful for oneshot trippoints to guarantee they trigger and get handled without a connection drop reset:
$ temperature-cli LITTLE trippoint 0:above,35 wait
Note that only one device can be targeted with each temperature-cli invocation.
help (also -h, --help): Show the usage help message.$ temperature-cli --help Usage: temperature-cli [device_path_or_name] <command> [args...] temperature-cli list temperature-cli --help ...
list: List all temperature device paths and their friendly names.$ temperature-cli list Found 2 temperature devices: soc-thermal (/svc/fuchsia.hardware.temperature.Service/default) pmic-thermal (/dev/class/temperature/001)
read-all: List all temperature devices found and read their temperatures.$ temperature-cli read-all Found 2 temperature devices: soc-thermal (/svc/fuchsia.hardware.temperature.Service/default) pmic-thermal (/dev/class/temperature/001) Reading soc-thermal ... temperature = 42.500000 Reading pmic-thermal ... temperature = 38.200000
These commands operate on fuchsia.hardware.temperature devices. You can refer to them by their absolute path or their friendly name (as shown in list).
read: Read the current temperature in Celsius.$ temperature-cli soc-thermal read temperature = 42.500000
$ temperature-cli /dev/class/temperature/000 read temperature = 42.500000
$ temperature-cli read Multiple temperature devices found: 1. soc-thermal (/svc/fuchsia.hardware.temperature.Service/default) 2. pmic-thermal (/dev/class/temperature/001) Select a device (1-2): 1 Using temperature device: soc-thermal (/svc/fuchsia.hardware.temperature.Service/default/device) temperature = 42.500000
name: Get the sensor's friendly name.$ temperature-cli /svc/fuchsia.hardware.temperature.Service/default name Sensor Name = soc-thermal
These commands operate on fuchsia.hardware.adc devices.
resolution: Get the ADC resolution.$ temperature-cli /dev/class/adc/000 resolution adc resolution = 12
read: Read a raw ADC sample.$ temperature-cli /dev/class/adc/000 read Value = 2048
read-norm: Read a normalized ADC sample (range 0.0 to 1.0).$ temperature-cli /dev/class/adc/000 read-norm Value = 0.500000
These commands operate on fuchsia.hardware.trippoint devices.
trippoint: Get or set trippoints.$ temperature-cli /svc/fuchsia.hardware.trippoint.Service/default/trippoint trippoint { .index = 0, .type = OneshotTempAbove, .configuration = OneshotTempAboveTripPoint(85.000000), }, { .index = 1, .type = OneshotTempBelow, .configuration = ClearedTripPoint, },
index:type,configuration):$ temperature-cli /svc/fuchsia.hardware.trippoint.Service/default/trippoint trippoint 0:above,90.0 1:below,cleared Setting trippoints: { .index = 0, .type = OneshotTempAbove, .configuration = OneshotTempAboveTripPoint(90.000000), }, { .index = 1, .type = OneshotTempBelow, .configuration = ClearedTripPoint, },
wait: Wait for any trippoint to be triggered.$ temperature-cli /svc/fuchsia.hardware.trippoint.Service/default/trippoint wait # (blocks until triggered) TripPoint indexed 0 was tripped. Measured temperature was 90.500000 C
trigger (Debug): Manually trigger a trippoint (requires Debug service).$ temperature-cli /svc/fuchsia.hardware.trippoint.DebugService/default/debug trigger 1