Remote display

From OLPC
Revision as of 10:42, 19 April 2007 by Zdevir (talk | contribs)
Jump to: navigation, search

If you are trying to project the user interface of an XO laptop, this page is for you. It describes how to bring up the user interface of an XO laptop (the source computer) across the network on another computer running X11 or Windows (the display computer). Two methods are described below. The first method lets you run a remote Sugar session on the display computer. Using the second method, the current Sugar session is cloned to the display computer.

First method: Remote Sugar session

Preparations

There are some harmless changes to the XO which only need to be done once. You will need to assign a password to the olpc user, and create the script which is remotely executed to start Sugar.

To assign a password to the laptop user, obtain a console window (through the debugging interface accessed by alt + "=", or by bringing up a console with ctl + alt + F1/Eye). Become root and change the password by typing:

su
passwd olpc

Now go to the laptop user's home directory, and create the script which will start sugar:

cd /home/olpc
echo "#\!/bin/sh" > remotedisplay
cat .xinitrc >> remotedisplay
chmod a+x remotedisplay

Stopping Sugar on the XO

Due to current limitations of Sugar, there can only be one copy of Sugar running on any given XO. This will mean that you need to shut down Sugar and X on the XO from which you want to forward the user interface. There are several ways you can do this, but the simplest (and temporary) way is to first change to the console, by typing control + alt + F1 (Eye). Log in as root, then change the runlevel of the XO to runlevel 3 by typing:

init 3

After doing this, the XO should still be associated with any wireless network it already found, but it will have forgotten about its IP address. You need to manually request an address using:

ifup eth0

If this doesn't work because you aren't associated with a wireless network, you can manually bring up the network using:

iwconfig eth0 essid "some local wifi SSID"
ifup eth0

You can get a list of the local WiFi networks using

 iwlist s eth0

Check the network address assigned to the XO by DHCP, as you will need it for the next steps.

 ifconfig eth0

Bringing up the display remotely

At this point, you will need a version of X on the display computer which is running bare (no display or session manager). The easiest way seems to be to create a new user on the display computer, and give them an .xinitrc (or .xsession file under Debian) which consists simply of:

exec xterm

Log in as the new user, and from that single xterm, you should be able to bring up the display remotely using:

ssh olpc@xo-ip-address -C -X /home/olpc/remotedisplay

Second method: Cloning the current Sugar session

The trick is to install RealVNC, and run x0vncserver on the XO computer. The display computer runs a vncviewer that clones the XO display.

Preparations

You have to fetch and install the vnc-server on the XO computer. Login as root to a shell, and run the following:

 cd /tmp
 wget ftp://rpmfind.net/linux/fedora/core/updates/6/i386/vnc-server-4.1.2-9.fc6.i386.rpm
 rpm -i -v --nodeps vnc-server-4.1.2-9.fc6.i386.rpm

You can search for a newer package at rpmfind.net.

Now, login as an olpc user and create a password for vnc sessions.

 cd ~
 vncpasswd

Create an activation script for the x0vncserver, still as olpc user.

 File: ~/x0server
#!/bin/sh
nice -19 x0vncserver PasswordFile=~olpc/.vnc/passwd AcceptPointerEvents=0 AcceptKeyEvents=0 &
disown

The x0vncserver must run very very nicely (nice -19), since otherwise it takes all available CPU and leaves no room for other processes to run. The last two options of the x0vncserver (AcceptPointerEvents and AcceptKeyEvents) runs the server in a "view only" mode.

Don't forget to make the script executable.

 chmod a+x ~/x0server

Just before the presentation

The XO computer and the display computer should be on the same Wifi network. You will need to know the IP of the XO computer (run ifconfig eth0 if you don't know it). Now, from within Sugar, open a console (Alt-0 or Alt-=), and run the ~/x0server script you have prepared in advanced. It will write some staff to the console, and you can close the console.

In the display computer, run the vnc client/viewer.

 vncviewer 192.168.xxx.xxx FullScreen=1 ViewOnly=1

Where 192.168.xxx.xxx is the XO computer IP address.

In order to close the vnc viewer, press F8 in the displaying computer. This is the escape key which gives you a context menu with various options. You can change the full-screen mode, exit the viewer, and set other options as well.

Caveats

Modifying WiFi

Whatever you do, don't click on the WiFi signal strength when using the remote display. Even if you select the network you are already using, you will freeze the display.

Screen Resolution

The vnc server dies when the resolution is changed. You will have to restart the server and the client if the screen orientation is changed.

Using a Laptop's VGA output

While on Gen1 XO laptops (the B1/B2/B3/C1/MP builds) it will continue to be possible to attach a VGA connector to the XO motherboard, making use of it requires soldering a jumper (pins 1 and 3 of CN18) and cutting the laptop case to make room for it. In B3/C1/MP versions, additional required passive components will not be populated on the motherboard (but are easier to obtain than the required VGA connector!)

One problem with this approach (on B2, but not B3/C1/MP machines) is a weird gamma correction currently applied by software to fix a hardware wiring error.

An additional problem is that many displays are very unhappy with the 1200x900 resolution video output by default by the XO laptop.