| How to use the buttons on OMAP development boards |
|
|
|
|
Beagle, Overo, and Panda all have push buttons that are connected to GPIO pins. Overo has 2 buttons, Beagle and Panda each have a single button. The kernels for these boards implement the kernel gpio-keys feature, which makes button press events available through the linux input system. These state changes are tied to standard input events and can be monitored by reading /dev/input/by-path/platform-gpio-keys-event. The default setup returns the standard codes BTN_0 and BTN_1 on Overo, and BTN_0 for Beagle and Panda. These codes are defined in /include/linux./input.h You can easily test this functionality using the evtest utility, which is included in the GNOME image. The evtest utility takes the raw events being reported on /dev/input/by-path/platform-gpio-keys-event and prints them in a human friendly form. The following command will report state changes on the button(s) set up with gpio-keys. For this example, we will use Overo, which has two buttons set up. To start the monitoring: # evtest /dev/input/by-path/platform-gpio-keys-event Nothing further will be printed until we press a button. Let's start with the first button (labeled gpio23): Event: time 1293485115.917332, type 1 (Key), code 256 (Btn0), value 0 We see that events are report for both the button press and the button release. And then pressing the second button (labeled gpio14): Event: time 1293486786.146955, type 1 (Key), code 257 (Btn1), value 0 Of course you can also monitor the raw data stream from /dev/input/by-path/platform-gpio-keys-event. The events are 16 bytes in length, so using hexdump to view them makes it relatively easy to interpret: # hexdump /dev/input/by-path/platform-gpio-keys-event Pressing the first button yeilds: 0000000 0fda 4d19 9553 0000 0001 0100 0000 0000 And pressing the second button: 0000040 0fde 4d19 a24e 0000 0001 0101 0000 0000 |
| Last Updated on Friday, 31 December 2010 07:43 |
0 Comments