================================
If you're using a computer for day-to-day work you probably want to use the biggest screen you can get your hands on. People who have used two screens have problems adjusting back to one. The Odroid community keeps asking from time to time when will a two-screen odroid be released. (this was written before the H2)
Older members will remember that the XU3 had a HDMI and a Display Port that could be used simultaneously, but the XU3 was expensive and the Display Port could not be used with any adaptors, which limited its use.
For about a year I've been thinking of a way to turn a second (cheaper) Odroid into a secondary display, but in a way where I can drag windows from one side to the other, not just move the mouse across with Synergy. I had planned on using xdmx (https://www.x.org/releases/X11R7.6/doc/ ... mx.1.xhtml) which is a distributed window manager that can move windows across different X servers (with impressive results), but I abandoned the idea when it kept crashing (to be fair, the project was not maintained for at least 10 years).
So, another crazy idea sprung into my mind - using xpra (https://xpra.org/) in a way it wasn't designed to be used…
Xpra standard usage
Xpra is a tool designed to allow you to start an X11 application decoupled from your current graphical server. It resembles "screen" or "tmux" in the way that you can start an application on a virtual X11 server and it will keep running even if you disconnect from it. Xpra has clients for Linux, Mac, HTML and even Windows, allowing easy sharing of running desktop apps.
The way you normally use it is to start a Xpra virtual display server-side and attach whatever applications you want in it:
Code: Select all
$ sudo apt-get install xpra
$ xpra start :100
$ xpra list
$ DISPLAY=:100 xeyes &
$ DISPLAY=:100 xterm &
Code: Select all
$ xpra attach ssh/user@server/100
xpra_launcher
.You can get basic usage information from here: https://xpra.org/trac/wiki/Usage
When your client disconnects, the applications keep running and you can re-attach to them from somewhere else.
Normally Xpra uses h264 compression of the video data and tries to adapt itself to network conditions. It can also forward clipboard and audio.
As a standalone product it can help you share running applications between different systems.
If xpra refuses to start and complains that
Failed to create bus connection: No such file or directory
, you can start it with:Code: Select all
$ xpra start :100 --systemd-run=no --start-via-proxy=no
/etc/xpra/conf.d/55_server_x11.conf
and setting this absolute path to Xorg:Code: Select all
$ sudo vi /etc/xpra/conf.d/55_server_x11.conf
…
# Selecting virtual X server:
xvfb = /usr/lib/xorg/Xorg -noreset -novtswitch -nolisten tcp +extension GLX +extension RANDR +extension RENDER -auth $XAUTHORITY -logfile ${XPRA_LOG_DIR}/Xorg.${DISPLAY}.log -configdir ${HOME}/.xpra/xorg.conf.d -config /etc/xpra/xorg.conf
Code: Select all
$ sudo apt-get install xserver-xorg-video-dummy libpangox-1.0-0 python-opengl libpango1.0-0 freeglut3 xserver-xorg-input-void python-gtkglext1 libgtkglext1 ssh-askpass libglu1-mesa python-gi-cairo python-lz4 python-lzo python-rencode python-pillow cython pkg-config libx11-dev libxrandr-dev libxtst-dev libxkbfile-dev libxcomposite-dev libxdamage-dev python-all-dev python-gobject-2-dev python-gtk2-dev xvfb
$ sudo apt-get remove xpra
$ wget https://xpra.org/src/xpra-2.4.tar.xz
$ unxz xpra-2.4.tar.xz
$ tar xvf xpra-2.4.tar
$ cd xpra-2.4
$ sudo python2 ./setup.py install
The idea
The plan is to make use of xpra's features and create a shared virtual desktop session that spans the width of two (or potentially more) monitors. We will use the xpra client to attach to this session from both Odroids. This will give us a duplicated left half view of a desktop - hardly of any use. But if we use xdotool to programmatically move the desktop window to the left on the right monitor (confusing, I know) you'll end up with the illusion of a dual-monitor setup.
Of course, it will need synergy for mouse/keyboard integration, and performance will suffer a bit (that turned out to be an understatement).
Preliminary setup
In order to get started you'll need two Odroids - one more powerful that runs the desktop apps (XU4 or better is recommended), and one that acts as a "dumb" network display (C0/C1). Regarding networking - both devices should be connected to the same gigabit switch (100Mbps may affect performance) and should have fixed IP addresses (either static or through DHCP) and hostnames. In my example I will use identical monitors, but the scripts can be adjusted to work with monitors of different resolutions.
In my setup I'm going to use:
Odroid XU4 running Ubuntu 18.04 (desktop image) named "xu4-left", with IP 192.168.228.203, connected to a monitor with 1680x1050 resolution. This Odroid has a USB sound card and also a keyboard/mouse attached.
Odroid C1 running Ubuntu 18.04 (desktop image) named "c1-right" with IP 192.168.228.19 connected to a monitor with 1680x1050 resolution.
Your first step should be to make sure both devices can run their desktop optimally on their own at the monitor's resolution. For example you can install @memeka's bionic repository (viewtopic.php?f=95&t=31565) for XU4 and update ffmpeg and mpv (though it's not mandatory).
Take your time to set the correct IPs and hostnames (adjust as needed):
Code: Select all
xu4-left$ sudo cat /etc/hostname
xu4-left
xu4-left$ sudo vi /etc/hosts
127.0.0.1 localhost xu4-left
192.168.228.19 c1-right
c1-right$ sudo cat /etc/hostname
c1-right
c1-right$ sudo vi /etc/hosts
127.0.0.1 localhost c1-right
192.168.228.203 xu4-left
Installing synergy is thankfully an easy thing in Ubuntu 18.04. Simply run:
Code: Select all
xu4-left$ sudo apt-get install synergy
c1-right$ sudo apt-get install synergy
Code: Select all
xu4-left$ synergy
c1-right$ synergy
On the server (xu4-left) select "Server" mode, select "Configure Server…" and:
Drag and drop a new screen (to the right of xu4-left) and name it c1-right
Apply and Start
File -> Save configuration as ~odroid/.synergy.conf
A sample config file can be downloaded from here: //todo
On the client (c1-right) select "Client" mode, unset "Auto config" and type in the server IP: 192.168.228.203 (xu4-left). Apply and start
You should now be able to move the cursor from one system to the other through synergy.
You should now experiment by starting synergy client/server from the command line on both systems to validate that it works (after restarting the desktop session):
Code: Select all
xu4-left$ synergys -c /home/odroid/.synergy.conf
c1-right$ synergyc xu4-left
Abusing Xpra to get a second screen
Once synergy and X11 works as desired, is time to set up the dual screens. We will first set both boards to start in text mode:
Code: Select all
xu4-left$ sudo systemctl set-default multi-user.target
c1-right$ sudo systemctl set-default multi-user.target
Code: Select all
c1-right$ sudo apt-get install xdotool
c1-right$ git clone https://github.com/mad-ady/xpra-multiscreen.git
c1-right$ cd xpra-multiscreen/right
c1-right$ sudo cp -av * /
xu4-left$ git clone https://github.com/mad-ady/xpra-multiscreen.git
xu4-left$ cd xpra-multiscreen/left
xu4-left$ sudo cp -av * /
Code: Select all
xu4-left$ sudo apt-get install pwgen
xu4-left$ pwgen 15 1 | tee /home/odroid/.xpra.pass
xu4-left$ scp /home/odroid/.xpra.pass odroid@c1-right:.
Code: Select all
xu4-left$ sudo service xpra start
xu4-left$ sudo service xorg start
c1-right$ sudo service xorg start
/etc/systemd/system/xpra.service
on the xu4-left system to change things like resolution or session user. You will probably have to adjust /usr/local/bin/start-x-screen*.sh
on both systems to set username, IP, resolution.The X11 service starts a local X11 server on display :0 (the same way lightdm starts it) on each system. When X11 starts, it executes commands from
~/.xinitrc
(and since it starts as root, the full path is /root/.xinitrc
). The commands executed are listed below:
Code: Select all
xu4-left$ sudo cat /root/.xinitrc
exec su -c '/usr/local/bin/start-x-screen0.sh' odroid
c1-right$ sudo cat /root/.xinitrc
exec /bin/su -c /usr/local/bin/start-x-screen1.sh - odroid
The left "server" odroid starts the synergy server and then tries to attach to the xpra server in a loop (to recover automatically in case of disconnection).
The right "client" odroid starts the synergy client and instructs it to connect to the server and also attaches to the xpra server in a loop. In addition to this, once attached, it needs to move the xpra window containing the desktop to the left by the same amount as the left screen's resolution (so that what is already displayed by the left monitor is not displayed on the right one too). This is done so that the two views are overlapping and the left screen shows only the left side and the right screen shows the right side. You can see that the script is cheating and if there is no offset defined it reads the x-axis resolution on the right screen and assumes it's the same for the left screen (handy if you have identical monitors).
You can now enable the services and reboot and you should be greeted by a dual-screen setup!
//todo: Fake xinerama
Security considerations
The setup described above is recommended to be used in a home LAN, single user environment. It doesn't use encryption over the network in order to max out performance. It also doesn't have a user login prompt because it bypasses lightdm, but you can still add a bit of security by starting the screensaver on session start-up.
//leftover information which may no longer be relevant
** start xpra with a wide screen
[BOTH]$ sudo apt-get install xpra xdotool
apt-get install python-numpy
Menu -> Control Center -> Startup Applications -> Add ->
Name: Resize desktop
Command: /usr/bin/xrandr -s 3360x1050
Marco fix:
root@c1-dev:~# ln -s /usr/bin/marco /usr/bin/\'marco\'
root@c1-dev:~# ls -l /usr/bin/\'marco\'
lrwxrwxrwx 1 root root 14 Jul 30 12:49 /usr/bin/'marco' -> /usr/bin/marco
================================
So - did it work? Yes, but it was somewhat unstable - sometimes xpra would take a while to respond and one or both monitors would disconnect and reconnect again after a while. Performance was painfully low - I'd get about 1-2 fps on both monitors. There was a noticeable lag in window actions too (don't remember if mouse was laggy or not). This is likely because of xpra, because it uses x264 to do video encoding, and doesn't use acceleration. I tried sending unencoded data, but performance didn't improve. I hoped to get ~30fps on the xu4, while having the C1 have lower fps, but I couldn't manage.
At least you could drag and drop a window from one monitor to the other - if you dropped it between monitors and dragged it again from the other monitor, once the mouse moved over.
What else? I had issues with X11's resolution when starting manually instead of from lightdm. On 18.04 the screen resolution was fine, but X11 would draw only 1280x720. On 16.04 it was better.
Regarding improvements - I think moving to vnc might speed things up. Starting a regular X11 session (with lightdm) on the master, using xrandr to extend the virtual desktop size and using x11vnc to expose the right side of the desktop to the right monitor. The challenge is to keep the desktop from scrolling when moving the mouse on a screen edge...