Coding on the xo

From OLPC
Jump to navigation Jump to search

Overview

The goal of this page is to give some tips and tricks for people who need to edit code directly on the XO (as opposed to developing in sugar-jhbuild or with an emulator)

Every developer has his own workflow, I will describe some parts of my workflow which may help you.

Synergy

The first tool that comes in handy when coding or working on the XO is Synergy. Synergy is a keyboard/mouse client/server utility. It will allow you to share your mouse and keyboard from one computer (the server) to several other computers (the clients) regardless of the OS. This will work similar to using multiple monitors, moving your mouse to the edge of the screen (you can select which edge) will transfer the mouse/keyboard to the client computer. I personally use a MacBook as my main computer with one or two XOs next to it and also a Windows desktop. Using Synergy I can control the 3 computers from my MacBook. Mac/Linux users can use QuickSynergy which is simpler to configure :

To install synergy on the XO, simply type the following command in the terminal (for Redhat distributions)

yum install synergy

Note that with synergy you can copy/paste text from one computer to the other, this is really useful to copy error messages in the sugar console and paste them on IRC on your main machine.

XTEST

If you get an error about "XTEST extension", then enable XTEST in your xorg.conf.

Sample error from synergyc command version 1.3.1 running from terminal on XO-1 laptop:

DEBUG: CXWindowsScreen.cpp,840: XOpenDisplay(":0")
ERROR: CXWindowsScreen.cpp,851: XTEST extension not available
FATAL: synergyc.cpp,343: cannot open secondary screen: unable to open screen

Specifically, you should see a line in /etc/X11/xorg.conf as follows:

Option "XTEST" "Disable"

Make sure to set that to "Enable", or simply comment out the line entirely. After the next reboot you should be able to run synergyc -f --name olpc ip.ad.re.ss from a terminal on the XO-1 to reach the ip address of your synergy server. The synergy server runs a corresponding synergys and has the physical keyboard and mouse that will be controlling your laptop; in this sample command, the laptop registers itself with the server using the synergy screen name olpc.

SSHFS

Using sshfs, you can mount the XO as a filesystem on another computer via SSH. You can use this to edit code from an OS specific IDE. You can for example mount the XO on your main development computer and use Eclipse (or any other IDE) to edit files on the XO. This coupled with synergy is quite powerful. On linux you can install sshfs pretty easily. (search for sshfs in Google)

On a Mac you will need to install MacFuse first (macfuse) and sshfs (available on the same page). As an alternative to Google's SSHFS package you can also use MacFusion (note that you still need to install MacFuse first) which has a better GUI and also supports FTP which can be useful :

In order to connect via SSH to your XO you will need to add a password to the account to which you want to connect to :

passwd olpc