Personal tools
The Open Lighting Project has moved!

We've launched our new site at www.openlighting.org. This wiki will remain and be updated with more technical information.

LLA, OpenDMX USB and Q Light Controller Tutorial

From wiki.openlighting.org

Jump to: navigation, search


Old tutorial, look for new methods

(as of September 2016) This tutorial is extremely outdated.

The latest version of QLC is named QLC+ and is found at http://www.qlcplus.org/

You should probably should ignore the rest of this page...


Since this tutorial was made, QLC from v. 3.0.4 comes with a driver for Enttec Open DMX USB (in a plugin called FTDI), and LLA changed name to OLA. See the mailing list archive of "QLC-devel" for more info for now (January 2010).

It should no longer be necessary to use OLA together with a Linux kernel driver, if you just want DMX output from QLC to an OpenDMX USB dongle attached to the same computer that runs QLC. However, if you want to use OLA with an OpenDMX USB dongle, you need to follow both the instructions for building the driver below and the new tutorial on installing OLA on Linux.

Purpose

To show the steps to get the Enttec Open DMX USB interface working with the Linux Lighting Architecture, a general framework for lighting applications in Linux(LLA), via Erwin Rol's driver. Also getting the Q Lighting Controller (QLC) to work with LLA. This allows QLC to be used with the Enttec OpenDMX USB interfaces on a 2.6 kernel, for which dmx4linux is not yet fully working.

This may also be useful for people with a different interface supported by LLA who need some pointers on how to get LLA working with QLC, in which case you need only read from "Download and install LLA" onwards.

Introduction

I got very excited when I first saw QLC (http://qlc.sourceforge.net/). Then I got slightly annoyed, then very frustrated trying to get it to work. I ended up using Slackware so that I could have a relatively modern distro with Linux 2.4 in order to use dmx4linux. But it's a hassle to reboot every time I want to play with DMX. The other alternative is to use LLA, but this requires a separate computer for the Live CD.

LLA is available as packages for a standard distro, but needs an extra driver to work with Enttec OpenDMX USB, which is included on the Live CD but not in the standard packages.

This tutorial assumes you're using Ubuntu 7.04 (Fiesty Fawn), but should be usable for any apt-based distro. Could probably be adapted for rpm-based too.

This tutorial is deliberately quite verbose: although it could have been presented as one long cut'n'paste or a shell script, a walkthrough is more helpful for actually learning what's going on and will get out of date more slowly.

It would be really useful if users of other distros could modify this tutorial to make it more universal, or create other pages for distro-specific information.

Operating System

Install one of the supported linux distributions onto your machine: Ubuntu [1], Fedora [2] or CentOS [3]

Prerequisite packages

GIT and Cogito

These are used to download source code.

Ubuntu:

sudo apt-get install git-core cogito curl

Centos/Fedora:

yum install git-core cogito curl


Kernel

We need this in order to be able to compile the modules

Ubuntu:

sudo apt-get install linux-source

You may also need these:

sudo apt-get install linux-headers-$(uname -r)

Centos/Fedora:

yum install kernel-devel


Alien (Ubuntu only)

We will need to install some RPM files at some point (bah!)

sudo apt-get install alien

Build essentials

We're going to be building source, so we need the standard libraries:

Ubuntu:

sudo apt-get install build-essential

Centos/Fedora:

yum install buildsys-build


(if you're following this on a non-debian-style distibution, you need the libc, libstcd++ development files, C compiler etc.)

Build and install the usb kernel module

Erwil Rol's driver allows the Enttec OpenDMX USB driver to work with LLA.

It's best to make sure that you're running the kernel that you're intending to use - if you've upgraded from previous versions of Ubuntu you may have several versions hanging around. Removing old ones using Synaptic is probably a good idea.

Compile and install driver

cd ~
mkdir dmx-software
cd dmx-software
git clone git://github.com/lowlander/dmx_usb_module.git
cd dmx_usb_module
make
sudo cp ./dmx_usb.ko /lib/modules/$(uname -r)/kernel/drivers/usb/serial
sudo depmod

Kernel 2.6.37 and newer kernels

This should no longer be required if you are using the newer code from git://github.com/lowlander/dmx_usb_module.git; indeed the newer code has been confirmed to compile on a 3.1.9 kernel. The info below is left for historic reference:

  • save as "dmx_usb,patch"
  • patch < dmx_usb,patch
--- ../b/dmx_usb.c	2011-08-28 20:27:57.929828288 +0300
+++ dmx_usb.c	2011-08-28 20:32:41.075288289 +0300
@@ -93,7 +93,7 @@
 
 
 /* prevent races between open() and disconnect() */
-static DECLARE_MUTEX (disconnect_sem);
+static DEFINE_SEMAPHORE(disconnect_sem);
 
 /* local function prototypes */
 //static ssize_t dmx_usb_read	(struct file *file, char *buffer, size_t count, loff_t *ppos);
@@ -121,7 +121,7 @@
 
 	/* .read =		dmx_usb_read, */ 
 	.write =	dmx_usb_write,
-	.ioctl =	dmx_usb_ioctl,
+	.unlocked_ioctl =	dmx_usb_ioctl,
 	.open =		dmx_usb_open,
 	.release =	dmx_usb_release,
 };
@@ -618,7 +618,7 @@
 	}
 	memset (dev, 0x00, sizeof (*dev));
 
-	init_MUTEX (&dev->sem);
+	sema_init(&dev->sem, 1);
 	dev->udev = udev;
 	dev->interface = interface;

Blacklist the other serial drivers

Because this dongle uses a usb to serial converter chip, it's recognised by the hotplug/udev/hal system and drivers are loaded - unfortunately not ones that work with QLC. The workaround is to blacklist the alternative drivers. If you have other usb to serial converters then they will stop working - if you need these then you will have to delve into the source and change the USB device IDs that the drivers detect... here we will go for the quick and dirty solution.

Ubuntu

With your favourite text editor, as root/sudo, edit /etc/modprobe.d/blacklist e.g.:

sudo gedit /etc/modprobe.d/blacklist

add the following lines:

blacklist usbserial
blacklist usb-serial
blacklist ftdi_sio

Centos/Fedora

I do not know of any blacklisting in redhat based distros so just delete the offending module

mv /lib/modules/`uname -r`/kernel/drivers/usb/serial/ftdi_sio.ko /lib/modules/`uname -r`/kernel/drivers/usb/serial/ftdi_sio.ko.disabled
depmod -a

Remove the brltty package (Ubuntu only)

According to Synaptic, "BRLTTY is a daemon which provides access to the Linux console (text mode) for a blind person using a soft braille display". Unfortunately it has a habit of interfering with anything that looks like it might be a serial console, USB to serial devices included. There's probably a more elegant workaround, but we'll go for the quick and dirty again, and remove it:

sudo apt-get remove brltty

Test the driver

Plug in your dongle!! Hopefully all will go well, and if you type:

dmesg

you should see:

DMX USB device now attached to dmx192

If you've got other modules loading, ftdi serial drivers, etc. then something's wrong.

Download and install LLA

LLA is Linux Lighting Architecture, a general framework for lighting applications in Linux. It's available as a live CD, but we're just using the package as a way to interface QLC with the USB driver. More info about LLA on its webpage.

Install the packages

Ubuntu

There are debian packages available at the time of writing. Add the packages to your sources file:

sudo gedit /etc/apt/sources.list

Add the following line at the end:

deb http://www.nomis52.net/data/debian ./

Install the packages:

sudo apt-get update
sudo apt-get install liblla0 llad llad-console lla-examples

Centos/Fedora

There are packages available for CentOS 4 and 5 and Fedora 5,6,7 & 8 at the time of writing. You need to add the netmindz.net repo to yum

yum install http://rpms.netmindz.net/all/noarch/RPMS.netmindz/netmindz-repo-1.1.3-1.noarch.rpm

This will create a new file in /etc/yum.repos.d/netmindz.repo and register the GPG key used to sign netmindz.net packages


Install the packages:

yum install lla llad-console lla-examples

Test the installation

With your dongle connected as in section 3, you're now ready to test. Connect a DMX device up to your dongle, make sure you know the channel number it's on, make sure it's working correctly, make sure you got the polarity in your DMX lead right, etc. etc. Being sure that the dongle/hardware/software combination is the only weak link will save a lot of hair-pulling...

Fix the permissions on /dev/dmx:

chmod a+rw /dev/dmx

First, start the daemon with debug mode on:

llad -d 3 -f -s

Next, in another terminal find out what number the OpenDMX device is:

lla_dev_info

you should get something like:

Device 2: Open DMX USB Device

If you can't see 'Open DMX USB Device' in there somewhere, then you haven't got the kernel driver installed properly. Go straight to jail, do not pass go.

Assuming everything is OK, you need to patch this device so we can use it:

lla_patch -d2 -p0 -u0

(replace -d2 with whichever device number is your Open DMX USB)

now do:

lla_dev_info

and it should say

Device 2: Open DMX USB Device
  port 0, cap OUT, universe 1

Finally:

lla_dmxconsole

and play with the console!

Don't forget to remove your test patch afterwards:

lla_patch -r -d2 -p0 -u0

Download and install the latest build of QLC

Ubuntu

Finally! There are Ubuntu/Debian packages, but at the time of writing they're not the most up-to-date and don't include the LLA plugin. You could compile from source, but the most recent RPM packages work fine and save time and hassle.

cd ~/dmx-software
wget http://rpms.netmindz.net/FC6/i386/RPMS.netmindz/qlc-2.6.1-2.fc6.i386.rpm
sudo alien qlc-2.6.1-2.fc6.i386.rpm

wait a long time... (don't worry about the warnings)... then:

sudo dpkg -i qlc-2.6.1-2.fc6.i386.deb
sudo apt-get install libqt3-mt

Centos/Fedora

yum install qlc


Now try it:

sudo qlc &

QLC should run OK. Don't get too excited yet, there's one more step...

Put it all together

We now need a script that will start the lla daemon, patch the adaptor to the DMX universe (QLC uses 1 by default, LLA uses 0) and start QLC. This should do it:

#!/bin/bash
gksudo killall llad
sleep 2s
sudo llad
sleep 5s
sudo lla_patch -d2 -p0 -u1
sleep 2s
sudo qlc &

save it as something memorable (I use qlc-start) and make sure it's executable:

chmod u+x qlc-start

and you're away!