PIA with OpenVPN on Raspberry Pi

Here is a quick guide on setting up OpenVPN with PIA VPN (Private Internet Access)

I am running Raspbian Jessie Lite on a Raspberry Pi 3, i will also be investigating running this with OSMC in the future.


First off we need to ensure your Pi is up to date and install the OpenVPN software

sudo apt-get update
sudo apt-get install openvpn

Once installed make sure you are in the pi users home directory

cd /home/pi

create a new folder called pia_profiles and navigate into that folder

mkdir pia_profiles

cd /home/pi/pia_profiles

Download the PIA profiles from Pia website, the download is a zip file

wget https://www.privateinternetaccess.com/openvpn/openvpn.zip

Extract the files

unzip openvpn.zip

Now we need to copy some files over to the openvpn install folder

sudo cp crl.rsa.2048.pem /etc/openvpn/crl.rsa.2048.pem
sudo cp ca.rsa.2048.crt /etc/openvpn/ca.rsa.2048.crt

The zip file you extracted contains all the profiles for various servers that PIA use. I personally use a UK one but you can use anything, for this example i will use the UK London profile.

sudo cp "UK London.ovpn" /etc/openvpn/pia.conf

Navigate to the OpenVPN install location

cd /etc/openvpn

We need to create a login conf file, this way you can keep your username and password out of the configuration files.

sudo nano login.conf

Type your PIA username and password on seperate lines and save the file (normally Ctrl+O)

Username
Password

Change the permissions on the file so all users can read the file (this step might not be needed but its what i do)

sudo chmod 755 login.conf
sudo cmod 755 pia.conf

Edit the pia.conf file for the PIA connection

sudo nano pia.conf

At the bottom add the following line

auth-user-pass login.conf

The file should look similar to this (the remote line will be different based on the profile you used)

client
dev tun
proto udp
remote uk-london.privateinternetaccess.com 1198
resolv-retry infinite
nobind
persist-key
persist-tun
cipher aes-128-cbc
auth sha1
tls-client
remote-cert-tls server
auth-user-pass
comp-lzo
verb 1
reneg-sec 0
crl-verify crl.rsa.2048.pem
ca ca.rsa.2048.crt
disable-occ
auth-user-pass login.conf


Before we start the VPN connection its best to check your current external IP, you can do this by running

curl ifconfig.co

Note the returned IP address, now start the VPN by using the following command

sudo systemctl start openvpn@pia.service

Run curl ifconfig.co command again and see if the output is different. If it is then great you are connected, if it isnt then something isnt right and i would suggest reviewing the steps above.


If you wish to run this upon boot then use the below command

sudo systemctl enable openvpn@pia.service

To disable running this at startup run this command:

sudo systemctl disable openvpn@pia.service

You can also run openvpn interactively by running

openvpn pia.conf

Running it interactively is useful to diagnose problems but obviously you can call it from a script.

FileBot on Raspbian Jessie

Recently my Raspberry Pi had a corrupt partition on the SD card so i was forced to reinstall from scratch.  Although i had a backup of my scripts i had to download and configure the applications i was using.

I noticed when i was browsing my previous blog post on FileBot that the version i was using is no longer available.  As such i have decided to write a new blog post outlining what is needed to get the latest version working.

First off if you dont know what FileBot is its a really great app that automates the renaming of TV shows and Movies.  I use it to automatically rename files and move them to my NAS so OSMC will automatically detect and add them to the library.  For more information have a read of the FileBot website.


FileBot requires Java run time, im not going to go into details on how to set this up but i personally used this blog post and it worked for me:

https://www.linuxbabe.com/desktop-linux/install-oracle-java-8-debian-jessie-raspbian-jessie-via-ppa

Im using Raspbian Jessie Lite, from my understanding if you are using the full Raspbian Java is already included but you might want to check that.  You can run the following command to check:

java -version

Once Java is setup we we need to ensure you are in the pi home directory

cd /home/pi

Create a new directory in here, this will store the FileBot application

mkdir filebot

We need to download the latest version of FileBot, from my research the ipk file i was using in my previous blog post doesnt exist and the version that does exist gives an error in regards to a blacklist.xml file not being found on the internet.

The latest version doesnt include an ipk version, as such we will use the portable version as that includes the filebot.jar and the filebot.sh script we need.

The downloads are located here: https://sourceforge.net/projects/filebot/files/filebot/

Look for the latest “portable.tar.xz” version and download it to your pi home directory

wget https://sourceforge.net/projects/filebot/files/filebot/FileBot_4.7.9/FileBot_4.7.9-portable.tar.xz

Extract the files from the tar to our filebot folder

tar xpvf FileBot_4.7.9-portable.tar.xz -C /home/pi/filebot

Thats it, we can now call filebot via a script pointing your script to /home/pi/filebot/filebot.sh

Example:

/home/pi/filebot/filebot.sh -rename path/to/episodes

There is some great command line documentation available on the FileBot website here: http://www.filebot.net/cli.html

Tado Smart Thermostat Installation and Setup

So after unboxing the Tado Smart Thermostat and Radiator Thermostat it was time to install them both.

My Tado Website

To begin I needed to create an account on the My Tado website so i could add the devices to my account.  Registering the devices is simple, the site gives you a list of the devices available and you then enter the serial number and auth code located on the devices.

After I added a device a guide on how to install the device is shown, you can cancel out and resume the installation at any point during the installation.  The guides i saw are excellent and are tailored to you based on the type of heating system you have and the thermostat you are replacing, i actually ran through the setup for both devices using the mobile browser on my iPhone and had no problems following the instructions.

I started with the Radiator Thermostat first because it appeared to be a simpler installation and i could do this whilst the power was still on to the heating system.

Radiator Thermostat Installation

Following the installation guide on the My Tado website i was instructed to remove the base of the valve from the radiator thermostat to gain access to the battery and pairing buttons.

The base simply came apart from the body as they are not clicked together in the box.  Inside the body at the bottom is a blue battery tag, removing this begins the setup process, the display sprung into life and after the thermostat saying “Hi” to me i was presented with a spanner symbol.

The online guide told me to hold down the pairing button for a few seconds, once that was done a connection was made through the internet bridge to the My Tado website.  The guide updated to inform me the Radiator Thermostat was successfully connected to the Tado servers.

The guide continued asking me to remove the existing radiator valve, as you can see the guide is very clear and concise and provides links to additional information if required.  The valve i was replacing was a standard TRV.  All i had to do was unscrew the TRV from the base and it came straight off.

  

I begin fitting the Tado Radiator Thermostat to the existing TRV base and found that the base spun around rather than being fitted correctly, this didnt seem right so i took it off and compared the old TRV and the Tado Radiator Thermostat.  As you can see the Tado one has a larger opening compared to the existing TRV, this meant the Tado device wasnt gripping to anything despite being screwed in correctly.

I struggled with this for a while, trying to understand the mechanism involved.  I was unsure if it needed to be fitted exactly or if having the base spinning was a going to be a problem, from my understanding and monitor other TRVs the valve adjustment is actually done by depressing the valve rather than spinning it (please correct me if i am wrong).  So with that I decided to crack on and install it anyway, the next step was having is screwed in place was to refit the body to the base.   To do this the guide says to turn the body to the right until you hear a click, however with the base spinning i couldnt do this without holding firmly on the base and hoping it didnt spin.  Finally after a few tries the body clicked into the base.

Completing the setup guide you are asked to give the zone a name, i gave the zone an appropriate name and finished the setup.  From there is could then control the radiator from the website, more on that later.

Smart Thermostat Installation

With the heating switched off I set about installing the Smart Thermostat, i was replacing a Honeywell T6360 thermostat located in our living room.  This is a wired thermostat connected to a Honeywell ST9400C.  This system isnt great, the programmer only supports 2 on/off cylces and the thermostat seems to always think the room is 15 degrees.

Honeywell Thermostat Honeywell Programmer

As with the Radiator Thermostat you need to register the device on the My Tado website using the serial number and auth code, these are found under the base plate.

Once registered the installation guide asks you for your existing heating setup e.g. wired thermostat + programmer or wireless thermostat etc…

My system is a basic wired thermostat + programmer with an oil powered boiler.  After i selected this i was asked to provide the make and model of my existing thermostat, programmer and boiler.  I entered the details above, I knew the boiler was kind of irrelevant with the Tado installation so i just picked something which looked like my existing boiler as i couldnt remember the make or model.

After you have given the information the My Tado website gives you an installation guide designed especially for the model of thermostat you are replacing, this is really great and makes the installation a breeze.  As someone who hasnt installed or replaced a thermostat i was concerned before i started, i have also come across my fair share of terrible guides which actually make the installation of devices harder than they should be, however this guide was super easy to follow and i cant praise this enough to be honest.  It really is excellent!

Starting as before i had to remove the blue battery tag first, I was again presented with a “Hi” message and the device started pairing automatically, once paired a got a big tick mark.  The online guide also confirmed the Smart Thermostat had connected to the Tado servers.

  

Moving on, the guide asked me to remove the front of my Honeywell thermostat.  To do that there is a single screw at the top of the unit, undoing this i could then remove the fascia of the thermostat to reveal the wiring.  My unit had 3 wires connected to it, the RED was connected to number 1, the BLACK was connected to number 3 and the bare cable was the EARTH cable.

 

Inside the box were some sticker labels, these are used to label the existing cables for installation but also for retrofitting the old thermostat back.  The guide told me which cables should be labelled e.g. RED (1) is the COM cable, BLACK (3) is the NO cable and EARTH is EARTH 🙂

 

I unscrewed the cables and labelled them accordingly, then i set about removing the base plate from the wall which was simple enough.

 

I fitted the Tado base plate into the existing gap, this base plate is larger than the old one so it covered the hole nicely,  the wiring went through the hole and out of the front with no problems.

Wiring the Tado base plate was simple enough, again the guide tells you exactly which wire needs to go where.  As i only had the NO and COM cables i connected them and then connected the EARTH to the 4th connection along as per the guide.  I then tided the cables to the fascia could be reconnected without causing problems and refitted the fascia.

 

The next part of the guide informed me about the programmer setup, nothing was needed wiring wise however for the Tado system to work i need to set the heating to “continuous” mode.  This for me is still the oddest part, how can leaving my heating on save me money?  I suppose the proof is in the pudding and we will have to see if it saves us money in the long run.

With the programmer setup, the thermostat wired in i replace i completed the setup, named my zone and could then adjust the device from the My Tado website.

I have also downloaded the Tado app for myself and my fiance’s iPhones.   Ill go through the app in more detail in another post but so far it works ok, i personally think it could have done with a bit of a better intro screen to help explain what each part on the app is however the online PDF guides on the Tado support pages helped me understand it.

Annoyingly also because of the order i set my system up in (Radiator then Thermostat) my Zones in the app are also in this order and there is no way to reorder them.  I need to drop a support message into Tado to ask if this can be done because at the moment if i open the app i am presented with the radiator thermostat first and i have to swipe to get to the main thermostat, a minor annoyance.

Overall Thoughts

The installation of both devices couldnt have been easier to be honest, as someone who hasnt installed a device like this up before it was a breeze and that is all testament to the tailored online.  They are clear and concise and give you excellent pictures to follow, i cant comment on other products and maybe the other products have similar installation media but ive never experienced this type of device installation before.

As i said in my previous post the Tado devices are both really well built and they look nice on the wall/radiator.  The display is bright and gives you the current ambient temperature and the current heating mode/target temperature.

At the moment im happy with them both, i have adjusted the schedules and temperatures via the app to match what we want.  The automatic AWAY mode seems to work and detected when we left the house and when we where heading back and started heating the house up.

I will make another blog post going over the iOS app and the schedules im using once im a bit more familiar with it.

I do have doubts to whether this will save us money as so far the heating has been on quite a lot to ensure the house is set to the target temperatures however i have witnessed the heating being off and the house doesnt seem to get cold like it did with the old programmer/thermostat.  I know the radiators i have need some balancing and adjustments which will help i am sure.

Tado Smart Thermostat First Impressions

So finally my Tado smart thermostat and radiator thermostat have arrived.  I ordered these back in November 2016 and well the wait has been a long one.  It seems that since i placed my order, Tado couldn’t fulfill their production/delivery quota and everything slipped back in regards production and delivery which has been frustrating to say the least.

I was tempted to cancel my order and go with another product such as Nest or Hive however they always seemed to be quite expensive in comparison to the Tado units and i wasnt sure if they would fit our lifestyle, with shift working the house can sometimes be empty during the day and other times be occupied.  Also Nest and Hive seems to get a bad rap for some reason?

I almost nearly purchased direct from Amazon during Black Friday however Amazon only sell the v2 thermostats (at time of writing) which are not HomeKit enabled and as we are an iOS house having that would be a useful addition.

Ive never had or used a smart thermostat before. I stumbled across Tado from a Reddit post, people seemed to be praising them and from their site the setup and configuration seemed minimal.   The zonal configuration that you can do sounds great, it would ensure our daughters room is always warm regardless of the location of the main thermostat.  Tado uses the iOS app to track GPS of the users to ensure the heating turns on before we get home.  Another great option is that Tado offer a rental of the devices, as a tenant of a rental property this works for us as if we leave we can just give the thermostats back however we still have an option to pay if we want to keep them.

The only other product which i would have considered was an Ecobee3 with additional temperature sensors however i struggled to find them in the UK (at time of writing).

Tado Smart Thermostat

Anyway, enough of the why i went with this and down to the first impressions.

First off, the packing and layout was very good.  Actually opening this felt like opening an Apple product, everything was in its right place, clearly labelled and looks like some excellent precision German engineering.

Tado Box Covers

Included inside the box:

  • Tado Thermostat
  • Tado Internet Bridge
  • Mini USB Cable
  • USB to Power Supply with country adapters
  • Screws, fitting kit and cable stickers

Tado Smart Thermostat

The Tado thermostat feels great quality, comes part easily enough to access the back plate.  I think it will blend nicely into the room decor without looking out of place.

Tado Smart Thermostat Rear

My only gripe with the items included are the USB cable and Ethernet cable are both quite short, the idea is you use a spare USB port on your router to power the Tado bridge.  The USB on the back of my router is already powering a Raspberry Pi so i had to make use of the USB power supply however the supplied cable was too short to reach the extension lead.

So i had to use a longer one, no biggie but longer cables would have been nice.   Same goes for the Ethernet cable. at 10cm it made it quite awkward to get plugged in and connected with everything else going on behind my router (i suspect you can use any RJ45 Cat5e/6 cable but i wanted to use the provided kit where i could).

Tado Internet Bridge

At the moment i believe this is the V2 bridge, looking at their website the bridge listed on their site looks different to this one.  From my understanding the HomeKit integration is still being certified however Tado hope to get the V3 bridges shipped by Q2 2017.  I was informed by Tado customer support that i would receive a new bridge and a software update to enable the HomeKit integration.

Tado Radiator Thermostat

As with the thermostat the quality of the radiator thermostat also feels excellent, this should retro fit onto the existing TRV we have on the radiator where this will be fitted.  The top part of the valve turns like a regular TRV and has a nice tactile feedback click to it when you turn it.   Included with this are some additional fitting valves but that is all.

Tado Smart Radiator Thermostat

Overall Thoughts

So far i’m am impressed with the quality of the devices, i have connected the bridge to my router and started the process of registering the devices on the mytado website.  I will be installing them this weekend and will do my best to capture some photos along the way with a new blog post covering the setup and installation.

Kodi Library and Genesis Integration

Here is a quick guide on how to add TV Shows from the Genesis add on into the Kodi library.

This guide assumes you have Kodi installed  (I am using OpenElec so this guide refers to locations within Linux) and you have enabled the Genesis add on.

First thing we need to do is open the Genesis addon and browse to the TV Shows section.  Find a TV show from one of the sections and with it highlighted open the context menu, then select Add to Library.  This will create a folder within the addon, we will use this folder as a media source for the Kodi library.

Exit out back to the home screen and go to

Settings > Appearance > File Lists

Enable Show Hidden Files and Directories, return to the home screen and then go to

Videos > Files > Add Videos…

Browse to the following location:

home folder > .kodi > userdata > addon_data > plugin.video.genesis > TV shows

With the top level selected click ok to select the TV Shows directory, give the source a name or just accept the default “TV Shows” name.

Set the source content as TV Shows and allow the media source to be updated.  The TV show you added to the Genesis library will now appear in your Kodi library, you can then watch the episodes show without having to browse or search inside the Genesis add on, also any new episodes will automatically appear in your library when you run a library update.

To add more TV shows to the Kodi library go back to the Genesis add on and repeat the above steps however this time you do not need to add another source because you have already done that. Instead the additional shows you added to the Genesis library will automatically appear in the Kodi library after a library update.

You can also do this with Movies, just repeat the above steps but create another source and point it towards the movies folder within the plugin.video.genesis folder.

Enjoy!

Setting up FileBot TV Renamer on a Raspberry Pi

Update 09/06/2017

This post is outdated as the version listed doesnt exist, the version that does exist doesnt work properly for some reason.  As such i have written a new blog page showing how to get the latest version working with Raspbian Jessie Lite.

FileBot on Raspbian Jessie


FileBot is a File Renaming Utility specifically designed for renaming TV shows. The application is available for lots of different platforms including Windows, Mac, Linux and even NAS devices.   We are interested in the Embedded Linux package as this contains everything needed to get it up and running on Raspbian.

This guide assumes you already have the latest version of Raspbian setup and running on your Raspberry Pi.

First off we will create a folder in your home directory to store the download, the download is an IPK which we will need to extract after it has been downloaded. NOTE: at time of writing 4.5.6 was the latest version, best to check the FileBot website to see if there is a later version available)

mkdir filebot

cd filebot

Then run this command to download the application

wget http://sourceforge.net/projects/filebot/files/filebot/FileBot_4.5.6/filebot_4.5.6_arm.ipk

Once downloaded we will need to extract the files in the IPK, to do this we will use the AR utility.

sudo ar -x filebot_4.5.6_arm.ipk

This will extract the contents of the file into our filebot folder, type LS to see a folder list and you will see a new file called “data.tar”

sudo tar -xvf data.tar

This will extract contents of the tarball and put the contents into our filebot folder, type LS again and you will see a new folder called “opt”.  We must now copy the contents of the opt folder into that system /opt/ folder to ensure this works correctly.  NOTE: you can edit the filebot.sh script (located in the /opt/share/filebot/bin/ folder) and run this from any location you wish however for ease of use i am going to install this application into the location specified in the script.   Run the following to copy the share folder into /opt/

sudo cp ~/filebot/opt/* /opt/

We should now change the ownership on the FileBot folder, this is an optional step but without it you will have to invoke your script with the sudo command to ensure the FileBot directories are written to correctly.  To change the ownership run the following command:

sudo chown -R pi /opt/share

We now need to create a script which runs the filebot.sh script and pass some arguments in, the FileBot CLI web page as a list of the available commands and it is well worth a read to understand what this utility can actually do.  For myself i have a simple script which renames any media in a download folder called TV and moves the media after it has been renamed to a folder called TV Shows on my NAS.  This is setup as a source in OpenElec which means new media is scanned into my library.  To create my script create a folder called scripts in your home directory

mkdir scripts

cd scripts

We must then create our script, call it what ever you want

nano tvrenamer.sh

We must then create our script, i am going to use the following arguments

My script is below, this script runs filebot.sh and makes the application look at my transmission downloads folder, renames them with the format “Series NameSeries # x Episode #Title” and moves the media file to a folder with the Series Name/Season #. It uses “thetvdb” for the metadata to ensure the correct show and data is picked, i have also added the date and time to the script so when my cron task runs it updates the log file with the date and time.

#!/bin/bash

DATE_STAMP=’date +%d-%m-%Y-%T’
echo ${DATE_STAMP}

/opt/share/filebot/bin/filebot.sh -rename /mnt/downloads/transmission/complete/TV/* –format “/mnt/videos/TV Shows/{n}/Season {s}/{n} – {sxe} – {t}” –db thetvdb -non-strict

Save the script, make it executable and run the script to test

sudo chmod +x tvrenamer.sh

./tvrenamer.sh

This script can then be run via a cron schedule to ensure media is renamed automatically, i run this every 30 minutes.  To do this edit the crontab by entering the command

sudo crontab -e

At the bottom of the file add the following line, this runs the script every 30 minutes and creates a log file of the output so you can view any problems.

*/30 * * * * ~/scripts/tvrenamer.sh >> ~/scripts/tvrenamer.log 2>&1

Enjoy your automated renaming system, if you wish you can clean up the downloaded files from earlier by running

sudo rm -fr ~/filebot

How to Exit N64 Games on Retropie using Mupen64Plus and an XBOX 360 Controller

Mupen64Plus is regarded as the better performing N64 emulator on Retropie.  However the default configuration doesn’t work so well with the XBOX 360 controller.

One of the main problems is that with the default configuration you can only exit the emulator with a keyboard, the emulator supports exiting with a controller however you need to manually configure it.  To do that you also need to know your button mappings, i have covered how to find this in this post.

Once you have your button mappings we can start by navigating to the emulator config folder, to do this enter the following:

cd /opt/retropie/configs/n64

Then open the mupen64plus.cfg file

sudo nano mupen64plus.cfg

Scroll down the config file until you find “[Core Events]” section, then locate the setting “Joy Mapping Stop

I use the XBOX Guide button to exit the emulator, this is button 14 however you can use any button, just substitute the button number for the one you want to use.

The value you need is:

Joy Mapping Stop = “J0B14”

J0 is Joystick 0 and B is for button so in this case button 14.  Save the file and reboot, you should now be able to exit N64 games and return to the EmulationStation User Interface.

 

Using an XBOX 360 Controller on RetroPie

By default Raspbian and RetroPie come preinstalled with xpad, this is the system XBOX 360 driver and although it works it doesnt work as well as xboxdrv.  So here is a quick guide on getting xboxdrv setup with RetroPie.  This guide assumes you already have RetroPie installed on your Raspberry Pi.

First thing we need to do is disable xpad, easiest way of doing this is to add the driver to the raspi-blacklist.conf file, to do that run the following command at the terminal or SSH prompt:

sudo nano /etc/modprobe.d/raspi-blacklist.conf

This file didn’t exist for me so don’t be alarmed if a new file is created, in the file add the following text:

blacklist xpad

Now Reboot your Raspberry Pi

sudo reboot

Once the Pi has rebooted download xboxdrv by entering the following command:

sudo apt-get install xboxdrv

Once that has installed we need to configure the driver to load at start up, this page on GitHub was written by the RetroPie creator and is comprehensive enough to get you through but i will try and explain a little more of the steps to make sure it works first time with your emulators.

I used setup 3 (init script) as it apparently uses less CPU and RAM.  Create the file as described on the GitHub page by entering the following command:

sudo nano /etc/init.d/xboxdrv

Copy the code script from here and paste it into the blank script, press CTRL+X and save the file.  Make the script executable and then execute the script to ensure it starts without error by running these two commands:

sudo chmod +x /etc/init.d/xboxdrv

sudo update-rc.d xboxdrv start

Then you need to create a configuration file, here you can tell the system how many controllers to load.  Enter the following command to create the configuration file:

sudo nano /etc/default/xboxdrv

Copy and paste the configuration from the GitHub page, change the value of CONTROLLER_NUM to match how many controllers you want to load, 2 is default.  Save the file by pressing CTRL+X.

CONTROLLER_NUM=2

Ensure your controller is connected and reboot your Pi, once rebooted the controller light should be correctly lit as Player 1.  We can now test so make sure the inputs are working correctly, we do this by installing joystick and running jstest.  Run the following command to install the joystick application:

sudo apt-get install joystick

Once installed run the following command, substituting [0-3] for a single number.  Normally 0 is the first controller but if you are using a keyboard that might get detected as [0] so use [1].

jstest /dev/input/js[0-3]

You should get an output on the screen showing the button assignments, if you press a button the output will change from Off to On.  It is worth making a note of the button assignments because you will need them later when configuring emulators to use the correct buttons.  Here are the default button assignments for the XBOX 360 controller:

A – 4
B -5
X – 6
Y – 7
RB – 9
LB – 8
RT – 11
LT – 10
back – 12
start – 13
dpad-up – 0
dpad-down – 1
dpad-left – 2
dpad-right – 3
Left Thumb Down – 15
Right Thumb Down – 16
Left Thumb Axis Up/Down – Axis 1
Left Thumb Axis Left/Right – Axis 0
Right Thumb Axis Up/Down – Axis 3
Right Thumb Axis Left/Right – Axis 2
Xbox Button – 14

Now we need to configure RetroPie to use the new controller, this will be the default button configuration for emulators that use the RetroArch core.  Emulators that use other cores such as Mupen64Plus will need re-configuring separately.  Before we start we need to ensure that we have read and write permissions on Retroarch config folder, run the following command to change the permissions:

sudo chmod +rw /opt/retropie/configs/all/

Then navigate to the Retroarch emulator core folder

cd /opt/retropie/emulators/retroarch/

Run the configuration script for each controller you want to use, if you are only using 1 controller run the first line, if you are using 2 controllers run both the first and second lines and so on…

./retroarch-joyconfig -o /opt/retropie/configs/all/p1.cfg -p 1 -j 0

./retroarch-joyconfig -o /opt/retropie/configs/all/p2.cfg -p 2 -j 1

./retroarch-joyconfig -o /opt/retropie/configs/all/p3.cfg -p 3 -j 2

./retroarch-joyconfig -o /opt/retropie/configs/all/p4.cfg -p 4 -j 3

Follow the on screen prompts, you will be asked to press each button in sequence.  Doing so will create a map file for each controller, we then need to combine the map file with the Retroarch configuration file so the core knows what buttons to use on your controller.  To do this run the following command to combine the text in the files:

sudo cat /opt/retropie/configs/all/p*.cfg >> /opt/retropie/configs/all/retroarch.cfg

Perform one last reboot and run a game, the buttons should now work however they might be wrong for the emulator you are playing.  To change this you need to take the mapping from the Retroarch.cfg file in the “ALL” folder (global config) and add it to the Retroarch.cfg file of the emulator you are using i.e SNES.   This will allow you to map the original SNES buttons to the XBOX 360 controller buttons giving you the best setup possible.

I will show you have to do that in another guide, i will also show you have to setup the hotkey buttons and how to exit the games and return to the EmulationStation User Interface.

Welcome

Hi, welcome to my blog.  I have never had a blog before but i thought it was about time i started writing down some of the random tech projects i take on, hopefully someone will find the information here useful for your own projects.