Remote display: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Added caveats, and info on how to get bare X under debian)
 
(83 intermediate revisions by 28 users not shown)
Line 1: Line 1:
:''This describes how to control/display your XO-computer from a non-XO PC or Mac or Linux box, or how to hook up the XO to an external VGA monitor or projector. To display another computer's output on your XO's screen, see [[Reverse remote display]]''
If you are trying to project the XO's user interface, this page describes how to do it using another computer running X11.


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). Three 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. The third method (which isn't actually using the network) requires a soldering iron.
There may be additional refinements, these are just quick notes detailing one way of doing this.


== First method: direct output, via USB or VGA ==
==Changes to the XO (the forwarding or source computer)==


=== USB display adapters require software ===
Due to current limitations of Sugar, there can only be copy of Sugar running on any given XO. This will mean that you need to shut down Sugar and X on the XO on which you want to forward your X session or display. There are several ways you can do this. There are several ways you can do this:


There are USB -> VGA adapters available that support plugging in a second display. However, this hardware requires special device driver software.
Change to the console (control + alt + F1) and change the runlevel of the XO to runlevel 3:
[[Adding USB SVGA]] has instructions for using such adapters that work with the '''sisusbvga''' driver.


There is also the [[wikipedia:DisplayLink]] USB technology, however according to [http://www.displaylink.com/downloads/publicfaq.shtml their FAQ] as of December 2007, "DisplayLink does not currently support the Linux operating system."
init 3


=== Hacking into the on-board VGA output ===
You will also need to assign a password to the olpc user on the XO. As root, run:
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!)

'''Caveats''' :
* 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.

== Second method: remote and cloned Sugar sessions ==
=== Remote Sugar session (using X11) ===
==== Preparations ====
Note: This method of access can be very slow

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, switch to [[Terminal]] and become root, or use a [[Console]], then change the password by typing:


passwd olpc
passwd olpc


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


cd /home/olpc
cd /home/olpc
cp .xinitrc remotedisplay
cp /usr/bin/olpc-session remotedisplay
chmod a+x remotedisplay
chmod a+x remotedisplay
vi remotedisplay


==== Stopping Sugar on the XO ====
You need to add the following to the beginning of the remotedisplay file:


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:
#!/bin/sh


init 3
Reboot (to downgrade the init level). At this point, the XO will reboot to the login prompt, but won't have networking running properly. You need to manually bring up the network using:

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"
iwconfig eth0 essid "some local wifi SSID"
dhclient eth0
ifup eth0


You can get a list of the local WiFi networks using iwlist. Remember the network address assigned to the XO by DHCP, you will need it for the next steps.
You can get a list of the local WiFi networks using


iwlist s eth0
==Bringing up the display remotely==


Check the network address assigned to the XO by DHCP, as you will need it for the next steps.
At this point, you will need a version of X which is running bare (no display manager). The easiest way seems to be to create a new user, and give them an .xinitrc (or .xsession file under Debian) which consists simply of:


ifconfig eth0
exec xterm


Log in as the new user, and from that single xterm, you should be able to bring up the display remotely using:
==== 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:


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


=== Cloning a current Sugar session (using VNC) ===
==Caveats==
Note: These methods do not allow mouse or keyboard input on the remote display (unless you explicitly enable it as per [[#Enabling Keyboard and Mouse|below]]).

==== The easy way: [[VNC Launcher]] activity ====

'''The easiest way to do this is using the [[VNC Launcher]] activity, which effectively is the process below wrapped into an activity.''' See the [[VNC Launcher]] activity page for download links. Or, if you really want to do it manually, read on.

Note that VNC Launcher stops accepting clients after one connection, so you may want to modify the vnclauncher.py script as follows:

replace the line
cmd = "/home/olpc/Activities/VncLauncher.activity/x11vnc"
with
cmd = "/home/olpc/Activities/VncLauncher.activity/x11vnc -many -shared"

You may want to read about other options here http://pwet.fr/man/linux/commandes/x11vnc

===== Starting VNC over SSH =====

Once VNC Launcher is installed, you can start a VNC server via SSH with the following command: (This is useful if the XO is in a remote location.)
/home/olpc/Activities/VncLauncher.activity/x11vnc -auth /var/tmp/olpc-auth/.Xserverauth -many -shared

==== Manually ====

x11vnc is known to work, does not require messing with passwords, and will allow mouse movement input, but still no mouse buttons or keyboard (but see end of section on how to enable these).
This can be achieved as follows:

rpm -i ftp://rpmfind.net/linux/dag/fedora/7/en/i386/RPMS.dries/x11vnc-0.9.3-1.fc7.rf.i386.rpm

You can search for the latest x11vnc package at [[http://rpmfind.net/linux/rpm2html/search.php?query=x11vnc&submit=Search+...&system=dag&arch=i386 rpmfind.net]] Note, if rpm gets an unexpected error in the middle, you may have too many activities running (not enough memory?). Try closing everything but the Terminal window.

After the yum and rpm steps complete successfully, simply running 'x11vnc' as user olpc (don't forget an 'su - olpc' if you're still root from before!) on the XO (e.g., via terminal or through ssh session) will open a password-less VNC session to which to connect with vncviewer.

[[http://www.uvnc.com/ UltraVNC]] works well for Windows, and it's Resize option is helpful to display the XO's 1200x900 on an e.g. 1024x768 laptop screen to project during a demo.

One problem is that the mechanism to show the "border" (the activities launcher at the bottom and Home etc. icons on top) does not show when you move the mouse pointer in vncviewer to the sides/corner... at least with x11vnc; I haven't tested yet if this better with vncserver; update this if you do.

==== Alternatively ====

Install and run x0vncserver on the XO computer. The display computer runs a vncviewer that clones the XO display. (Note that this method will not work ''yet'' when the laptops are in mesh mode—we need to do packet-forwarding on the School Server to enable the vnc connection. Until then, put the laptop in infrastructure mode by using an access point for your network access. If you want to project from a machine running Linux with a recent kernel, you can compile the Marvell driver on it and add an 8388 dongle in mesh mode to communicate with XOs in the mesh.)

===== Preparations =====

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

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

You can search for a newer package at [http://rpmfind.net/linux/rpm2html/search.php?query=vnc-server&system=fedora&arch=i386 rpmfind.net].

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

cd /home/olpc
vncpasswd

Create an activation script for the x0vncserver, still as olpc user, using vi or nano or cat:

{{Box File|~/x0server|<pre>
#!/bin/sh
nice -19 x0vncserver PasswordFile=/home/olpc/.vnc/passwd AcceptPointerEvents=0 AcceptKeyEvents=0 &
disown
</pre>
}}

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

Don't forget to make the script executable.

chmod a+x /home/olpc/x0server

===== Just before the presentation =====

The XO computer and the display computer should be on the same Wifi network (or, depending on the Wifi network there, stability may be better off connecting via Ethernet: XO - USB ethernet adaptor - ethernet cable - USB ethernet adaptor - other laptop hooked up to projector). You will need to know the IP of the XO computer (run <tt>/sbin/ifconfig eth0</tt> if you don't know it). Now, from within Sugar, open a console (Alt-0 or Alt-=), and run the <tt>/home/olpc/x0server</tt> script you have prepared in advanced.

/home/olpc/x0server

It will write to the console; then you can close the console.

main: XTest extension present - version 2.2
main: Listening on port 5900

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

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

or, on some clients,

vncviewer xxx.xxx.xxx.xxx -fullscreen -viewonly

Where <tt>xxx.xxx.xxx.xxx</tt> 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.

==== Enabling Keyboard and Mouse ====

By default, the XTEST extension is disabled for security reasons.
To enable keyboard and mouse usage through a VNC connection, you can enable the XTEST extension by modifying /etc/X11/xorg.conf, changing the line:

Option "XTEST" "Disable" # Mostly a debugging tool

either by commenting it out:

# Option "XTEST" "Disable" # Mostly a debugging tool

or explicitly enabling it:

Option "XTEST" "Enable" # Mostly a debugging tool

Be sure to omit the '-viewonly' option to vncviewer when connecting.

=== Simple emulation (no XO required) ===
Given a proper network (fast DSL/LAN) and a fast qemu server your presentation can be fast and authentic.


==== Server side ====
First start the qemu session on the host:

qemu -kernel-kqemu -vnc 0 -k en-us olpc-redhat-stream-development-devel_ext3.img

The flag -vnc 0 tells qemu to direct the VGA output to the VNC session 0.

Next connect with a proper VNC viewer on your laptop/PC which has the VGA output .

==== client: Mac OS X ====
On Mac OS X Chicken of the VNC can not properly handle the VGA output of the qemu emulation. So, instead use [http://www.versiontracker.com/dyn/moreinfo/macosx/9424 VNCviewer]
Direct VNCViewer to your host running the qemu instance and set it to fullscreen. Voila! You should have a much faster remote access possibility than with X11 forwarding.

==== client: Windows ====
Use [http://www.uvnc.com/ UltraVNC]:

[[Image:Uvncpic.png]]


Please note that sometimes with UltraVNC you have to play around with the speed settings so that the screen does not refresh all the time too fast.

==== client: Linux ====
you know your stuff anyway. Use vncviewer from apt or yum
--[[User:AaronKaplan|AaronKaplan]] 21:45, 17 June 2007 (EDT)




[[Category:Hardware]]
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.
[[Category:Software ideas]]

Latest revision as of 07:56, 22 September 2011

This describes how to control/display your XO-computer from a non-XO PC or Mac or Linux box, or how to hook up the XO to an external VGA monitor or projector. To display another computer's output on your XO's screen, see Reverse remote display

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). Three 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. The third method (which isn't actually using the network) requires a soldering iron.

First method: direct output, via USB or VGA

USB display adapters require software

There are USB -> VGA adapters available that support plugging in a second display. However, this hardware requires special device driver software. Adding USB SVGA has instructions for using such adapters that work with the sisusbvga driver.

There is also the wikipedia:DisplayLink USB technology, however according to their FAQ as of December 2007, "DisplayLink does not currently support the Linux operating system."

Hacking into the on-board 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!)

Caveats :

  • 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.

Second method: remote and cloned Sugar sessions

Remote Sugar session (using X11)

Preparations

Note: This method of access can be very slow

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, switch to Terminal and become root, or use a Console, then change the password by typing:

passwd olpc

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

cd /home/olpc
cp /usr/bin/olpc-session 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:

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

Cloning a current Sugar session (using VNC)

Note: These methods do not allow mouse or keyboard input on the remote display (unless you explicitly enable it as per below).

The easy way: VNC Launcher activity

The easiest way to do this is using the VNC Launcher activity, which effectively is the process below wrapped into an activity. See the VNC Launcher activity page for download links. Or, if you really want to do it manually, read on.

Note that VNC Launcher stops accepting clients after one connection, so you may want to modify the vnclauncher.py script as follows:

replace the line

 cmd = "/home/olpc/Activities/VncLauncher.activity/x11vnc"

with

 cmd = "/home/olpc/Activities/VncLauncher.activity/x11vnc -many -shared"

You may want to read about other options here http://pwet.fr/man/linux/commandes/x11vnc

Starting VNC over SSH

Once VNC Launcher is installed, you can start a VNC server via SSH with the following command: (This is useful if the XO is in a remote location.)

     /home/olpc/Activities/VncLauncher.activity/x11vnc -auth /var/tmp/olpc-auth/.Xserverauth -many -shared

Manually

x11vnc is known to work, does not require messing with passwords, and will allow mouse movement input, but still no mouse buttons or keyboard (but see end of section on how to enable these). This can be achieved as follows:

 rpm -i ftp://rpmfind.net/linux/dag/fedora/7/en/i386/RPMS.dries/x11vnc-0.9.3-1.fc7.rf.i386.rpm

You can search for the latest x11vnc package at [rpmfind.net] Note, if rpm gets an unexpected error in the middle, you may have too many activities running (not enough memory?). Try closing everything but the Terminal window.

After the yum and rpm steps complete successfully, simply running 'x11vnc' as user olpc (don't forget an 'su - olpc' if you're still root from before!) on the XO (e.g., via terminal or through ssh session) will open a password-less VNC session to which to connect with vncviewer.

[UltraVNC] works well for Windows, and it's Resize option is helpful to display the XO's 1200x900 on an e.g. 1024x768 laptop screen to project during a demo.

One problem is that the mechanism to show the "border" (the activities launcher at the bottom and Home etc. icons on top) does not show when you move the mouse pointer in vncviewer to the sides/corner... at least with x11vnc; I haven't tested yet if this better with vncserver; update this if you do.

Alternatively

Install and run x0vncserver on the XO computer. The display computer runs a vncviewer that clones the XO display. (Note that this method will not work yet when the laptops are in mesh mode—we need to do packet-forwarding on the School Server to enable the vnc connection. Until then, put the laptop in infrastructure mode by using an access point for your network access. If you want to project from a machine running Linux with a recent kernel, you can compile the Marvell driver on it and add an 8388 dongle in mesh mode to communicate with XOs in the mesh.)

Preparations

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

 rpm -i -v --nodeps ftp://rpmfind.net/linux/fedora/core/updates/6/i386/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 /home/olpc
 vncpasswd

Create an activation script for the x0vncserver, still as olpc user, using vi or nano or cat:

 File: ~/x0server
#!/bin/sh
nice -19 x0vncserver PasswordFile=/home/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 /home/olpc/x0server
Just before the presentation

The XO computer and the display computer should be on the same Wifi network (or, depending on the Wifi network there, stability may be better off connecting via Ethernet: XO - USB ethernet adaptor - ethernet cable - USB ethernet adaptor - other laptop hooked up to projector). You will need to know the IP of the XO computer (run /sbin/ifconfig eth0 if you don't know it). Now, from within Sugar, open a console (Alt-0 or Alt-=), and run the /home/olpc/x0server script you have prepared in advanced.

 /home/olpc/x0server

It will write to the console; then you can close the console.

 main: XTest extension present - version 2.2
 main: Listening on port 5900

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

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

or, on some clients,

 vncviewer xxx.xxx.xxx.xxx -fullscreen -viewonly

Where xxx.xxx.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.

Enabling Keyboard and Mouse

By default, the XTEST extension is disabled for security reasons. To enable keyboard and mouse usage through a VNC connection, you can enable the XTEST extension by modifying /etc/X11/xorg.conf, changing the line:

 Option "XTEST" "Disable" # Mostly a debugging tool

either by commenting it out:

 # Option "XTEST" "Disable" # Mostly a debugging tool

or explicitly enabling it:

 Option "XTEST" "Enable" # Mostly a debugging tool

Be sure to omit the '-viewonly' option to vncviewer when connecting.

Simple emulation (no XO required)

Given a proper network (fast DSL/LAN) and a fast qemu server your presentation can be fast and authentic.


Server side

First start the qemu session on the host:

  qemu -kernel-kqemu -vnc 0 -k en-us olpc-redhat-stream-development-devel_ext3.img

The flag -vnc 0 tells qemu to direct the VGA output to the VNC session 0.

Next connect with a proper VNC viewer on your laptop/PC which has the VGA output .

client: Mac OS X

On Mac OS X Chicken of the VNC can not properly handle the VGA output of the qemu emulation. So, instead use VNCviewer Direct VNCViewer to your host running the qemu instance and set it to fullscreen. Voila! You should have a much faster remote access possibility than with X11 forwarding.

client: Windows

Use UltraVNC:

Uvncpic.png


Please note that sometimes with UltraVNC you have to play around with the speed settings so that the screen does not refresh all the time too fast.

client: Linux

you know your stuff anyway. Use vncviewer from apt or yum --AaronKaplan 21:45, 17 June 2007 (EDT)