第6章 Input Devices

This chapter explains how to receive events from input devices. On Armadillo-420, the buttons are supported as input devices. For the specifications of the button driver, refer to the "Buttons" chapter in the "Armadillo-400 Series Software Manual."

6.1. evtest

The evtest command can be used to check what kind of input events are occurring. evtest is used as shown in 図6.1「evtest Command Format」.

[armadillo ~]# evtest /dev/input/eventX

図6.1 evtest Command Format


For the device file to specify in place of /dev/input/eventX, refer to 表6.1「Input Device Files」.

表6.1 Input Device Files

Device FileDevice
/dev/input/event0Buttons

[警告]

The event device file numbers are determined by the order the input devices are detected. Therefore, if another input device such as a USB keyboard is detected at boot time, the event device numbers may change.

Enter Ctrl + C to stop evtest.

6.2. swmgr

The swmgr command can be used to execute another command when a button is pressed.

swmgr is used as shown in 図6.2「swmgr Command Format」.

[armadillo ~]# swmgr [BUTTON] [LOOP] [COMMAND]

図6.2 swmgr Command Format


Specify the button to receive events from in place of BUTTON. For supported buttons, refer to 表6.2「Buttons Supported By swmgr」.

表6.2 Buttons Supported By swmgr

ButtonsDescription
sw0SW1

Specify the number of times to wait for an event in place of LOOP. Specify 0 for an unlimited number of times.

Specify the operation to execute when an event occurs in place of COMMAND.

6.3. swmgr Example

To display time information when SW1 is pressed, execute the command as shown in 図6.3「swmgr Example 1」.

[armadillo ~]# swmgr sw0 1 date

図6.3 swmgr Example 1