Using android tablets as external monitors in linux
EDIT 2017-09-07 : created a script here that will do this autmogaically for you. Read on for full write up of how to do this.
Sup all
just as the name implies this article is a howto on using android tablets as external monitors.
at the time of writing, here are my specs / what was used / needed:
Done on a laptop running:
Linux (Gentoo Base System 2.4.1 64bit / Linux 4.12.9)
xrandr --version
xrandr program version 1.5.0
Server reports RandR version 1.5
----
Tablet 1:
-Nexus 10
--Android 6.0.1 (LineageOS version 13.0-20170729-NIGHTLY-manta)
--Resolution 2560 x 1600
--bVNC Free
----
Tablet 2:
-Nexus 7
--Android 7.1.2 (LineageOS version 14.1-20170822-NIGHTLY-flo)
--Resolution 1920 x 1200
--bVNC Free
All this done over wifi so it is a little laggy but does get the job done.
If you are planning on only using one tablet then you can stop after Tablet 1 and just read the cleanup section to stop / cleanup.
You can substitute tablets as long as you make sure that you get your resolutions proper.
Before we begin, here is a shot of both tablets working together:
Click image to enlarge
Tablet 1
First things first, here is my running xrandr before configuring (i will be posting a copy of xrandr after every step so it will be kind of long):
% xrandr
Screen 0: minimum 8 x 8, current 2560 x 1600, maximum 32767 x 32767
eDP1 connected primary 2560x1600+0+0 (normal left inverted right x axis y axis) 290mm x 180mm
2560x1600 59.97*+
2048x1536 60.00
1920x1440 60.00
1856x1392 60.01
1792x1344 60.01
1920x1200 60.00
1600x1200 60.00
1680x1050 60.00
1400x1050 59.98
1280x1024 60.02
1400x900 60.00
1280x960 60.00
1280x800 60.00
1024x768 60.00
800x600 60.32 56.25
640x480 59.94
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
VIRTUAL2 disconnected (normal left inverted right x axis y axis)
VIRTUAL3 disconnected (normal left inverted right x axis y axis)
we will use VIRTUAL1 for tablet 1 and eDP1 is my existing monitor.
we need to use cvt which calculates VESA CVT mode lines for the resolution of tablet 1 which will go to the left of eDP1
# 2560x1600 59.99 Hz (CVT 4.10MA) hsync: 99.46 kHz; pclk: 348.50 MHz
Modeline "2560x1600_60.00" 348.50 2560 2760 3032 3504 1600 1603 1609 1658 -hsync +vsync
the part we will be using from this is :
"2560x1600_60.00" 348.50 2560 2760 3032 3504 1600 1603 1609 1658 -hsync +vsync
so lets create the new mode:
xrandr --newmode "2560x1600_60.00" 348.50 2560 2760 3032 3504 1600 1603 1609 1658 -hsync +vsync
xrandr should look similar to this now:
% xrandr
Screen 0: minimum 8 x 8, current 2560 x 1600, maximum 32767 x 32767
eDP1 connected primary 2560x1600+0+0 (normal left inverted right x axis y axis) 290mm x 180mm
2560x1600 59.97*+
2048x1536 60.00
1920x1440 60.00
1856x1392 60.01
1792x1344 60.01
1920x1200 60.00
1600x1200 60.00
1680x1050 60.00
1400x1050 59.98
1280x1024 60.02
1400x900 60.00
1280x960 60.00
1280x800 60.00
1024x768 60.00
800x600 60.32 56.25
640x480 59.94
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
VIRTUAL2 disconnected (normal left inverted right x axis y axis)
VIRTUAL3 disconnected (normal left inverted right x axis y axis)
2560x1600_60.00 (0x16e) 348.500MHz -HSync +VSync
h: width 2560 start 2760 end 3032 total 3504 skew 0 clock 99.46KHz
v: height 1600 start 1603 end 1609 total 1658 clock 59.99Hz
so now we need to add mode VIRTUAL1:
xrandr --addmode VIRTUAL1 "2560x1600_60.00"
which makes xrandr look like:
% xrandr
Screen 0: minimum 8 x 8, current 2560 x 1600, maximum 32767 x 32767
eDP1 connected primary 2560x1600+0+0 (normal left inverted right x axis y axis) 290mm x 180mm
2560x1600 59.97*+
2048x1536 60.00
1920x1440 60.00
1856x1392 60.01
1792x1344 60.01
1920x1200 60.00
1600x1200 60.00
1680x1050 60.00
1400x1050 59.98
1280x1024 60.02
1400x900 60.00
1280x960 60.00
1280x800 60.00
1024x768 60.00
800x600 60.32 56.25
640x480 59.94
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 connected (normal left inverted right x axis y axis)
2560x1600_60.00 59.99
VIRTUAL2 disconnected (normal left inverted right x axis y axis)
VIRTUAL3 disconnected (normal left inverted right x axis y axis)
now we have to set the mode:
xrandr --auto --output VIRTUAL1 --mode "2560x1600_60.00" --left-of eDP1
which makes xrandr look like:
% xrandr
Screen 0: minimum 8 x 8, current 5120 x 1600, maximum 32767 x 32767
eDP1 connected primary 2560x1600+2560+0 (normal left inverted right x axis y axis) 290mm x 180mm
2560x1600 59.97*+
2048x1536 60.00
1920x1440 60.00
1856x1392 60.01
1792x1344 60.01
1920x1200 60.00
1600x1200 60.00
1680x1050 60.00
1400x1050 59.98
1280x1024 60.02
1400x900 60.00
1280x960 60.00
1280x800 60.00
1024x768 60.00
800x600 60.32 56.25
640x480 59.94
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 connected 2560x1600+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
2560x1600_60.00 59.99*
VIRTUAL2 disconnected (normal left inverted right x axis y axis)
VIRTUAL3 disconnected (normal left inverted right x axis y axis)
at this point if it worked you will notice that your screens will get wonky for a second until the x11vnc server is started and connected to:
x11vnc -display :0 -clip 2560x1600+0+0 -rfbport 5900
now open bVNC on tablet 1
change:
Keep Screen Awake
Force Landscape Orientation
-- under Advanced Settings:
View-only mode
Connection Type : UltraVNC
Port : 5900
Now connect to your machine and you should be good to go.
If you are only doing one table you can end here and look at the cleanup section on how to clean this up.
For a second tablet, just keep reading.
Tablet 2
so first lets run cvt with the second tablets resolution so we can get the proper modelines:
% cvt 1920 1200
# 1920x1200 59.88 Hz (CVT 2.30MA) hsync: 74.56 kHz; pclk: 193.25 MHz
Modeline "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync
we will be using:
"1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync
so lets create the new mode:
xrandr --newmode "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync
xrandr should look similar to this:
% xrandr
Screen 0: minimum 8 x 8, current 5120 x 1600, maximum 32767 x 32767
eDP1 connected primary 2560x1600+2560+0 (normal left inverted right x axis y axis) 290mm x 180mm
2560x1600 59.97*+
2048x1536 60.00
1920x1440 60.00
1856x1392 60.01
1792x1344 60.01
1920x1200 60.00
1600x1200 60.00
1680x1050 60.00
1400x1050 59.98
1280x1024 60.02
1400x900 60.00
1280x960 60.00
1280x800 60.00
1024x768 60.00
800x600 60.32 56.25
640x480 59.94
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 connected 2560x1600+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
2560x1600_60.00 59.99*
VIRTUAL2 disconnected (normal left inverted right x axis y axis)
VIRTUAL3 disconnected (normal left inverted right x axis y axis)
1920x1200_60.00 (0x16f) 193.250MHz -HSync +VSync
h: width 1920 start 2056 end 2256 total 2592 skew 0 clock 74.56KHz
v: height 1200 start 1203 end 1209 total 1245 clock 59.88Hz
now lets add the new mode (we will use VIRTUAL2 for this):
xrandr --addmode VIRTUAL2 "1920x1200_60.00"
xrandr should look like this now:
% xrandr
Screen 0: minimum 8 x 8, current 5120 x 1600, maximum 32767 x 32767
eDP1 connected primary 2560x1600+2560+0 (normal left inverted right x axis y axis) 290mm x 180mm
2560x1600 59.97*+
2048x1536 60.00
1920x1440 60.00
1856x1392 60.01
1792x1344 60.01
1920x1200 60.00
1600x1200 60.00
1680x1050 60.00
1400x1050 59.98
1280x1024 60.02
1400x900 60.00
1280x960 60.00
1280x800 60.00
1024x768 60.00
800x600 60.32 56.25
640x480 59.94
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 connected 2560x1600+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
2560x1600_60.00 59.99*
VIRTUAL2 connected (normal left inverted right x axis y axis)
1920x1200_60.00 59.88
VIRTUAL3 disconnected (normal left inverted right x axis y axis)
now let set the mode:
xrandr --auto --output VIRTUAL2 --mode "1920x1200_60.00" --right-of eDP1
now xrandr should look similar to this:
% xrandr
Screen 0: minimum 8 x 8, current 7040 x 1600, maximum 32767 x 32767
eDP1 connected primary 2560x1600+2560+0 (normal left inverted right x axis y axis) 290mm x 180mm
2560x1600 59.97*+
2048x1536 60.00
1920x1440 60.00
1856x1392 60.01
1792x1344 60.01
1920x1200 60.00
1600x1200 60.00
1680x1050 60.00
1400x1050 59.98
1280x1024 60.02
1400x900 60.00
1280x960 60.00
1280x800 60.00
1024x768 60.00
800x600 60.32 56.25
640x480 59.94
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 connected 2560x1600+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
2560x1600_60.00 59.99*
VIRTUAL2 connected 1920x1200+5120+0 (normal left inverted right x axis y axis) 0mm x 0mm
1920x1200_60.00 59.88*
VIRTUAL3 disconnected (normal left inverted right x axis y axis)
now is where it gets a little tricky. before we start the second vnc server client we need to take two things into consideration:
1) the total existing resolution right now is horizontal resolution is 2560 + 2560
2) the vnc port for the second tablet has to be different from the first
so lets start the second vnc server like so:
x11vnc -display :0 -clip 1920x1200+5120+0 -rfbport 5901
on tablet 2, we set the same settings as in tablet 1 except for the port which we will use 5901 for. if you see the clip line you will notice that it is set to the resolution of the table except for the beginning offset which is set to 5120 (2560 x 2)
and voila!! should have a working multi tablet system...
now to cleanup
Cleanup
at this point your xrandr should look similar to this:
% xrandr
Screen 0: minimum 8 x 8, current 7040 x 1600, maximum 32767 x 32767
eDP1 connected primary 2560x1600+2560+0 (normal left inverted right x axis y axis) 290mm x 180mm
2560x1600 59.97*+
2048x1536 60.00
1920x1440 60.00
1856x1392 60.01
1792x1344 60.01
1920x1200 60.00
1600x1200 60.00
1680x1050 60.00
1400x1050 59.98
1280x1024 60.02
1400x900 60.00
1280x960 60.00
1280x800 60.00
1024x768 60.00
800x600 60.32 56.25
640x480 59.94
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 connected 2560x1600+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
2560x1600_60.00 59.99*
VIRTUAL2 connected 1920x1200+5120+0 (normal left inverted right x axis y axis) 0mm x 0mm
1920x1200_60.00 59.88*
VIRTUAL3 disconnected (normal left inverted right x axis y axis)
first, lets reset xrandr by setting the index back to zero:
xrandr -s 0
which will make xrandr look similar to this:
% xrandr
Screen 0: minimum 8 x 8, current 7040 x 1600, maximum 32767 x 32767
eDP1 connected primary 2560x1600+2560+0 (normal left inverted right x axis y axis) 290mm x 180mm
2560x1600 59.97*+
2048x1536 60.00
1920x1440 60.00
1856x1392 60.01
1792x1344 60.01
1920x1200 60.00
1600x1200 60.00
1680x1050 60.00
1400x1050 59.98
1280x1024 60.02
1400x900 60.00
1280x960 60.00
1280x800 60.00
1024x768 60.00
800x600 60.32 56.25
640x480 59.94
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 connected 2560x1600+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
2560x1600_60.00 59.99*
VIRTUAL2 connected 1920x1200+5120+0 (normal left inverted right x axis y axis) 0mm x 0mm
1920x1200_60.00 59.88*
VIRTUAL3 disconnected (normal left inverted right x axis y axis)
now lets kill the running x11vnc sessions:
pkill x11vnc
lets turn off VIRTUAL1 && VIRTUAL2:
xrandr --output VIRTUAL1 --off
xrandr --output VIRTUAL1 --off
which will make your xrandr look similar to this:
% xrandr
Screen 0: minimum 8 x 8, current 2560 x 1600, maximum 32767 x 32767
eDP1 connected primary 2560x1600+0+0 (normal left inverted right x axis y axis) 290mm x 180mm
2560x1600 59.97*+
2048x1536 60.00
1920x1440 60.00
1856x1392 60.01
1792x1344 60.01
1920x1200 60.00
1600x1200 60.00
1680x1050 60.00
1400x1050 59.98
1280x1024 60.02
1400x900 60.00
1280x960 60.00
1280x800 60.00
1024x768 60.00
800x600 60.32 56.25
640x480 59.94
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 connected (normal left inverted right x axis y axis)
2560x1600_60.00 59.99
VIRTUAL2 connected (normal left inverted right x axis y axis)
1920x1200_60.00 59.88
VIRTUAL3 disconnected (normal left inverted right x axis y axis)
now lets delete the modes:
xrandr --delmode VIRTUAL1 "2560x1600_60.00"
xrandr --delmode VIRTUAL2 "1920x1200_60.00"
which will make xrandr to look similar to this:
% xrandr
Screen 0: minimum 8 x 8, current 2560 x 1600, maximum 32767 x 32767
eDP1 connected primary 2560x1600+0+0 (normal left inverted right x axis y axis) 290mm x 180mm
2560x1600 59.97*+
2048x1536 60.00
1920x1440 60.00
1856x1392 60.01
1792x1344 60.01
1920x1200 60.00
1600x1200 60.00
1680x1050 60.00
1400x1050 59.98
1280x1024 60.02
1400x900 60.00
1280x960 60.00
1280x800 60.00
1024x768 60.00
800x600 60.32 56.25
640x480 59.94
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
VIRTUAL2 disconnected (normal left inverted right x axis y axis)
VIRTUAL3 disconnected (normal left inverted right x axis y axis)
2560x1600_60.00 (0x16e) 348.500MHz -HSync +VSync
h: width 2560 start 2760 end 3032 total 3504 skew 0 clock 99.46KHz
v: height 1600 start 1603 end 1609 total 1658 clock 59.99Hz
1920x1200_60.00 (0x16f) 193.250MHz -HSync +VSync
h: width 1920 start 2056 end 2256 total 2592 skew 0 clock 74.56KHz
v: height 1200 start 1203 end 1209 total 1245 clock 59.88Hz
now lets remove the two modes that we added:
xrandr --rmmode "2560x1600_60.00"
xrandr --rmmode "1920x1200_60.00"
which will clean up your xrandr:
% xrandr
Screen 0: minimum 8 x 8, current 2560 x 1600, maximum 32767 x 32767
eDP1 connected primary 2560x1600+0+0 (normal left inverted right x axis y axis) 290mm x 180mm
2560x1600 59.97*+
2048x1536 60.00
1920x1440 60.00
1856x1392 60.01
1792x1344 60.01
1920x1200 60.00
1600x1200 60.00
1680x1050 60.00
1400x1050 59.98
1280x1024 60.02
1400x900 60.00
1280x960 60.00
1280x800 60.00
1024x768 60.00
800x600 60.32 56.25
640x480 59.94
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
VIRTUAL2 disconnected (normal left inverted right x axis y axis)
VIRTUAL3 disconnected (normal left inverted right x axis y axis)
Leave a Reply