I worked on a Python script to make possible to map the Battery Indicator Button (BIB) to ESC Keyboard key.
It could be useful if you manage to play ports like SORR or Solarus games for example, as you can't propely exit theses games without a keyboard connected to your Raspiboy.
This doesn't need retrogame app, but only Python uinput module.
First, download the last module version (0.11.2) here
Connect to your Raspiboy in SFTP (only if you are using Raspberry Pi Zero W).
If you have only Raspberry Pi Zero, you may open your Raspiboy and read your µSD on a Linux distribution to access to all partitions (you could use virtual machine as well).
Unzip python-uinput-0.11.2.tar.gz to /home/pi/, so you will have /home/pi/python-uinput-0.11.2
Open a SSH session to your raspiboy (if you only have Raspberry Pi Zero, you may connect a USB Keyborad and press F4).
type theses commands :
Code: Select all
cd python-uinput-0.11.2/
sudo python setup.py build
sudo python setup.py install
Now let's write a python script that will map the BIB. The file escbutton.zip is attached below
Unzip it and put it in /home/pi/ by using your favorite SFTP client (Like WinSCP or FileZilla). So you will have /home/pi/escbutton.py.
Last but not least, let's make the script autorun during the boot process.
You will need a root access to your Raspiboy, so please watch this video if you don't know how.
Once your connect in SFTP with root acces, edit the file /etc/rc.local that's should looks like this :
Code: Select all
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
exit 0
Code: Select all
(sleep 10;python /home/pi/escbutton.py) &
printf "Power Status Button is mapped"
You can keep the second if you want but it's not necessary.
Now you can reboot your console, that's all !
Note that if you have problem you should always connect to your Raspiboy in SFTP on root access, edit the rc.local file and delete or comment the lines.
uinput seems to be a powerful module, able to makes intersting things.
I'll look forward to try to make more things with the back buttons
I hope you enjoy this tutorial and that it will be useful
See you