Share Mouse and Keyboard Across Computers with Barrier
Six years ago I use synergy (ver1.5.1) for sharing keyboard and mouse with other computers, which is great, then it became a commercial software, after upgrading my ubuntu desktop, I cannot find an app similar to synergy, until I find Barrier.
Barrier was forked from synergy 1.9 codebase, and is as powerful as synergy, with barrier, I can share touchpad and keyboard of MacBook to ubuntu.
In this setup, barrier installed on MacBook serves as server, and ubuntu as client, which is keyless.
For MacOS, the easiest way is to download the latest release.
For Ubuntu 18.04, barrier needs to build from source:
sudo apt install -y libxtst-dev libavahi-compat-libdnssd-dev
git clone --depth 1 https://github.com/debauchee/barrier.git
cd barrier
git submodule update --init --recursive
./clean_build.sh
cd build
sudo make install
Server Configuration
Launch barrier and click Configure Server...
, drag the computer icon at the top
right corner to the grid and double click it and enter ubuntu
in the Screen name
textbox in the Screen Settings
window, click OK to exit configuration.
NOTE: Reload is required after adding a client, otherwise you will end up with unrecognised client name "xxx", check server config.
Ubuntu Client
-
Launch barrier, click
Next
to proceed, select Client (use another computer’s mouse and keyboard) and click Finish in the next window. -
Go to menu
Barrier
➜Change Settings
to set screen name to ubuntu, this has to be the same as specified in barrier server, clickOK
. -
Last step, click
Reload
button, and you should see this notification window:
Now it’s all set, try to move the mouse cursor to the right most side, you should see it in ubuntu.
All these settings are saved in ~/.config/Debauchee/Barrier.conf
Android Client
There is no official barrier client for Android, fortunately, synergy has one, one thing need to mention here is, mwilck find the protocol is deliberately different, they use different Hello string, I have changed this to Barrier, fixed some other minor issues and finally make it working on my Android TV (Marshmallow), I have committed all the changes I’ve made to github.
NOTE:
- No SSL support, so the server side need to disable SSL encryption.
- My Android TV have
su_
instead ofsu
in system. - Need to change permission of
/dev/uinput
manually or add to init.rc.
Troubleshooting
New client not recognized by server
Q: When I add a new client, server side report unrecognised client name “xxx”, check server config.
Setting server log level to Debug1
, I get the following message:
[2020-10-27T15:07:19] DEBUG: Opening new socket: 45452020
[2020-10-27T15:07:19] NOTE: accepted client connection
[2020-10-27T15:07:19] DEBUG1: saying hello
[2020-10-27T15:07:19] DEBUG1: parsing hello reply
[2020-10-27T15:07:19] DEBUG1: querying client "phicomm" info
[2020-10-27T15:07:19] DEBUG1: created proxy for client "phicomm" version 1.3
[2020-10-27T15:07:19] DEBUG: received client "phicomm" info shape=0,0 1920x1080 at 0,0
[2020-10-27T15:07:19] DEBUG1: send info ack to "phicomm"
[2020-10-27T15:07:19] WARNING: unrecognised client name "phicomm", check server config
[2020-10-27T15:07:19] NOTE: disconnecting client "phicomm"
[2020-10-27T15:07:19] DEBUG1: send close "EUNK" to "phicomm"
And by setting log level to Log.Level.DEBUG
in Synergy.java
, client report a
invalid message from server:
10-27 15:07:19.113 510 17663 I Synergy : Event:STREAM_INPUT_READY:org.synergy.net.TCPSocket@bcfabb6:org.synergy.base.Log:153
10-27 15:07:19.113 510 17663 D Synergy : running job:org.synergy.base.Log:157
10-27 15:07:19.113 510 17663 D Synergy : handling hello:org.synergy.base.Log:157
10-27 15:07:19.116 510 17663 D Synergy : Old EventIDs Size: 2:org.synergy.base.Log:157
10-27 15:07:19.116 510 17663 D Synergy : Saving event data: 1:org.synergy.base.Log:157
10-27 15:07:19.116 510 17663 I Synergy : Event grabbed:org.synergy.base.Log:153
10-27 15:07:19.117 510 17663 I Synergy : Event:STREAM_INPUT_READY:org.synergy.net.TCPSocket@bcfabb6:org.synergy.base.Log:153
10-27 15:07:19.117 510 17663 D Synergy : running job:org.synergy.base.Log:157
10-27 15:07:19.117 510 17663 D Synergy : handle data called:org.synergy.base.Log:157
10-27 15:07:19.124 510 17663 D Synergy : recv info acknowledgment:org.synergy.base.Log:157
10-27 15:07:19.125 510 17663 E Synergy : invalid message from server:org.synergy.base.Log:145
A: The reason for this is, the change on server side such as disable/enable SSL, adding a client, changing client/server name only take effect after Reload, after do a reload, server log showing client has connected:
[2020-10-27T15:09:50] DEBUG: Opening new socket: C8F2F8A0
[2020-10-27T15:09:50] DEBUG1: registered event type accepted as 40
[2020-10-27T15:09:50] NOTE: accepted client connection
[2020-10-27T15:09:50] DEBUG1: registered event type inputReady as 41
[2020-10-27T15:09:50] DEBUG1: registered event type outputError as 42
[2020-10-27T15:09:50] DEBUG1: registered event type inputShutdown as 43
[2020-10-27T15:09:50] DEBUG1: registered event type outputShutdown as 44
[2020-10-27T15:09:50] DEBUG1: saying hello
[2020-10-27T15:09:50] DEBUG1: registered event type success as 45
[2020-10-27T15:09:50] DEBUG1: registered event type failure as 46
[2020-10-27T15:09:50] DEBUG1: registered event type outputFlushed as 47
[2020-10-27T15:09:50] DEBUG1: parsing hello reply
[2020-10-27T15:09:50] DEBUG1: querying client "phicomm" info
[2020-10-27T15:09:50] DEBUG1: created proxy for client "phicomm" version 1.3
[2020-10-27T15:09:50] DEBUG1: registered event type ready as 48
[2020-10-27T15:09:50] DEBUG1: registered event type disconnected as 49
[2020-10-27T15:09:50] DEBUG: received client "phicomm" info shape=0,0 1920x1080 at 0,0
[2020-10-27T15:09:50] DEBUG1: send info ack to "phicomm"
[2020-10-27T15:09:50] NOTE: client "phicomm" has connected
[2020-10-27T15:09:50] DEBUG1: send reset options to "phicomm"
[2020-10-27T15:09:50] DEBUG1: send set options to "phicomm" size=26
[2020-10-27T15:09:53] DEBUG1: try to leave "barrier" on right
[2020-10-27T15:09:53] DEBUG1: mask=0000 outMask=0000
[2020-10-27T15:09:53] INFO: switch from "barrier" to "phicomm" at 0,588
[2020-10-27T15:09:53] INFO: leaving screen
[2020-10-27T15:09:53] DEBUG: hiding cursor