1# power-shell
2
3
4power-shell is a tool used to convert the power status of a device. It provides basic capabilities such as turning off the screen, waking up the device, and setting the power mode.
5
6## Environment Setup
7<!--RP1-->
8Before using this tool, you must obtain [hdc](../dfx/hdc.md) and run the **hdc shell** command.
9<!--RP1End-->
10
11## power-shell commands
12
13| Command| Description|
14| -------- | -------- |
15| help | Obtains the help information about the commands supported by power-shell.|
16| setmode | Sets the power mode of the current device.|
17| wakeup | Wakes up the system and turns on the screen.|
18| suspend | Suspends the system and turns off the screen.|
19| timeout | Overwrites or restores the automatic screen-off time in system settings.|
20
21
22## help
23
24```bash
25# Display the help information.
26power-shell help
27```
28
29
30## setmode
31
32```bash
33power-shell setmode
34```
35
36**setmode commands**
37
38| Command                               | Description                      |
39| ----------------------------------- | -------------------------- |
40| power-shell setmode -h | Displays the parameters supported by the **setmode** command.|
41| power-shell setmode 600 | Enables the normal power mode.|
42| power-shell setmode 601 | Enables the power saving mode.|
43| power-shell setmode 602 | Enables the performance mode.|
44| power-shell setmode 603 | Enables the ultra power saving mode.|
45
46Example:
47```bash
48# Enable the normal power mode.
49power-shell setmode 600
50# Enable the power saving mode.
51power-shell setmode 601
52# Enable the performance mode.
53power-shell setmode 602
54# Enable the ultra power saving mode.
55power-shell setmode 603
56```
57
58
59## wakeup
60
61```bash
62power-shell wakeup
63```
64
65**wakeup command**
66
67| Command                         | Description                    |
68| ----------------------------- | ------------------------ |
69| power-shell wakeup | Turns on the screen.|
70
71
72Example:
73
74```bash
75# Run the shell command to turn on the screen.
76power-shell wakeup
77```
78
79
80## suspend
81
82```bash
83power-shell suspend
84```
85
86
87**suspend command**
88
89| Command      | Description                      |
90| ---------- | -------------------------- |
91| power-shell suspend  | Turns off the screen.|
92
93
94Example:
95
96```bash
97# Run the shell command to turn off the screen.
98power-shell suspend
99```
100
101## timeout
102
103```bash
104power-shell timeout
105```
106
107**timeout commands**
108| Parameter      | Description                      |
109| ---------- | -------------------------- |
110| -o \<time\> | Sets the automatic screen-off time. This parameter is mandatory. in milliseconds.|
111| -r | Restores the automatic screen-off time in the current system settings. This parameter is mandatory.|
112
113Example:
114
115```bash
116# The automatic screen-off time is set to 30s in the current system settings.
117# Run the shell command to set the automatic screen-off time to 15000 ms.
118power-shell timeout -o 15000
119# Restore the automatic screen-off time set by the system, which is 30s.
120power-shell timeout -r
121```
122