Event Buttons and Leds


Primeiramente gostaria de salientar que não sou o autor principal do conteúdo deste artigo. A minha intenção é de mostrar o que outros autores tem realizado (referenciando links para o conteúdo original) neste blog até como um guia pessoal para uso próprio e ainda compartilhar minhas anotações e pequenas modificações que realizo no conteúdo, desejando que possa ajudar mais alguém em algum lugar.
First and foremost, I take no credit for any of this post’s content. I am really just taking what others have done (which I have links to bellow) and am putting it on my blog for a personal reference and hopefully the small changes that I made to their guides will help someone somewhere.


apt-get install asciidoc
cd /usr/src

git clone https://github.com/gandro/input-event-daemon.git
cd input-event-daemon
make
make install


 input-event-daemon -m
input-event-daemon: Monitoring mode started. Press CTRL+C to abort.

/dev/input/event0:
  keys      : POWER

/dev/input/event0:
  keys      : COPY

/dev/input/event0:
  keys      : RESTART


nano rc.local
input-event-daemon

nano /etc/input-event-daemon.conf

#
# /etc/input-event-daemon.conf
#

[Global]
listen = /dev/input/event0

[Keys]
# reset button on
RESTART = echo "reset key"

# power button on
POWER = shutdown -hP now

# backup button on
COPY = bash /usr/local/bin/backup.sh

[Idle]
1h 30m = echo "this was after 1h30m the last event"
reset = echo "some event happend after idle time"




Leds: http://elinux.org/EBC_Exercise_10_Flashing_an_LED

ls -1F /sys/class/leds/

echo 1 > /sys/class/leds/status:blue:backup_led /brightness
echo 1 > /sys/class/leds/status:white:rebuild_led/brightness
echo 1 > /sys/class/leds/status:white:power_led/brightness
echo 1 > /sys/class/leds/status:red:health_led/brightness

Piscar o led de backup:
echo timer > /sys/class/leds/backup_led/trigger
echo 100 > /sys/class/leds/status:blue:backup_led  /delay_on
echo 900 > /sys/class/leds/status:blue:backup_led  /delay_off

echo 0 > /sys/class/leds/backup_led/brightness
echo none > /sys/class/leds/backup_led/trigger


debian jessie com dtb

ls /sys/class/leds
status:blue:backup_led  
status:white:power_led
status:red:health_led   
status:white:rebuild_led


echo 1 > /sys/class/leds/status:blue:backup_led/brightness
echo 0 > /sys/class/leds/status:blue:backup_led/brightness

ls /sys/class/leds/status:blue:backup_led/
brightness  
device  
max_brightness  
power  
subsystem  
trigger  
uevent


cat /sys/class/leds/status:blue:backup_led/brightness
0

ls /sys/class/leds/status:blue:backup_led/device
driver  driver_override  leds  modalias  of_node  power  subsystem  uevent

cat /sys/class/leds/status:blue:backup_led/max_brightness
255

 ls /sys/class/leds/status:blue:backup_led/power
autosuspend_delay_ms  runtime_active_time  runtime_suspended_time
control               runtime_status


ls /sys/class/leds/status:blue:backup_led/subsystem
status:blue:backup_led  status:white:power_led
status:red:health_led   status:white:rebuild_led

 cat /sys/class/leds/status:blue:backup_led/trigger
[none] kbd-scrollock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock nand-disk timer cpu0 default-on usb-gadget usb-host 

cat /sys/class/leds/status:blue:backup_led/uevent




Temperatura é obtida pelo comando:
cat /sys/class/hwmon/hwmon0/temp1_input
cat /sys/class/hwmon/hwmon0/temp2_input




Comments