Old notebook + Ubuntu 18.04 LTS makes old iPad a sub monitor

Older notebooks have an external output (VGA) port, but for some reason they don't become multi-monitor when connected to a monitor.

On the other hand, in Windows, there is an application called "spacedesk" that uses a smartphone or tablet as a sub monitor, and I could actually check it on my old iPad, so I wondered if I could do the same with Ubuntu.

After that, I found the following article on Qiita, so I decided to follow it.

[Ubuntu 18.04] A memorandum that makes Android (or iPad) a sub monitor https://qiita.com/hir-osechi/items/5a106f75ff1b9b8cd469

It seemed easy, so I thought it wouldn't be left on Qiita ...

material

Method

  1. Add a virtual display on your PC (Ubuntu) to expand the screen area
  2. Enable screen sharing on your PC, put VNC Viewer on one tablet (iPad) and connect to tablet → PC
  3. The PC displays the primary display as it is, and the tablet displays the virtual display side with VNC, so that the tablet is regarded as a sub monitor.

Introducing VNC

First, insert the essential "VNC".

iPad side

Install "VNC Viewer" from the App Store.

It's easy to say, but in the situation where "iOS 14" is out at the time of writing (2020/11), the app that supports "iOS 9.3.5" 5 generations ago is really There are few **, even if you try to do something, it often ends without even installing. ** **

Fortunately, miraculously, VNC Viewer was "compatible with iOS 9.0 or later", so I was able to install it, but if this was compatible with 10.0 or later, this attempt was immediately terminated.

PC side

Follow in the footsteps of our predecessors.

First, just in case, make sure that vino (GNOME's VNC server) is installed.

$ sudo apt install vino
Loading the package list...Done
Creating a dependency tree
Reading status information...Done
vino is already the latest version(3.22.0-3ubuntu1.1)is.
upgrade:0 pieces, new installation:0, deleted:0 pieces, pending:Four.
$

Next, open [Settings] → [Sharing], set the switch on the upper right to "On", and then click "Screen Sharing" in the center to open the following window.

qiita_20201106_1.png

Turn on the switch on the upper left, check "Require password", and enter the password to close it.

This completes the server side of VNC, but it seems that it will not work unless (VNC connection) is between Linux, so execute the following command to invalidate the encryption request.

$ sudo gsettings set org.gnome.Vino require-encryption false

Then connect to your PC from the VNC Viewer on your iPad. Ignore the warning that there is no encryption request and proceed, and check that the PC screen is displayed on the VNC on the iPad side (the same screen should be displayed at this point).

Add virtual display

Next, in order to expand the screen area of the PC, make additional settings for the virtual display.

First, check the status.

$ xrandr -q
Screen 0: minimum 8 x 8, current 2352 x 800, maximum 32767 x 32767
LVDS1 connected primary 1280x800+1072+0 (normal left inverted right x axis y axis) 286mm x 178mm
   1280x800      60.00*+  59.81    59.91  
   1280x720      59.86    59.74  
   1024x768      60.00  
   1024x576      59.90    59.82  
   960x540       59.63    59.82  
   800x600       60.32    56.25  
   864x486       59.92    59.57  
   640x480       59.94  
   720x405       59.51    58.99  
   640x400       60.00  
   640x360       59.84    59.32  
TV1 disconnected (normal left inverted right x axis y axis)
VGA1 disconnected (normal left inverted right x axis y axis)
$

・ ・ ・ ** There is no definition of "VIRTUAL 1"! ** orz

In the footsteps of my ancestors, it seemed easy because the story was going on with "VIRTUAL 1", but I didn't expect that there would be no such important thing even though it was the same OS, so I suddenly stumbled.

However, as a result of wandering around the Web, I came to the conclusion that I should make it if it does not exist, although I do not know why it does not exist.

$ cd /usr/share/X11/xorg.conf.d/
$ sudo nano 30-virtscreen.conf
---
Section "Device"
	Identifier "intelgpu0"
	Driver     "intel"
	Option     "VirtualHeads" "1"
EndSection
---

After saving, log off and log in, and check again.

$ xrandr -q
Screen 0: minimum 8 x 8, current 2352 x 800, maximum 32767 x 32767
LVDS1 connected primary 1280x800+1072+0 (normal left inverted right x axis y axis) 286mm x 178mm
   1280x800      60.00*+  59.81    59.91  
   1280x720      59.86    59.74  
   1024x768      60.00  
   1024x576      59.90    59.82  
   960x540       59.63    59.82  
   800x600       60.32    56.25  
   864x486       59.92    59.57  
   640x480       59.94  
   720x405       59.51    58.99  
   640x400       60.00  
   640x360       59.84    59.32  
TV1 disconnected (normal left inverted right x axis y axis)
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 connected 1072x800+0+0 (normal left inverted right x axis y axis) 0mm x 0mm

** Oh, VIRTUAL1 has been added! ** (I don't know if it's really good ...)

Next, specify the resolution and refresh rate you want to display with the cvt command, and get detailed information.

The iPad itself is "2048x1536", but it is too small to display at the same resolution, so I set the size of the virtual display side to "about 1067x800" while keeping the ratio while aligning it vertically with "1280x800" on the PC side. As expected, 1067 seemed to be an odd number, and it was corrected to 1072.

$ cvt 1067 800
# 1072x800 59.83 Hz (CVT) hsync: 49.72 kHz; pclk: 70.00 MHz
Modeline "1072x800_60.00"   70.00  1072 1136 1240 1408  800 803 813 831 -hsync +vsync

Register the obtained information with the xrandr command. After --newmode, copy and paste the part after Modeline in the result of cvt command.

$ xrandr --newmode  "1072x800_60.00"   70.00  1072 1136 1240 1408  800 803 813 831 -hsync +vsync
$ xrandr -q
Screen 0: minimum 8 x 8, current 1280 x 800, maximum 32767 x 32767
LVDS1 connected primary 1280x800+0+0 (normal left inverted right x axis y axis) 286mm x 178mm
   1280x800      60.00*+  59.81    59.91  
   1280x720      59.86    59.74  
   1024x768      60.00  
   1024x576      59.90    59.82  
   960x540       59.63    59.82  
   800x600       60.32    56.25  
   864x486       59.92    59.57  
   640x480       59.94  
   720x405       59.51    58.99  
   640x400       60.00  
   640x360       59.84    59.32  
TV1 disconnected (normal left inverted right x axis y axis)
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
  1072x800_60.00 (0x13a) 70.000MHz -HSync +VSync
        h: width  1072 start 1136 end 1240 total 1408 skew    0 clock  49.72KHz
        v: height  800 start  803 end  813 total  831           clock  59.83Hz
$

Then, the registered resolution information is linked to VIRTUAL1.

$ xrandr -q
Screen 0: minimum 8 x 8, current 2352 x 800, maximum 32767 x 32767
LVDS1 connected primary 1280x800+1072+0 (normal left inverted right x axis y axis) 286mm x 178mm
   1280x800      60.00*+  59.81    59.91  
   1280x720      59.86    59.74  
   1024x768      60.00  
   1024x576      59.90    59.82  
   960x540       59.63    59.82  
   800x600       60.32    56.25  
   864x486       59.92    59.57  
   640x480       59.94  
   720x405       59.51    58.99  
   640x400       60.00  
   640x360       59.84    59.32  
TV1 disconnected (normal left inverted right x axis y axis)
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 connected 1072x800+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1072x800_60.00  59.83* 
VIRTUAL2 disconnected (normal left inverted right x axis y axis)

There is an asterisk after the refresh rate value, and it seems that it was set without any problem.

What is that? ** Suddenly "VIRTUAL 2" has increased? ?? ** ** : : Hmm ... I don't know, but I want to hurry, so the command in the CLI is over.

Finally, open [Settings] → [Devices] → [Displays] and check that there are two displays.

qiita_20201106_3.png

The secondary is "Unknown Display", but this is the area of the added virtual display, which is the area to be displayed on the iPad side using VNC.

Operation check

Connect to the PC again with VNC Viewer on the iPad.

When connected, the same screen (primary) as the PC is displayed at first, but you can switch to the virtual display side by sliding the screen on the iPad side sideways. Now you can use your iPad as a sub monitor.

qiita_20201106_4.png

Configuration automation

Since the xrandr settings will be lost when restarting, I initially thought about making them permanent, but it is inconvenient to have a virtual display immediately after logging in.

So, I made a simple script to execute xrandr --newmode and --addmode in succession, and when I thought "I want to widen the screen!", I made it possible to execute this script from the launcher.

First, the script.

$ cd $HOME
$ nano virtual_display_set.sh
---
#!/bin/bash

MSG=`xrandr -q | grep "VIRTUAL1 disconnected"`
if [ "$MSG" != "" ]; then
#    echo "disconnected!"
    xrandr --newmode  "1072x800_60.00"   70.00  1072 1136 1240 1408  800 803 813 831 -hsync +vsync
    xrandr --addmode VIRTUAL1 1072x800_60.00
else
#    echo "connected!"
    xrandr --delmode VIRTUAL1 1072x800_60.00
    sleep 5
    xrandr --rmmode "1072x800_60.00"
fi

exit 0
---

In order not to execute multiple times, if VIRTUAL1 is disconnected, newmode and addmode are executed, otherwise delmode and rmmode are deleted. For the time being, it worked, but when I ran it many times to check the operation, the screen collapsed and I ended up forcibly terminating the PC without returning it, so I was a little worried about deleting it.

Therefore, register a shortcut to kick this script in the launcher with the name "VDispSet".

$ sudo nano ~/.local/share/applications/VDispSet.desktop
---
[Desktop Entry]
Version=1.0
Type=Application
Name=VDispSet
Exec="/home/xxx/virtual_display_set.sh"
Icon=VDispSet.png
Path=/home/xxx
Terminal=false
StartupNotify=false
---

Icon files are stored under ~ / .local / share / icons. I haven't put it now because there wasn't a good one, but in that case, the default icon is used, so there is no problem on the display.

Log off and log in once to check the operation.

--Immediately after logging in, select [Settings] → [Devices] → [Displays] and there is only one display. --Execute "VDispSet" of the launcher --A virtual display has been added to [Settings]-> [Devices]-> [Displays] to create two. --Connect with VNC from iPad

Yeah, it was refreshing!

Miscellaneous feelings

――I can't deny the feeling of being light because I'm using VNC and the iPad itself is powerless (Win-iPad using Spacedesk was just as light). Therefore, it is difficult to work on the sub side, so it is like displaying a browser on the sub and working on the main while watching this.

――Since there is also an Android tablet, Android is better if you want to eliminate the feeling of lightness, but the iPad has a wider screen, and above all ** (self) satisfaction that the iPad is revived with the notebook PC * * Is very different.

――I thought that VIRTUAL1 would be added if I did something, so I tried putting virtscreen in order to get VIRTUAL1 out, or I wondered if I could move spacedesk with wine, and it took a lot of time. I have.

Recommended Posts

Old notebook + Ubuntu 18.04 LTS makes old iPad a sub monitor
Ubuntu 18.04 LTS makes old iPad a sub monitor without WiFi
Use virtual AP on Ubuntu 18.04 LTS to sub-monitor old iPad
Building a Deep Learning environment (Ubuntu 20.04 LTS)
Make it possible to handle the camera with old notebook + Ubuntu 18.04 LTS (droidcam)
Rip a CD to MP3 with Ubuntu 18.04 LTS