I finished the first prototype for the MMS Photo-inator Xsi a few months back. It will take a picture when someone presses the button. Then, it displays the picture on the screen for a few seconds. Next, it flashes the lights on the green and red buttons and waits for the person to press one. If the person presses the red button, the program deletes the picture and resets. If the person presses the green button, the program keeps the picture and resets.
One thing that I need the Photo-inator to do is stop displaying the picture if the person presses either the red or green button. I have not been able to figure that out, until now.
I tried sending a keystroke to the session but that did not work. I also tried killing the process but that did not work. I tried other software and solutions but could not find one. I spent the last few months trying to figure this out. It has been extremely frustrating. Here is how I finally resolved the problem.
I heard that the uinput module for python will allow me to send keystrokes to a session. I downloaded the source code from here: https://pypi.python.org/pypi/python-uinput
sudo apt-get install libudev.so
sudo python setup.py buildsudo python setup.py install
import subprocessimport psutilimport timeimport uinput
subprocess.call("fbi -a -T 1 -1 /home/ken/Pictures/BBB.jpeg", shell=True)time.sleep(3)
#Uinput testsevents = ( uinput.KEY_Q, uinput.KEY_H, uinput.KEY_L, uinput.KEY_O, )
device = uinput.Device(events)time.sleep(1)
Finally, I modified the photo-inator program to use the uinput code. I need to fire up the whole system to test it out. I'll do that some other day.