The Kinect as a Skype Webcam on Ubuntu

Using the Kinect as a webcam for Skype (or any other application) is fairly straightforward and already built into your kernel if you have a kernel version >= 3.0. The Kinect’s camera, microphone and motor are automatically enumerated and added to your usb devices. You can verify this through:

sudo dmesg
sudo lsusb

The microphone is not readily available as an input device to the system at the time of this writing. To enable the microphone, you should be able to install the package “kinect-audio-setup”:

sudo apt-get install kinect-audio-setup

However, there is a bug with some Kinect’s that prevents the audio device being fully setup. When troubleshooting, you can issue the setup command to enable the microphone on the Kinect:

sudo kinect_upload_fw /lib/firmware/kinect/UACFirmware.C9C6E852_35A3_41DC_A57D_BDDEB43DFD04

If affected, this command will return this error:

libusbx: error [op_set_configuration] failed, error -1 errno 110
  About to send: 09 20 02 06 01 00 00 00 60 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00
  libusbx: error [submit_bulk_transfer] submiturb failed error -1 errno=2
  Error: res: -1    transferred: 0 (expected 24)

To remedy this, you must obtain the kinect-audio-setup source, change a few lines of code and build.

We shall do that now.

Download the source:

cd ~/Downloads
wget https://launchpad.net/ubuntu/+archive/primary/+files/kinect-audio-setup_0.3.orig.tar.gz

Extract the source and change to it’s directory:

tar -xvzf kinect-audio-setup_0.3.orig.tar.gz
cd kinect-audio-setup-0.3

Edit the file “kinect_upload_fw.c” according to the diff found at http://git.ao2.it/kinect-audio-setup.git/commitdiff/6e31aa17271f90a443591719089688bbf2040765

gedit ./kinect_upload_fw/kinect_upload_fw.c
index b2188d6..e3b72db 100644 (file)
--- a/kinect_upload_fw/kinect_upload_fw.c
+++ b/kinect_upload_fw/kinect_upload_fw.c
@@ -155,9 +155,19 @@ int main(int argc, char** argv) {
                goto fail_libusb_open;
        }
 
-       libusb_set_configuration(dev, 1);
+       int current_configuration = 0;
+       libusb_get_configuration(dev, &current_configuration);
+       if (current_configuration != 1)
+               libusb_set_configuration(dev, 1);
+
        libusb_claim_interface(dev, 0);
 
+       libusb_get_configuration(dev, &current_configuration);
+       if (current_configuration != 1) {
+               res = -ENODEV;
+               goto cleanup;
+       }
+
        seq = 1;
 
        bootloader_command cmd;

(Plus means that line has been added. It’s new. Minus means that line has been deleted.)

After making the necessary changes to “kinect_upload_fw.c”, you may now build and install kinect-audio-setup:

sudo make install

If you run into errors about “libusb.h” missing, you need to install the “libusb-1.0-0.dev” package before running “make install”:

sudo apt-get install libusb-1.0-0.dev
sudo make install

You have to fetch the firmware at least once before the Kinect’s audio can be enabled:

sudo ./kinect_fetch_fw /lib/firmware/kinect

After a logout or reboot, you should have a secondary soundcard with “Kinect” in it’s name. You can verify this though Pulseaudio’s manager or by issuing this command:

cat /proc/asound/cards

Now that we have a fully working microphone and camera, Skype should be able to see and use them. If your video is blank when in the Skype settings, you may need to start Skype in a special way. To test this, run the following command:

LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so /usr/bin/skype

(You may need to adjust this for your system if you are running 64bit Ubuntu.)

If Skype can successfully preview the video in it’s settings, then we can make this permanent with the following:

sudo gedit /usr/local/bin/skype

Copy and paste the following into our newly created file:

#!/bin/bash
LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so /usr/bin/skype

Make it exectuable:

 sudo chmod a+x /usr/local/bin/skype

Congrtulations! Now you should be able to run Skype using the Kinect as your webcam.

Comments are closed.