"Das U-Boot" Source Tree
at master 67 lines 1.5 kB view raw
1.. SPDX-License-Identifier: GPL-2.0+ 2 3.. index:: 4 single: button (command) 5 6button command 7============== 8 9Synopsis 10-------- 11 12:: 13 14 button list 15 button <name> 16 17Description 18----------- 19 20The button command is used to retrieve the status of a button. To show the 21status of a button with name 'button1' you would issue the command 22 23:: 24 25 button button1 26 27The status of the button is both written to the console as *ON* or *OFF* and 28set in the return value variable *$?* as 0 (true) or 1 (false). To retrieve 29the status of a button with name *button1* and to write it to environment 30variable *status1* you would execute the commands 31 32:: 33 34 button button1 35 setenv status1 $? 36 37A list of all available buttons and their status can be displayed using 38 39:: 40 41 button list 42 43If a button device has not been probed yet, its status will be shown as 44*<inactive>* in the list. 45 46Configuration 47------------- 48 49To use the button command you must specify CONFIG_CMD_BUTTON=y and enable a 50button driver. The available buttons are defined in the device-tree. 51 52Return value 53------------ 54 55The variable *$?* takes the following values 56 57+---+-----------------------------+ 58| 0 | ON, the button is pressed | 59+---+-----------------------------+ 60| 1 | OFF, the button is released | 61+---+-----------------------------+ 62| 0 | button list was shown | 63+---+-----------------------------+ 64| 1 | button not found | 65+---+-----------------------------+ 66| 1 | invalid arguments | 67+---+-----------------------------+