Wednesday, 16 December 2015

[Tutorial][Pics]Run Synergy on your RPI2 to share your Keyboard and Mouse



Alright so I thought I would do a nice little right up regarding setting up Synergy with raspberrypi. This is with the latest version V1.7.5 at the moment.

Synergy is basically a KVM switch (crudely) which allows you to share your keyboard and mouse from a 'server' pc (usually your main desktop) with the 'client' pc (in this case your raspberrypi). This program will work on multiple operating systems. I paid US for it for the basic version which is all you really need. I believe if your fluent with source you can download it straight from their git and build it all (which I probably should have done anyway)

To learn more, see here
http://synergy-project.org/


anyway,

So I downloaded the .deb file for my ubuntu machine which was extremely easy and it install via ubuntu software centre. Piece of cake. The harder part was to compile the source for the raspberrrypi.

I am not running the raspbian release. I chose to run the latest Ubuntu Mate 15.10 release on the pi. But any ubuntu distro you have installed on your pi will take these steps as well as a slight modification for raspbian as well.

Initially I set about googling to see how I could compile it.
I stumbled on some steps for an old version here - https://learn.adafruit.com/synergy-o...y-for-raspbian

we will be using some of these steps, but not all of it as some parts have not been updated.

Firstly;
From here we should make sure we have all the required packages installed to build the source


Code:


sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install cmake gcc libssl-dev libx11-dev libxtst-dev curl


Now,
Download the latest source from synergy.
You will get a tar.gz like – synergy-v1.7.5-stable-fa85a24-Source.tar.gz

this is in your Downloads folder

from there we need to extract it


Code:


cd ~/Downloads
sudo tar -xzf synergy-v1.7.5-stable-fa85a24-Source.tar.gz


you will get a folder within ~/Downloads like this

synergy-v1.7.5-stable-fa85a24-Source

we now need to get into this source folder

Code:


cd synergy-v1.7.5-stable-fa85a24-Source

this should mean your full directory your in is - ~/Downloads/synergy-v1.7.5-stable-fa85a24-Source/

Now that is done, we need to do a couple of things to ensure that it will compile correctly
Jump back out of terminal (leave the window open)

and go into the file explorer

navigate to ~/Downloads/synergy-v1.7.5-stable-fa85a24-Source

in here you will see some further folders and files.
Go into

/ext

within here you will see some zips and tar.gz

gmock-1.6.0.zip
gtest-1.6.0.zip
openssl-1.0.2.tar.gz

extract all of them so they are now within the directory (these are needed in the build process)



Now,
Go back to your terminal window
We need to run a small command to ensure that the build will be optimized for the raspberrypi arm architecture.


Code:


sudo nano CmakeLists.txt

within here you will see at about line 80

Code:


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-unused-local-typedef")

what you want to do is add the -march=armv7-a flag, which will compile better with the raspberrypi2

so it will now look like


Code:


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-unused-local-typedef -march=armv7-a”)



you can now save and close that file

back at your terminal window

run the command


Code:


sudo make .

This will take a while (about 20 minutes for me).

Once that is completed you need to transfer the /bin directory within the source to your machines /bin directory so run this command


Code:


sudo cp -a ./bin/. /usr/bin

Now that is done I recommend rebooting your pi

Once it is rebooted we need to setup a way for it start.
So go to the server computer (the pc you have your mouse and keyboard attached) and make sure that the program is open. You will also have to note your IP address, your local LAN one. It does not matter if this is via ehternet or wifi you will have a local IP. I would suggest using a static IP for your local LAN ip. Go into your router and set your server PC to a static ip. You dont have to, but if you dont, everytime you turn on your server pc you may get a different IP address. This in turn means that everytime you want to use this software with your PI you have to find your IP address and run the following command again.

Once you have your server PC IP. Run this command from your pi in terminal


Code:


synergyc -n pi 192.168.1.1

Substitute the name of your login for your PI into 'pi' and sub in your local IP address into the IP address above.

Now go back to your Server PC and within the synergy progam and click on 'configure server'



now on the top right hand side your will see a PC screen, this is going to be the pc that your wishing to control with your server PC mouse and keyboard.

Drag this screen to your desired location beside the middle screen, which is your 'server' pc.



Now right click the newly moved screen and give it the same name that you selected for the command above.

Now you can go back out of this area by clicking ok and click start

Notes – if your using wifi connection from your PI you may get some stuttering at times. I am going to try and use a ethernet cable connection myself. I find though I get better throughput than the bluetooth combo keyboard and mouse that I was using with my RPI.

Download from this link

No comments:

Post a Comment