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.