Posts tagged ‘Sewell USB External Video Card’

For the longest time I’ve been trying to get a triple head setup working (“triple head” referring to 3 monitors attached to one computer). This is a trivial feat if using Windows but for Linux users it can be a daunting task – especially if one of the monitors is powered by a DisplayLink device. Let me take a step back.

I was an avid Windows user for years but after using a Windows install for more than a couple of months you start to notice things slowing down and excessive cruft and garbage piling up until eventually you’re forced to re-format and re-install everything. Those weeks after the re-format are blissful – everything’s fast and responsive but slowly, over time, the cruft builds up again (or blue screens start occurring) and you eventually know you’ll need to re-format but dread having to do it. Not because it’s hard but because re-formatting on Windows takes ages – every program wants a system reboot and/or license key you don’t have; basically it just takes forever and is a lot of pain -> enter Linux.

I tried a couple distributions (“distros”) of Linux in my early Windows days – Mandrake & Slackware – mainly because it was “cool” at the time to do. I had no idea what I was doing and, in the case of Slackware, really had no idea what I was doing. At least Mandrake would drop you into a GUI from an install; Slackware on the other hand took you out on a boat to the middle of nowhere then dumped you in the water without a life vest. Also, back in those days doing anything on Linux [at least to me] was an epic and huge time-wasting chore. If you wanted something that wasn’t installed via the distro installer you would spend hours chasing down dependent libraries and compiling code and most likely end up failing or giving up. Plus, basic things you expected to work because they worked in Windows – like having sound & printing – were nowhere to be found on Linux (unless you had very specific hardware). And, there was no Google to help you find out why something wasn’t working! Anyway, today’s Linux is totally different; all the manual dependency chasing and compiling is gone and most things work out of the box and work quite well out of the box. Installs are fast and practically reboot free; plus you can queue up a ton of stuff to install and simply leave: hardly any user interaction is required (you aren’t clicking “next” or “ok” 20 million times). Ubuntu in particular has become wildly popular due to its ease of use and features offered (and it’s completely free).

I’ve been using Linux as my main operating system since the end of 2007 because I got tired of Windows always eventually failing and then having to waste tons of hours re-formatting and re-installing. However, my job as a programmer requires that I run Windows -> enter virtualization.

Virtualization programs like Workstation, Fusion, Parallels, VirtualBox, QEMU (and many others) let you run an entire operating system (or multiple entire operating systems) on your machine at one time. These OS’s running inside your current OS are called virtual machines. Each virtual machine (called a “guest”) is completely sandboxed from your main operating system (called the “host”) so that if a virtual machine crashes it doesn’t take down your whole system – you simply restart the virtual machine as if nothing had happened. You can also make “snapshots” of virtual machines so that if you end up messing one up you simply revert it back to an earlier point in time and again, it’s like nothing had happened. You can also let the virtual machine have access to devices on the host – typically USB peripherals – so that they now can be used inside the guest as well as the host.

Back to the modern day-ish.

I run Linux (and have been for a while) because of the stability and ease of use/maintenance. I then fire up a Windows virtual machine or two every day in VMware Workstation (or VMware Fusion on my laptop) to do my work. I had a working dual monitor setup on Linux (using NVIDIA + TwinView) and VMware Workstation could take over both monitors and give me a dual monitor Windows virtual machine (so that no screen space was wasted while working). This setup worked great for a while until I came across a spare monitor and, since I had the desk space, wanted to try and get a triple head system going. (Who wouldn’t? On Linux doing more than dual monitor typically requires that you add an extra video card to your system but I didn’t want to go this route.)

About this time I had come across DisplayLink – a technology that lets you attach extra monitors to your computer by simply plugging in a USB cable. The DisplayLink site offers drivers for Windows and Mac (although Mac support didn’t exist at the time of discovering this) but none for Linux. You can get DisplayLink devices working in Linux (search for my 3 blog posts on the subject) but it’s limited, tedious, and doesn’t seem to play well with other video card/monitor setups (at least in my case – proprietary NVIDIA driver combined with xf86-video-displaylink driver).

I spent many hours trying to get my DisplayLink device to work on Linux with my existing NVIDIA card and dual monitor setup but could never get things working. I was approaching things from the host OS side because I had tried previously to get the Windows virtual machine to use the DisplayLink device but had run into issues there. The tools for the virtual machine that let you bring the mouse in and out easily of the virtual machine window never get told that there’s an extra monitor so they don’t know that the screen bounds have changed and so you can’t ever move your mouse to the DisplayLink attached monitor when it’s attached inside the virtual machine. I couldn’t figure anything out on this front so I kept trying to get things working on the host side because if the host saw 3 monitors then the virtual machine tools would see 3 monitors and I’d have 3 monitors. But, as mentioned twice before already I couldn’t ever get my NVIDIA dual monitor setup to work with the displaylink X driver.

Back to today-ish.

It had been a while since I tried getting the DisplayLink device to work while attached inside the virtual machine so I decided to give it another shot. The mouse-not-being-able-to-move-to-the-added-screen issue is still there but I decided to search on the VMware forums as well since a couple versions of Workstation (& Fusion) have come out since I last tried this. I found a post with a novel idea: because Windows can see that another monitor is attached and it knows that the screen size is what it is why not attach the host OS’s mouse directly to the virtual machine and then, because the mouse isn’t going through the tools, the mouse can access all the screen space that Windows sees! This requires a configuration change in the virtual machine’s .vmx file and a reboot but now I have 3 screens accessible and usable (!) inside the virtual machine! There is some weirdness when trying to move the mouse from monitor 2 to 3 (presumably because the tools are still influencing things slightly) but it’s working good enough to ignore for the moment. I’m also using UltraMon to easily move things from monitor to monitor and be able to maximize programs across all (or a portion) of the desktop (like Visual Studio maximized across monitor 1 & 2 with Thunderbird on monitor 3) and things are going well.

This is the snippet that goes in the .vmx file for the virtual machine:

usb.generic.allowHID = “TRUE”

With this added you will now see your mouse/keyboard (and other devices) listed as devices that can be attached directly to the virtual machine.  I connected a second mouse to the host and then attached my primary mouse to the virtual machine (note that the primary mouse can no longer interact with the host so that’s why I added the second mouse).

Well, it’s time to see if I can get my DisplayLink device working on an old dying laptop using Ubuntu 9.10 (32 bit) – so here goes.

Install Ubuntu 9.10 (32 bit).  Once finally installed and booted lets drop to a console (via Applications > Accessories > Terminal) and do some stuff.

Start by updating the package list:

sudo apt-get update

Then download and install any package & system updates:

sudo apt-get upgrade
sudo apt-get dist-upgrade

Then download some packages we’ll need later:

sudo apt-get install build-essential xorg-dev libusb-dev git-core

Reboot (via console or other means):

sudo shutdown -r now

Once the system is back up drop to a console and get the following package (I’m saving it to the Desktop):

cd Desktop
wget http://projects.unbit.it/downloads/udlfb-0.2.3_and_xf86-video-displaylink-0.3.tar.gz

NOTE: this package takes FOREVER to download.

Extract the package and delete the udlfb directory it contains (we’ll get a newer udlfb library in a bit):

tar xzvf udlfb-0.2.3_and_xf86-video-displaylink-0.3.tar.gz
rm -rf udlfb

Get the latest udlfb and build it:

git clone http://git.plugable.com/webdav/udlfb
cd udlfb
make
sudo make install

Compile the DisplayLink X driver:

cd ../xf86-video-displaylink
./configure && make
sudo make install
sudo shutdown -r now

You should now be able to plug in your DisplayLink device and see the green screen.

Now, here’s where things may get a bit difficult – setting up an xorg.conf file.  Modern distros don’t ship with xorg.conf’s anymore so it’s up to the end user to create one when one is needed.  Also, since this laptop doesn’t have an ATI or NVIDIA card there’s no proprietary driver to install (that would then automatically set up an xorg.conf file for me).  I’m creating a xorg.conf file based on this previous DisplayLink blog entry.

Some things to note:

  • Which /dev/fb* entry maps to the DisplayLink device.  You can see this by unplugging the device, doing an ‘ls‘ in the /dev directory, then plugging back in the device and doing another ‘ls‘ and seeing which entry was just added.
  • The ‘BusId‘ of the non-DisplayLink video card.  This can be obtained through lspci and is needed in the xorg.conf file.
  • Be sure to modify /etc/gdm/Init/Default to contain the following blurb right after the definition of the gdmwhich() function (this is taken from Patrick Gilmore’s blog):
  • XRANDR=`gdmwhich xrandr`
    if [ "x$XRANDR" != "x" ] ; then
      $XRANDR -o 0
    fi

Once you do/know these things you can start tailoring your xorg.conf.  Creating the xorg.conf file is above the scope of this blog and highly dependent on your own computers’ specific hardware.  However, here is how mine turned out:

# xorg.conf (X.Org X Window System server configuration file)

############ Original Video Settings ###########

Section "Device"
        Identifier      "Configured Video Device"
	Driver		"intel"
        BusID           "PCI:0:2:0"
EndSection

Section "Monitor"
        Identifier      "Configured Monitor"
EndSection

Section "Screen"
        Identifier      "Default Screen"
        Monitor         "Configured Monitor"
        Device          "Configured Video Device"
        SubSection "Display"
                Depth   24
                Modes   "1280x800"
        EndSubSection
EndSection

#################################################

Section "ServerLayout"
        Identifier      "Server Layout"
        Screen  0       "DisplayLinkScreen" 0 0
        Screen  1       "Default Screen" LeftOf "DisplayLinkScreen"
        Option          "Xinerama" "off"
EndSection

#################################################

Section "Files"
        ModulePath      "/usr/lib/xorg/modules"
        ModulePath      "/usr/local/lib/xorg/modules"
	ModulePath	"/usr/local/lib/xorg/modules/drivers"
EndSection

############### DisplayLink Stuff ###############

Section "Device"
        Identifier      "DisplayLinkDevice"
        driver          "displaylink"
        Option  "fbdev" "/dev/fb1"
EndSection

Section "Monitor"
        Identifier      "DisplayLinkMonitor"
EndSection

Section "Screen"
        Identifier      "DisplayLinkScreen"
	Device          "DisplayLinkDevice"
        Monitor         "DisplayLinkMonitor"
        SubSection "Display"
                Depth   16
		Modes   "1280x1024"
        EndSubSection
EndSection

Some pictures:

  1. Green screen
  2. Both monitors working

Roberto De Ioris released a new alpha driver that replaces udlfb and so I tested it on my laptop machine from my previous DisplayLink on Linux blog post and it seems to work just the same.

The steps I took – and assuming you’ve done everything from the previous blog – were:

  1. Boot up laptop with no DisplayLink device plugged in
  2. Open a terminal and change directory to where I had the source code for udlfb
  3. sudo modprobe -r udlfb
  4. make clean
  5. Find any lingering udlfb.ko files (like ones in /usr/lib/modules/`uname -r`/extra) and delete them
  6. Download new alpha package and extract it then change directory to where the source for the alpha was extracted
  7. make && sudo make install && sudo depmod -a
  8. Reboot and plug in DisplayLink device

Results (using a different monitor this time and going through a different DVI -> VGA converter):

  1. DisplayLink device is attached to top monitor

I also tested it with the monitor from the previous DisplayLink blog post (and without a DVI -> VGA adapter) and everything was the same as last time. Also, I didn’t change any xorg.conf settings or anything like that.

I bought a Sewell USB External Video Card as I wanted to extend my 2 monitor setup on my desktop machine into a 3 monitor setup. The desktop machine is my ‘beefiest’ rig and it’s where I do work when home. I mainly run Linux – Ubuntu 9.04 (64 bit) – and then fire up VMware Workstation when I need to get into Windows to do other stuff. When in Windows via VMware Workstation I put it in fullscreen mode then have it grab the other monitor so that Windows is full screen’d across both monitors. This works great but I’m finding now it would be helpful to have a 3rd monitor for VMware Workstation to use: enter DisplayLink.

DisplayLink lets you attach monitors via USB 2.0 and has official drivers for Windows & Mac. I’ve used my Sewell device on both Windows [Vista Ultimate (64 bit) & XP Professional (32 bit)] and Mac [OS X (10.5.7) with beta DisplayLink driver] and it works just fine. Attaching extra monitors is painless and for my use the refresh rate is just fine (I’m not watching movies or anything on the DisplayLink device). Now comes Linux.

I want to use the device with my desktop machine to add a 3rd monitor but the closest I’ve come is getting 2 monitors going on a different laptop machine and the rest of this post will be directed at how I accomplished this. I’ll be using a package created by Roberto De Ioris found on the Libldo mailing list. Additionally, a lot of the steps I take are from various posts and references on the Libldo mailing list as well.

I’m using an old laptop that I have – a Lenovo 3000 N100 clunky beast – with Ubuntu 8.10 (32 bit). I installed Ubuntu onto the laptop after resizing the primary Windows partition to make room for Ubuntu.

Once Ubuntu was installed I did this (and I’m using Gnome so if your menus don’t match up then that’s why):

  1. Open a terminal (Applications > Accessories > Terminal)
  2. sudo apt-get update
  3. sudo apt-get install libusb-dev xorg-dev build-essential
  4. cd ~/Desktop
  5. wget http://projects.unbit.it/downloads/udlfb-0.2.3_and_xf86-video-displaylink-0.3.tar.gz
  6. tar xzvf udlfb-0.2.3_and_xf86-video-displaylink-0.3.tar.gz
  7. cd udlfb
  8. make && sudo make install && sudo depmod -a
  9. cd ../xf86-video-displaylink
  10. ./configure && make && sudo make install
  11. gksudo gedit /etc/X11/xorg.conf

Here’s where things may get a bit different for you depending on your existing xorg.conf file and what all you need to put in that file for your machine configuration. Essentially, we have to tell X that we’ll be using two screens. We need to add a new “Device” section, a new “Monitor” section, and a new “Screen” section at the minimum. Additionally, we need to modify the “Files” section (if it exists or add it if it doesn’t exist) so that X can find the displaylink_drv.so that we just built and we need to modify the “ServerLayout” section (if it exists or add it if it doesn’t exist) so that X knows we’re using two screens. You also need to tailor the “Modes” sections of the screens so that they match supported resolutions for your monitors. YOU CANNOT JUST COPY AND PASTE THIS NEXT SEGMENT.

Here is what my xorg.conf looks like:

# xorg.conf (X.Org X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf manual page.
# (Type "man xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# Note that some configuration settings that could be done previously
# in this file, now are automatically configured by the server and settings
# here are ignored.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
#   sudo dpkg-reconfigure -phigh xserver-xorg                                                                     

############ Original Video Settings ###########                                                                  

Section "Device"
        Identifier      "Configured Video Device"
EndSection

Section "Monitor"
        Identifier      "Configured Monitor"
EndSection

Section "Screen"
        Identifier      "Default Screen"
        Monitor         "Configured Monitor"
        Device          "Configured Video Device"
        SubSection "Display"
                Depth   24
                Modes   "1280x800"
        EndSubSection
EndSection

#################################################                                                                 

Section "ServerLayout"
        Identifier      "Server Layout"
        Screen  0       "Default Screen" 0 0
        Screen  1       "DisplayLinkScreen" LeftOf "Default Screen"
EndSection

#################################################                                                                 

Section "Files"
        ModulePath      "/usr/lib/xorg/modules"
        ModulePath      "/usr/local/lib/xorg/modules"
EndSection

############### DisplayLink Stuff ###############                                                                 

Section "Device"
        Identifier      "DisplayLinkDevice"
        driver          "displaylink"
        Option  "fbdev" "/dev/fb0"
EndSection

Section "Monitor"
        Identifier      "DisplayLinkMonitor"
EndSection

Section "Screen"
        Identifier      "DisplayLinkScreen"
	Device          "DisplayLinkDevice"
        Monitor         "DisplayLinkMonitor"
        SubSection "Display"
                Depth   24
		Modes   "1280x1024"
        EndSubSection
EndSection

So that’s what the xorg.conf looks like on the laptop.

The first section titled “Original Video Settings” is what was automatically created by Ubuntu during installation. I edited the screen section to explicitly indicate I wanted 1280×800 for the laptop’s screen resolution.

The next item in my xorg.conf is the “ServerLayout” section but I’m going to leave that alone for now and come back to it.

The next item in my xorg.conf is the “Files” section and it’s needed because when doing “sudo make install” in the xf86-video-displaylink directory it puts the displaylink_drv.so in a different place than where X normally looks (/usr/local/lib/xorg/modules as opposed to /usr/lib/xorg/modules).

The next item is the “Device”, “Monitor”, & “Screen” section for the DisplayLink device. The “Device” & “Monitor” sections can be copy/pasted as-is but make sure to modify the “Screen” section so that the “Display” sub-section has the correct resolution or resolutions that your monitor can use.

Back to the “ServerLayout” section – this is where you indicate the position of the monitors. Essentially what my file says is that the laptop screen will be the primary screen and to the left of it will be the DisplayLink screen. I should note that more advanced users might want to throw in a “Xinerama” “On” line but I haven’t been able to get things to work with Xinerama enabled (- X crashes when it starts). So for now leave any cloning/Xinerama/TwinView/MergedFb/BigDesktop/whatever else out of the config.

Plug the DisplayLink device’s USB connector into the computer and reboot! (NOTE: I was using a DVI -> VGA adapter on the DisplayLink device and that would cause it to not work so stick with DVI if you can).

Here’s what things look like for me:

  1. Computer booting:
  2. Ubuntu loading:
  3. DisplayLink screen turns green showing it working:
  4. X sees two screens (left side has htop on it, right side has a terminal on it):
  5. The Sewell USB External Video Card

So, that’s it! Since there’s no Xinerama (or other such program) running the monitors are separate and you can’t drag windows back and forth but the mouse should be able to move between the monitors and you can fire up separate applications on each screen.

Hopefully in the upcoming months the Linux driver will keep getting better and better and catch up with the Mac & Windows DisplayLink drivers.