So I have a python script that emulates an ESC_KEY on pin 17.
#!/usr/bin/env python
#Imports for Pins,input
import RPi.GPIO as GPIO
import uinput
from time import sleep
#Setup
key_events=( uinput.KEY_ESC, )
device=uinput.Device(key_events)
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)
#MAIN
while True:
GPIO.wait_for_edge(17,GPIO.FALLING)
device.emit(uinput.KEY_ESC,1)
sleep(2)
device.emit(uinput.KEY_ESC,0)
Is there an "easy" way to set this up as a kernel module, or does anyone have some good documentation to create this kernel module? Do I need to rewrite it using C?
It seems as this is eating alot of resources when running in python, I'm hoping it would be less a strain on the system when run as module.
1 Answer 1
Kernel module writing would require quite a bit of effort on your part. I'd guess a week or so of work to get a working module.
I'm not sure why Python is eating so many resources. It should just be waiting.
I'd go for a standard userland C solution.