第8章 Input Devices

This chapter explains how to receive events from input devices. On the Armadillo-440 LCD Model, the touch screen and buttons are supported as input devices. For the specifications of the touch screen and button drivers, refer to the "Touch Screen" and "Buttons" chapters in the "Armadillo-400 Series Software Manual."

8.1. evtest

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

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

図8.1 evtest Command Format


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

表8.1 Input Device Files

Device FileDevice
/dev/input/event0Buttons
/dev/input/event1Touch Screen

[警告]

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.

In the default Armadillo-440 LCD Model userland, the input device file name specified when starting xfbdev is fixed. Therefore if another input device such as a USB keyboard has been connected, it is possible that touch screen control will not work. To use other input devices, please connect them after booting.

Enter Ctrl + C to stop evtest.

8.2. swmgr

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

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

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

図8.2 swmgr Command Format


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

表8.2 Buttons Supported By swmgr

ButtonsDescription
sw0SW1
sw1LCD_SW1
sw2LCD_SW2
sw3LCD_SW3

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.

8.3. swmgr Example

The following displays time information when SW1 is pressed.

[armadillo ~]# swmgr sw0 1 date

図8.3 swmgr Example 1


The following turns LED3 on when LCD_SW1 is pressed and turns it off when LCD_SW2 is pressed.

[armadillo ~]# swmgr sw1 0 echo 1 > /sys/class/leds/red/brightness &
[armadillo ~]# swmgr sw2 0 echo 0 > /sys/class/leds/red/brightness &

Note: Execute the following command to stop the operations.
[armadillo ~]# killall swmgr

図8.4 swmgr Example 2