Power-Shell Tool
Note:
Currently in the beta phase.
Power-Shell is a tool designed to implement device power state transitions and related functionalities, providing developers with basic device power state debugging capabilities, such as screen off, wake-up, setting power modes, etc.
Environment Requirements
Before using this tool, developers need to obtain the hdc tool and execute hdc shell.
Power-Shell Command Tool List
| Command | Description |
|---|---|
| help | Help command, displays supported command information for power-shell. |
| setmode | Power mode setting command, used to configure the current device's power mode. |
| wakeup | Screen wake-up command, used to wake the system and turn on the screen. |
| suspend | Screen off command, used to suspend the system and turn off the screen. |
| timeout | Auto screen-off command, used to override or restore the auto screen-off time set in system settings. |
Help Command
# Display help information
power-shell help
Set Power Mode Command
power-shell setmode
Power Mode Setting Command List:
| Command | Description |
|---|---|
| power-shell setmode -h | Displays command information supported by setmode. |
| power-shell setmode 600 | Normal mode. |
| power-shell setmode 601 | Power-saving mode. |
| power-shell setmode 602 | Performance mode. |
| power-shell setmode 603 | Ultra power-saving mode. |
Examples:
# Set device power state to normal mode
power-shell setmode 600
# Set device power state to power-saving mode
power-shell setmode 601
# Set device power state to performance mode
power-shell setmode 602
# Set device power state to ultra power-saving mode
power-shell setmode 603
Screen Wake-Up Command
power-shell wakeup
Screen Wake-Up Command List:
| Command | Description |
|---|---|
| power-shell wakeup | Turns on the screen. |
Example:
# Shell command to wake up the screen
power-shell wakeup
Screen Off Command
power-shell suspend
Screen Off Command List:
| Command | Description |
|---|---|
| power-shell suspend | Turns off the screen. |
Example:
# Shell command to turn off the screen
power-shell suspend
Auto Screen-Off Command
power-shell timeout
Auto Screen-Off Command Parameter List:
| Parameter | Description |
|---|---|
| -o <time> | Required parameter, sets the auto screen-off time. [time] is in milliseconds. |
| -r | Required parameter, restores the auto screen-off time to the current system setting. |
Examples:
# Current system setting for auto screen-off is 30 seconds
# Shell command to set auto screen-off time to 15000 milliseconds
power-shell timeout -o 15000
# Restore system auto screen-off setting, now the auto screen-off time is 30 seconds
power-shell timeout -r