Skip to content

Instantly share code, notes, and snippets.

@straight-shoota
Last active April 30, 2024 20:30
Show Gist options
  • Save straight-shoota/8ce901271a4d80bb88981fac3acb9d09 to your computer and use it in GitHub Desktop.
Save straight-shoota/8ce901271a4d80bb88981fac3acb9d09 to your computer and use it in GitHub Desktop.
Photoboy key trigger
# /etc/systemd/system/multi-user.target.wants/photobox-trigger.service
[Unit]
Description=Photobox Trigger Service
After=multi-user.target
[Service]
Type=idle
User=pi
ExecStart=/usr/bin/python3 /home/pi/photobox/trigger.py
Restart=on-failure
[Install]
WantedBy=multi-user.target
from evdev import InputDevice, ecodes
import sys
import os
KEYBOARD = "/dev/input/event0"
device = InputDevice(KEYBOARD)
for event in device.read_loop():
if event.type == ecodes.EV_KEY:
if((event.code == ecodes.KEY_PAGEDOWN or event.code == ecodes.KEY_ENTER) and event.value == 0 ):
os.system("echo hi")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment