0

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.

asked Jun 24, 2014 at 8:32

1 Answer 1

0

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.

answered Jun 24, 2014 at 9:57

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.