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

key_events=( uinput.KEY_ESC, )
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)

while True:

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.