{"id":408,"date":"2014-06-17T11:17:33","date_gmt":"2014-06-17T17:17:33","guid":{"rendered":"http:\/\/csmartonline.com\/blog\/?p=408"},"modified":"2014-06-17T11:19:39","modified_gmt":"2014-06-17T17:19:39","slug":"the-kinect-as-a-skype-webcam-on-ubuntu","status":"publish","type":"post","link":"http:\/\/csmartonline.com\/blog\/2014\/06\/17\/the-kinect-as-a-skype-webcam-on-ubuntu\/","title":{"rendered":"The Kinect as a Skype Webcam on Ubuntu"},"content":{"rendered":"<p>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&#8217;s camera, microphone and motor are automatically enumerated and added to your usb devices. You can verify this through:<\/p>\n<pre class=\"snippet-code\">sudo dmesg<\/pre>\n<pre class=\"snippet-code\">sudo lsusb<\/pre>\n<p>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 &#8220;kinect-audio-setup&#8221;:<\/p>\n<pre class=\"snippet-code\">sudo apt-get install kinect-audio-setup<\/pre>\n<p>However, there is a bug with some Kinect&#8217;s that prevents the audio device being fully setup. When troubleshooting, you can issue the setup command to enable the microphone on the Kinect:<\/p>\n<pre class=\"snippet-code\">sudo kinect_upload_fw \/lib\/firmware\/kinect\/UACFirmware.C9C6E852_35A3_41DC_A57D_BDDEB43DFD04<\/pre>\n<p>If affected, this command will return this error:<\/p>\n<pre class=\"snippet-code\">\r\nlibusbx: error [op_set_configuration] failed, error -1 errno 110\r\n  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\r\n  libusbx: error [submit_bulk_transfer] submiturb failed error -1 errno=2\r\n  Error: res: -1    transferred: 0 (expected 24)\r\n<\/pre>\n<p>To remedy this, you must obtain the kinect-audio-setup source, change a few lines of code and build.<\/p>\n<p>We shall do that now.<\/p>\n<p>Download the source:<\/p>\n<pre class=\"snippet-code\">cd ~\/Downloads\r\nwget https:\/\/launchpad.net\/ubuntu\/+archive\/primary\/+files\/kinect-audio-setup_0.3.orig.tar.gz<\/pre>\n<p>Extract the source and change to it&#8217;s directory:<\/p>\n<pre class=\"snippet-code\">tar -xvzf kinect-audio-setup_0.3.orig.tar.gz\r\ncd kinect-audio-setup-0.3<\/pre>\n<p>Edit the file &#8220;kinect_upload_fw.c&#8221; according to the diff found at http:\/\/git.ao2.it\/kinect-audio-setup.git\/commitdiff\/6e31aa17271f90a443591719089688bbf2040765<\/p>\n<pre class=\"snippet-code\">gedit .\/kinect_upload_fw\/kinect_upload_fw.c<\/pre>\n<pre class=\"snippet-code\">index b2188d6..e3b72db 100644 (file)\r\n--- a\/kinect_upload_fw\/kinect_upload_fw.c\r\n+++ b\/kinect_upload_fw\/kinect_upload_fw.c\r\n@@ -155,9 +155,19 @@ int main(int argc, char** argv) {\r\n                goto fail_libusb_open;\r\n        }\r\n \r\n-       libusb_set_configuration(dev, 1);\r\n+       int current_configuration = 0;\r\n+       libusb_get_configuration(dev, &amp;current_configuration);\r\n+       if (current_configuration != 1)\r\n+               libusb_set_configuration(dev, 1);\r\n+\r\n        libusb_claim_interface(dev, 0);\r\n \r\n+       libusb_get_configuration(dev, &amp;current_configuration);\r\n+       if (current_configuration != 1) {\r\n+               res = -ENODEV;\r\n+               goto cleanup;\r\n+       }\r\n+\r\n        seq = 1;\r\n \r\n        bootloader_command cmd;<\/pre>\n<p>(Plus means that line has been added. It&#8217;s new. Minus means that line has been deleted.)<\/p>\n<p>After making the necessary changes to &#8220;kinect_upload_fw.c&#8221;, you may now build and install kinect-audio-setup:<\/p>\n<pre class=\"snippet-code\">sudo make install<\/pre>\n<p>If you run into errors about &#8220;libusb.h&#8221; missing, you need to install the &#8220;libusb-1.0-0.dev&#8221; package before running &#8220;make install&#8221;:<\/p>\n<pre class=\"snippet-code\">sudo apt-get install libusb-1.0-0.dev\r\nsudo make install<\/pre>\n<p>You have to fetch the firmware at least once before the Kinect&#8217;s audio can be enabled:<\/p>\n<pre class=\"snippet-code\">sudo .\/kinect_fetch_fw \/lib\/firmware\/kinect<\/pre>\n<p>After a logout or reboot, you should have a secondary soundcard with &#8220;Kinect&#8221; in it&#8217;s name. You can verify this though Pulseaudio&#8217;s manager or by issuing this command:<\/p>\n<pre class=\"snippet-code\">cat \/proc\/asound\/cards<\/pre>\n<p>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:<\/p>\n<pre class=\"snippet-code\">LD_PRELOAD=\/usr\/lib\/i386-linux-gnu\/libv4l\/v4l1compat.so \/usr\/bin\/skype<\/pre>\n<p>(You may need to adjust this for your system if you are running 64bit Ubuntu.)<\/p>\n<p>If Skype can successfully preview the video in it&#8217;s settings, then we can make this permanent with the following:<\/p>\n<pre class=\"snippet-code\">sudo gedit \/usr\/local\/bin\/skype<\/pre>\n<p>Copy and paste the following into our newly created file:<\/p>\n<pre class=\"snippet-code\">#!\/bin\/bash\r\nLD_PRELOAD=\/usr\/lib\/i386-linux-gnu\/libv4l\/v4l1compat.so \/usr\/bin\/skype<\/pre>\n<p>Make it exectuable:<\/p>\n<pre class=\"snippet-code\"> sudo chmod a+x \/usr\/local\/bin\/skype<\/pre>\n<p>Congrtulations! Now you should be able to run Skype using the Kinect as your webcam.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;s camera, microphone and motor are automatically enumerated and added &hellip;<\/p>\n<p class=\"read-more\"><a href=\"http:\/\/csmartonline.com\/blog\/2014\/06\/17\/the-kinect-as-a-skype-webcam-on-ubuntu\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[93,97,90,91,116,23,92,73],"class_list":["post-408","post","type-post","status-publish","format-standard","hentry","category-tiptrick","tag-camera","tag-driver","tag-kinect","tag-pc","tag-skype","tag-ubuntu","tag-webcam","tag-xbox"],"_links":{"self":[{"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/posts\/408","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/comments?post=408"}],"version-history":[{"count":2,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/posts\/408\/revisions"}],"predecessor-version":[{"id":410,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/posts\/408\/revisions\/410"}],"wp:attachment":[{"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/media?parent=408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/categories?post=408"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/tags?post=408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}