Adding USB SVGA

From OLPC
Revision as of 00:00, 11 July 2010 by 60.234.149.159 (talk) (Adding a DisplayLink USB-VGA adapter on XO-1.5: typo)
Jump to: navigation, search

See Remote display for other ways to connect a second display to an XO.

Adding an SIS USB-SVGA adapter

It is possible to make use of the USB connectors on the XO to plug in an USB-VGA adapter. Note that Linux supports some of these chips with the sisusbvga driver for the kernel side and sisusb module for the Xorg side. The hardware we used is branded as blue box and detected as :

Bus 004 Device 005: ID 0711:0900 Magic Control Technology Corp. SVGA Adapter

This driver supports cards based on the Net2280/SiS315 chipset, according to the author's page here. Some devices reported to work according to the NSLU2 wiki

Important notice : unless you compiled the sisusbvga module for your kernel, the module can possibly not be fully powered on, do not think the XO is not powerful enough to handle it, just insert the module to make sure it gets powered on.

Compiling the kernel module

You will need to follow the instructions about rebuilding your kernel at Rebuilding OLPC kernel.

Modify the olpc_defconfig to include the SiS USB-SVGA driver :

diff --git a/arch/i386/configs/olpc_defconfig b/arch/i386/configs/olpc_defconfig
index 8439431..74abf3b 100644
--- a/arch/i386/configs/olpc_defconfig
+++ b/arch/i386/configs/olpc_defconfig
@@ -215,7 +215,6 @@ CONFIG_NR_QUICK=1
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_MTRR is not set
 # CONFIG_SECCOMP is not set
-# CONFIG_VGA_NOPROBE is not set
 CONFIG_HZ_100=y
 # CONFIG_HZ_250 is not set
 # CONFIG_HZ_300 is not set
@@ -1711,7 +1710,8 @@ CONFIG_USB_SERIAL_PL2303=m
 # CONFIG_USB_IDMOUSE is not set
 # CONFIG_USB_FTDI_ELAN is not set
 # CONFIG_USB_APPLEDISPLAY is not set
-# CONFIG_USB_SISUSBVGA is not set
+CONFIG_USB_SISUSBVGA=m
+CONFIG_USB_SISUSBVGA_CON=y
 # CONFIG_USB_LD is not set
 # CONFIG_USB_TRANCEVIBRATOR is not set
 # CONFIG_USB_IOWARRIOR is not set

Note that we actually chose to have support for the console on the driver, which is not mandatory but can be convenient when testing.

Now recompile your kernel using this olpc_defconfig. The newly generated kernel RPM package will include this driver.

Including the driver in the OLPC development image

Now that you compiled the kernel it would be good to have it included into a testing image. Assuming that you use pilgrim, apply the following patch to get the xorg module installed as well as the kernel module not being removed by the installer script :

diff --git a/streams.d/olpc-development.stream b/streams.d/olpc-development.stream
index 58fdd0b..5a8c608 100755
--- a/streams.d/olpc-development.stream
+++ b/streams.d/olpc-development.stream
@@ -70,6 +70,7 @@ xorg-x11-drv-evdev
 xorg-x11-drv-keyboard
 xorg-x11-drv-mouse
 xorg-x11-drv-cirrus
+xorg-x11-drv-sisusb
 xorg-x11-utils
 xorg-x11-xinit
 xorg-x11-xauth
@@ -535,7 +536,7 @@ EOF
     mkdir -p $INSTALL_ROOT/etc/sysconfig/modules
     cat <<EOF > $INSTALL_ROOT/etc/sysconfig/modules/olpc-1.modules
 #!/bin/sh
-module_list="i8042 i2c-dev sdhci dcon_bl gxfb_dcon psmouse ovcamchip cafe_ccic cafe-nand battery-class olpc-battery mousedev evdev atkbd leds-olpc"
+module_list="i8042 i2c-dev sdhci dcon_bl gxfb_dcon psmouse ovcamchip cafe_ccic cafe-nand battery-class olpc-battery mousedev evdev atkbd leds-olpc sisusb"
 for i in \$module_list ; do
         modprobe \$i >/dev/null 2>&1
 done
@@ -1315,6 +1316,10 @@ EOF
        lib/modules/*/kernel/net/ieee80211/ieee80211*.ko \
        lib/firmware/*.bin | \
        cpio -O boot/olpcrd -o -A -c
+   # add the sisusb driver
+   echo " - Adding sisusb SVGA adapter driver"
+   ls  lib/modules/*/kernel/drivers/usb/misc/sisusbvga/sisusbvga.ko | \
+       cpio -O boot/olpcrd -o -A -c
     case $VARIANT in
        ext3|devel_ext3)
            # the piix ide drivers are only needed for emulation


Compiling the xorg module

The package xorg-x11-drv-sisusb is outdated and therefore will cause ABI mismatch between this particular module and the Xorg server. As I could not recompile this module, I used an Ubuntu package to get the sisusb_drv.so file.

mkdir -p extract/
wget http://fr.archive.ubuntu.com/ubuntu/pool/main/x/xserver-xorg-video-sisusb/xserver-xorg-video-sisusb_0.8.1-9_i386.deb
dpkg -x xserver-xorg-video-sisusb_0.8.1-9_i386.deb extract/
scp extract/usr/lib/xorg/modules/drivers/sisusb_drv.so olpc@laptop:/usr/lib/xorg/modules/drivers/

Now that the module is copied to the laptop, we can start with the Xorg configuration file.

Configuring the Xorg

Add a monitor section for your projector :

Section "Monitor"
        Identifier      "Monitor1"
        ModelName       "Monitor Model"
        Option          "DPMS"
EndSection

and a device section for the SiS USB-SVGA device :

Section "Device"
        Identifier      "Card1"
        Driver          "sisusb"
EndSection

Kill your existing Xorg server and restart it with olpc-dm.

Binaries

If you wish to get started quickly, here is a binary:

http://anthill.hailmail.net/sisusb/sisusbvga.ko

This was compiled for Build 802, kernel 2.6.25-20080925.1.olpc.f10b654367d7065

You can install this module with

# mkdir -p /lib/modules/`uname -r`/kernel/drivers/usb/misc/sisusbvga/
# cp sisusbvga.ko /lib/modules/`uname -r`/kernel/drivers/usb/misc/sisusbvga/
# depmod

Then you will have to find a matching set of sisusb drivers for X Windows. The drivers distributed in Ubuntu 8.10 are known to work.

Adding a DisplayLink USB-VGA adapter on XO-1.5

I was somewhat successful making this adapter work on my XO-1.5 running Fedora 11 (os205)

  1. Install kernel development libraries and get the udlfb kernel driver
    yum install kernel-devel kernel-headers gcc glibc glibc-devel glibc-headers
    git clone http://git.plugable.com/webdav/udlfb/
  2. make & make install it
  3. Your external display should go green when you install the kernel module
    modprobe udlfb
  4. Get xorg development libraries and the xorg driver
    sudo yum install xorg-x11-server-devel.i586
    git clone http://git.plugable.com/webdav/xf-video-udlfb/
  5. make and make install it
  6. copy the (incorrectly installed) driver to the right place
    sudo cp -a /usr/local/lib/xorg/modules/drivers/* /usr/lib/xorg/modules/drivers/
  7. Set up xorg.conf (this is the difficult bit).

I was able to make this work with either the external display or the built in panel, but not both at the same time. If the panel comes first in ServerLayout, then the external display is not used at all. If the external display comes first then both displays "work", but the built in panel has severe graphics corruption. I created two ServerLayout sections and hacked olpc-dm to select the external display if it was plugged in on boot.

Pictures

Here are some pictures of the OLPC working with the USB-SVGA adapter.


Other Resources

This thread has instructions that may be useful if you are running an alternate Linux distribution on your XO.