Armadilloフォーラム

Armadillo-640 ユーザースイッチの状態を取得する方法

shun

2023年5月23日 16時24分

お世話になっております。

Armadillo-640に搭載されているユーザースイッチを押下すると、コマンドを実行するという仕組みを実現したいです。

シェルスクリプト上でユーザースイッチの状態を取得する方法がございましたらお教え願いたいです。

よろしくお願いいたします。

コメント

at_koseki

2023年5月30日 22時03分

古関です。

ユーザースイッチはインプットデバイスのキーイベントで状態取れますが、
シェルスクリプトからやろうとすると、結構手間ですよね。。
https://manual.atmark-techno.com/armadillo-640/armadillo-640_product_ma…

buttondを使ってみてはいかがでしょうか。
(現時点では、Armadillo-IoT G4, Armadillo-X2, Armadillo-IoT A6E向けなのですが、Armadillo-640でも動きます)

■ ATDEでビルド

[atde]# git clone https://github.com/atmark-techno/buttond.git
[atde]# cd buttond/
[atde]# git checkout 1.1
[atde]# make CC=arm-linux-gnueabihf-gcc
 
buttondがビルドできる

■ Armadilloで実行

buttondを実行権限付きでarmadilloにコピー
 
スイッチを押すと"hello armadillo"が表示される
[armadillo]# ./buttond /dev/input/event0 -s enter -a "echo hello armadillo"