Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Kinect for Xbox 360 Model 1473 #316

Closed
hkzlab opened this issue Jan 3, 2013 · 79 comments
Closed

Add support for Kinect for Xbox 360 Model 1473 #316

hkzlab opened this issue Jan 3, 2013 · 79 comments

Comments

@hkzlab
Copy link

hkzlab commented Jan 3, 2013

Hello,
I write to open an issue on the missing support for this device.
The 1473 model does not work with libfreenect: I always get a "Could not open device" when trying to launch demos using the camera or the tilt motor.

Also, the Xbox NUI Motor doesn't show up when checking with lsusb (testing on Ubuntu 12.10, 32bit):
Bus 001 Device 086: ID 045e:02c2 Microsoft Corp.
Bus 001 Device 087: ID 045e:02ad Microsoft Corp. Xbox NUI Audio
Bus 001 Device 088: ID 045e:02ae Microsoft Corp. Xbox NUI Camera
If needed, I can provide more verbose lsusb logs.

@tong
Copy link

tong commented Jan 8, 2013

dunno.please!

@a-m-p-m
Copy link

a-m-p-m commented Jan 13, 2013

I have the same issue with Kinect for Xbox 360 Model 1473.
Ubuntu 12.04 32bit, 64bit; Linux Mint 13 32bit on different computers.

@ansoto
Copy link

ansoto commented Jan 16, 2013

Hi,
I have the same issue... Have you found a solution ?

@JoshBlake
Copy link
Member

The solution is somewhat technically complicated and we're still discussing the right way to approach it. For more information check the OpenKinect mailing list: https://groups.google.com/group/openkinect

@ansoto
Copy link

ansoto commented Jan 22, 2013

Is there any progress about that ?
Thanks

@vitaly-little
Copy link

I found solution in this topic http://forum.openframeworks.cc/index.php?topic=11632.0

here is a very rough fix for it in the libfrenect files in this branch:
https://github.com/ofTheo/ofxKinect/tree/kinect-device-fix
you can see the differences between the current develop branch:
ofTheo/ofxKinect@develop...kinect-device-fix

@Exomene
Copy link

Exomene commented Feb 17, 2013

Thanks for finding this.
Can you explain how you proceeded?
I compiled and installed this fix but still have the "Unable to open" error while testing with glview with ubuntu 12.10 64bits.
Thanks

@ghost
Copy link

ghost commented Feb 18, 2013

The link doesn't work for me either, is anyone working on it?

@chriswei
Copy link

I was able to build and run the openFrameworks example described in the previously mentioned post on my Xbox Kinect model 1473. I built the ofxKinect 'kinect-device-fix' branch in openFrameworks using Xcode on my MBPro.

The video and point cloud seemed to be working, but I was unable to take that code and successfully build and run a standalone version of libfreenect. In my attempt with Theo Watson's kinect-device-fix branch, the glview test app finds a device, prints out some debug information in the terminal, opens a window, then hangs. At least it gets past the "Could not open device" error! Unfortunately I don't have any time (and maybe not the skills) to dig deeper.

I'm very interested in a solution that gets libfreenect working with the 'new' Xbox Kinect model 1473. I'd hate to have to return it and go looking for an older model on eBay. I'm also considering trying to get one of the Prime Sense sensors, but they're $200 plus shipping from Israel and take 2-4 weeks to ship. I'd eventually like to get Processing talking to the Xbox Kinect model 1473 on OS X.

The "previously mentioned post": http://forum.openframeworks.cc/index.php?topic=11632.0

Thanks!

@Exomene
Copy link

Exomene commented Feb 21, 2013

I'd like to use it with processing too. By the way, if you use openkinect in processing the IR in the kinect 1473 starts and it returns some results (I didn't get further).
I tried to follow the instructions on getting Theo Watson's branch to work with openFrameworks but failed (I got lost with code::blocks). Since it is a derivative, as far as I understood, I replaced the files in the source of openKinect by Theo's modified ones. It compiled on my ubuntu 12.10 but the problem remained the same.
Another question: I didn't understand the difference between freenect-glview and glview on the getting started page (http://openkinect.org/wiki/Getting_Started). It seems one should use glview when installed from the binaries and glview when installed from the sources. It's quite confusing for me, could'nt this be the source of some issues?

@dudefellah
Copy link

I've been messing around with this a bunch (I have a Kinect v 1473) and can get the demos sort of going by making one small change in freenect_fetch_zero_plane_info in src/cameras.c (note that this will break libfreenect with "old" Kinect versions):

--- a/src/cameras.c
+++ b/src/cameras.c
@@ -899,14 +899,13 @@ static int freenect_fetch_reg_const_shift(freenect_device *dev)
 static int freenect_fetch_zero_plane_info(freenect_device *dev)
 {
        freenect_context *ctx = dev->parent;
-
        char reply[0x200];
        uint16_t cmd[5] = {0}; // Offset is the only field in this command, and it's 0

        int res;
-       res = send_cmd(dev, 0x04, cmd, 10, reply, 322); //OPCODE_GET_FIXED_PARAMS = 4,
-       if (res != 322) {
-               FN_ERROR("freenect_fetch_zero_plane_info: send_cmd read %d bytes (expected 322)\n", res);
+       res = send_cmd(dev, 0x04, cmd, 10, reply, 334); //OPCODE_GET_FIXED_PARAMS = 4,
+       if (res != 334) {
+               FN_ERROR("freenect_fetch_zero_plane_info: send_cmd read %d bytes (expected 334)\n", res);
                return -1;
        }

and then I remove attempts to use the motor:

--- a/examples/glview.c
+++ b/examples/glview.c
@@ -412,7 +412,8 @@ int main(int argc, char **argv)
        }

        freenect_set_log_level(f_ctx, FREENECT_LOG_DEBUG);
-       freenect_select_subdevices(f_ctx, (freenect_device_flags)(FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA));
+       //freenect_select_subdevices(f_ctx, (freenect_device_flags)(FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA | FREENECT_DEVICE_AUDIO));
+       freenect_select_subdevices(f_ctx, (freenect_device_flags)(FREENECT_DEVICE_CAMERA | FREENECT_DEVICE_AUDIO));

        int nr_devices = freenect_num_devices (f_ctx);
        printf ("Number of devices found: %d\n", nr_devices);

I've read that there have been changes with the motor device in that it's somehow attached to the audio now? I'm not very experienced with libusb, but I would like to try to mess around and make it work if anybody has any ideas/suggestions.

@zanemcca
Copy link

So I am brand new to github. Could you tell me how you compiled your changes after you put them in @dudefellah

I tried to make in the build directory but it did not seem to put the changes in. I also removed the object files and even tried removing the whole build directory and redoing cmake. Nothing seemed to work. Any help would be great.

@dudefellah
Copy link

I've forked my own copy here: https://github.com/dudefellah/libfreenect.git

You can diff against your repo to see what's been changed (the changes are somewhat different from what I posted earlier... I'm still trying to figure this stuff out)

When you compile, you'll need to build audio and I've added a flag for building for the kinect ver 1473, so you'll need at least something like cmake -DBUILD_AUDIO:BOOL=ON -DBUILD_KINECT_1473:BOOL=ON

I didn't commit the changes in glview since I've been messing around with a whole bunch of stuff, but I think you'll probably need remove the FREENECT_DEVICE_MOTOR flag from freenect_select_subdevices and may (I can't remember exactly) need to add FREENECT_DEVICE_AUDIO. The glview.c change should be the same as I posted earlier.

Hope that helps a bit more.

Does nobody else have more information on what's needed to get everything working again?

@dudefellah
Copy link

Looks like my work so far is actually a dumber version of this: renewagner@06e48e5 . I'll probably end up using this code when I have time to play with libfreenect in the next week or so.

@zanemcca
Copy link

Thanks that helps. I cannot find anything useful telling me why this thing will not rebuild properly.

If I edit glview.c I can see my changes right away. But I cannot get anything to happen when I change cameras.c. make says it is compiling it but nothing I do changes the output. I have installed, uninstalled and deleted everything countless times nothing I do has changed the output at all.

My most reason version of this is here:

--- a/src/cameras.c
+++ b/src/cameras.c
@@ -903,13 +903,29 @@ static int freenect_fetch_zero_plane_info(freenect_device *dev)
        uint16_t cmd[5] = {0}; // Offset is the only field in this command, and it's 0

        int res;
-       res = send_cmd(dev, 0x04, cmd, 10, reply, 322); //OPCODE_GET_FIXED_PARAMS = 4,
-       if (res != 322) {
-               FN_ERROR("freenect_fetch_zero_plane_info: send_cmd read %d bytes (expected 322)\n", res);
-               return -1;
-       }

-       memcpy(&(dev->registration.zero_plane_info), reply + 94, sizeof(dev->registration.zero_plane_info));
+        int expected_len = 0;
+        int struct_offset = 0;
+/*        switch(dev->hwrev) {
+          case HWREV_XBOX360_0:
+            expected_len = 322;
+            struct_offset = 94;
+            break;
+          case HWREV_K4W_0:
+          */
+            expected_len = 334;
+            struct_offset = 94;
+//            break;
+//        }
+
+        res = send_cmd(dev, 0x04, cmd, 10, reply, expected_len); //OPCODE_GET_FIXED_PARAMS = 4,
+        if (res != expected_len) {
+          //FN_ERROR("freenect_fetch_zero_plane_info: send_cmd read %d bytes (expected %d)\n", res, expected_len);
+          FN_ERROR("ERROR: THIS SHOULD PRINT ON THE SCREEN");
+           return -1;
+        }
+
+        memcpy(&(dev->registration.zero_plane_info), reply + struct_offset, sizeof(dev->registration.zero_plane_info));
        union {
                uint32_t ui;
                float f;
@@ -1261,7 +1277,9 @@ int freenect_set_video_mode(freenect_device* dev, const freenect_frame_mode mode
        dev->video_resolution = res;
        // Now that we've changed video format and resolution, we need to update
        // registration tables.
-       freenect_fetch_reg_info(dev);
+        if (res == FREENECT_RESOLUTION_MEDIUM) {
+           freenect_fetch_reg_info(dev);
+        }
        return 0;
 } 

When I run glview I get this:

Kinect camera test
Number of devices found: 1
Control cmd=0016 tag=0000 len=000a: 18
Control reply: 18
start_lines:    0
end_lines:      0
cropping_lines: 0
Control cmd=0004 tag=0001 len=000a: 18
Control reply: 18
send_cmd: Data buffer is 322 bytes long, but got 334 bytes
freenect_fetch_zero_plane_info: send_cmd read 334 bytes (expected 322)
freenect_camera_init(): Failed to fetch zero plane info for device
Could not open device

I do not know how it is possible for it to print 322 at all I have it hard coded to 334. I have tried this a million times. Please help, how do I get the changes to go through?

@zanemcca
Copy link

Ok so I tried to edit the file on my MacAir and it worked. But it is still not responding on my RaspberryPi with RaspbianOS. I am guessing there is some other old definition of that code that is getting called but I have no idea where it is. I tried to go through my /usr and /bin directories and I deleted everything with libfreenect in it then I reinstalled everything but still nothing.

@Exomene
Copy link

Exomene commented Mar 16, 2013

Thanks @dudefellah.
I tried René Wagner's branch and finally had the same message as @zanemcca though I removed all files related to libfreenect before.

@leokoppel
Copy link

I got the camera to work by combining renewagner's and ofTheo's code. I saved this here https://github.com/theoceanwalker/libfreenect
The glview example doesn't seem to work (it shows a blank window, and running it somehow messes up subsequent attemps to access the kinect), though "regview" does. This doesn't really concern me as I am using the python wrappers which are now working.

@zanemcca
Copy link

Hey @Exomene I am trying to figure out why we are having this error.

My theory is that there is some file that is linking to an old copy of the /src directory and our changes are actually getting compiled into another file.

But to narrow down the symptoms of our problem can you tell me what hardware/OS you are on?
I am on a RaspberryPi Rev B with RaspbianOS.

Also I tried to get the OpenFrameworks fix working, which could be the source of the error, did you try to install it as well?

Any other info you have should help. Thanks

@leokoppel
Copy link

@zanemcca @Exomene odd issue but almost certainly has nothing to do with this library in particular, or what hardware you're on. The simplest explanations are

  • Your code is not actually being built (e.g., you did not run cmake to regenerate the Makefile after copying the source directory)
  • You have conflicting library paths (e.g. /usr/lib and /usr/local/lib)

What are you actually doing to build? The output of make will tell you what source directory it's using..

@Exomene
Copy link

Exomene commented Mar 24, 2013

Hi,
I'm just passing by and I'll come back after having test thoroughly but the problem I face may be due to the use of Kinect on USB 3 ports. As strange as it sounds I read that Kinect is an USB 2 only device and might not work correctly on USB 3. I'm on a PC running Ubuntu 12.10 64bit.

@zanemcca
Copy link

Hi @theoceanwalker Thanks for the insight.
I have gotten mine to work by the rather crude reinstall my OS method, not a big hassle for me since it had almost nothing on it anyway. But I did not change my method for recompiling at all so I am confident that was not the issue. I think you are probably right about the /usr/lib and /usr/local/lib having conflicts. I tried as best as I could to track down any instances of libfreenect in the /usr and /etc directories but it is possible that I missed stuff.

But just for an FYI here are my outputs from making on my new install.

pi@raspberrypi ~/libfreenect/build $ cmake ..
-- Operating system is Linux
-- Got System Processor armv6l
-- libfreenect will be installed to /usr/local
-- Headers will be installed to /usr/local/include/libfreenect
-- Libraries will be installed to /usr/local/lib
-- Found libusb-1.0:
--  - Includes: /usr/include/libusb-1.0
--  - Libraries: /usr/lib/arm-linux-gnueabihf/libusb-1.0.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/libfreenect/build
pi@raspberrypi ~/libfreenect/build $ make
Scanning dependencies of target freenect
[  4%] Building C object src/CMakeFiles/freenect.dir/usb_libusb10.c.o
Linking C shared library ../lib/libfreenect.so
[ 23%] Built target freenect
Scanning dependencies of target freenectstatic
[ 28%] Building C object src/CMakeFiles/freenectstatic.dir/usb_libusb10.c.o
Linking C static library ../lib/libfreenect.a
[ 47%] Built target freenectstatic
Linking C shared library ../../lib/libfreenect_sync.so
[ 52%] Built target freenect_sync
Linking C executable ../bin/glpclview
[ 57%] Built target glpclview
Linking C executable ../bin/glview
[ 61%] Built target glview
Linking C executable ../bin/hiview
[ 66%] Built target hiview
Linking C executable ../bin/regtest
[ 71%] Built target regtest
Linking C executable ../bin/regview
[ 76%] Built target regview
Linking C executable ../bin/tiltdemo
[ 80%] Built target tiltdemo
[ 85%] Built target fakenect
Linking C executable ../bin/record
[ 90%] Built target record
[ 95%] Built target freenect_sync_static
Linking CXX executable ../../bin/cppview
[100%] Built target cppview
pi@raspberrypi ~/libfreenect/build $ sudo make install
[ 23%] Built target freenect
[ 47%] Built target freenectstatic
[ 52%] Built target freenect_sync
[ 57%] Built target glpclview
[ 61%] Built target glview
[ 66%] Built target hiview
[ 71%] Built target regtest
[ 76%] Built target regview
[ 80%] Built target tiltdemo
[ 85%] Built target fakenect
[ 90%] Built target record
[ 95%] Built target freenect_sync_static
[100%] Built target cppview
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/libfreenect.so.0.1.2
-- Up-to-date: /usr/local/lib/libfreenect.so.0.1
-- Up-to-date: /usr/local/lib/libfreenect.so
-- Installing: /usr/local/lib/libfreenect.a
-- Up-to-date: /usr/local/include/libfreenect/libfreenect.h
-- Up-to-date: /usr/local/include/libfreenect/libfreenect-registration.h
-- Up-to-date: /usr/local/lib/pkgconfig/libfreenect.pc
-- Installing: /usr/local/bin/glview
-- Removed runtime path from "/usr/local/bin/glview"
-- Installing: /usr/local/bin/regview
-- Removed runtime path from "/usr/local/bin/regview"
-- Installing: /usr/local/bin/hiview
-- Removed runtime path from "/usr/local/bin/hiview"
-- Installing: /usr/local/bin/glpclview
-- Removed runtime path from "/usr/local/bin/glpclview"
-- Installing: /usr/local/bin/tiltdemo
-- Removed runtime path from "/usr/local/bin/tiltdemo"
-- Up-to-date: /usr/local/lib/fakenect/libfreenect.so.0.1.2
-- Up-to-date: /usr/local/lib/fakenect/libfreenect.so.0.1
-- Up-to-date: /usr/local/lib/fakenect/libfreenect.so
-- Installing: /usr/local/bin/record
-- Removed runtime path from "/usr/local/bin/record"
-- Up-to-date: /usr/local/bin/fakenect
-- Installing: /usr/local/lib/libfreenect_sync.so.0.1.2
-- Up-to-date: /usr/local/lib/libfreenect_sync.so.0.1
-- Up-to-date: /usr/local/lib/libfreenect_sync.so
-- Removed runtime path from "/usr/local/lib/libfreenect_sync.so.0.1.2"
-- Up-to-date: /usr/local/lib/libfreenect_sync.a
-- Up-to-date: /usr/local/include/libfreenect/libfreenect_sync.h
-- Up-to-date: /usr/local/include/libfreenect.hpp
-- Installing: /usr/local/bin/cppview
-- Removed runtime path from "/usr/local/bin/cppview"

Thanks again.

@Exomene
Copy link

Exomene commented Mar 26, 2013

Hi @zanemcca,
Yes I tried the openFrameworks fix.
I thought you had a good idea by removing all the references to libfreenect and kinect before trying to reinstall @theoceanwalker 's branch.
So this is what's left concerning *nect on my computer before reinstalling libfreenect (I'm running ubuntu 12.10 64bits)

/etc/modprobe.d/blacklist-gspca-kinect.conf
/etc/udev/rules.d/51-kinect.rules
/lib/modules/3.2.0-32-generic/kernel/drivers/media/video/gspca/gspca_kinect.ko
/lib/modules/3.5.0-18-generic/kernel/drivers/media/video/gspca/gspca_kinect.ko
/lib/modules/3.5.0-19-generic/kernel/drivers/media/video/gspca/gspca_kinect.ko
/lib/modules/3.5.0-21-generic/kernel/drivers/media/video/gspca/gspca_kinect.ko
/lib/modules/3.5.0-22-generic/kernel/drivers/media/video/gspca/gspca_kinect.ko
/lib/modules/3.5.0-23-generic/kernel/drivers/media/video/gspca/gspca_kinect.ko
/lib/modules/3.5.0-25-generic/kernel/drivers/media/video/gspca/gspca_kinect.ko
/lib/modules/3.5.0-26-generic/kernel/drivers/media/video/gspca/gspca_kinect.ko
/usr/share/doc/opencv-doc/examples/cpp/kinect_maps.cpp.gz
/usr/share/pulseaudio/alsa-mixer/profile-sets/kinect-audio.conf
/usr/src/linux-headers-3.5.0-19-generic/include/config/usb/gspca/kinect.h
/usr/src/linux-headers-3.5.0-21-generic/include/config/usb/gspca/kinect.h
/usr/src/linux-headers-3.5.0-22-generic/include/config/usb/gspca/kinect.h
/usr/src/linux-headers-3.5.0-23-generic/include/config/usb/gspca/kinect.h
/usr/src/linux-headers-3.5.0-25-generic/include/config/usb/gspca/kinect.h
/usr/src/linux-headers-3.5.0-26-generic/include/config/usb/gspca/kinect.h

Is there still thing I should remove?

Regarding the result of cmake, here they are

-- The C compiler identification is GNU 4.7.2
-- The CXX compiler identification is GNU 4.7.2
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Operating system is Linux
-- Got System Processor x86_64
-- Linux x86_64 Detected
-- libfreenect will be installed to /usr/local
-- Headers will be installed to /usr/local/include/libfreenect
-- Libraries will be installed to /usr/local/lib64
-- Found libusb-1.0:
--  - Includes: /usr/include/libusb-1.0
--  - Libraries: /usr/lib/x86_64-linux-gnu/libusb-1.0.so
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so  
-- Found GLUT: /usr/lib/x86_64-linux-gnu/libglut.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/exomene/libfreenect-master/build

And the results of make

Scanning dependencies of target freenect
[  4%] Building C object src/CMakeFiles/freenect.dir/core.c.o
[  9%] Building C object src/CMakeFiles/freenect.dir/tilt.c.o
[ 14%] Building C object src/CMakeFiles/freenect.dir/cameras.c.o
/home/exomene/libfreenect-master/src/cameras.c:749:17: attention : ‘read_register’ defined but not used [-Wunused-function]
/home/exomene/libfreenect-master/src/cameras.c: In function ‘freenect_set_smoothing_mode’:
/home/exomene/libfreenect-master/src/cameras.c:1338:1: attention : contrôle a atteint la fin non void de la fonction [-Wreturn-type]
[ 19%] Building C object src/CMakeFiles/freenect.dir/usb_libusb10.c.o
/home/exomene/libfreenect-master/src/usb_libusb10.c: In function ‘fnusb_open_subdevices’:
/home/exomene/libfreenect-master/src/usb_libusb10.c:382:1: attention : format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘struct libusb_device_handle *’ [-Wformat]
/home/exomene/libfreenect-master/src/usb_libusb10.c:385:1: attention : format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘struct libusb_device_handle *’ [-Wformat]
/home/exomene/libfreenect-master/src/usb_libusb10.c:178:25: attention : unused variable ‘nr_mot’ [-Wunused-variable]
[ 23%] Building C object src/CMakeFiles/freenect.dir/registration.c.o
Linking C shared library ../lib/libfreenect.so
[ 23%] Built target freenect
Scanning dependencies of target freenectstatic
[ 28%] Building C object src/CMakeFiles/freenectstatic.dir/core.c.o
[ 33%] Building C object src/CMakeFiles/freenectstatic.dir/tilt.c.o
[ 38%] Building C object src/CMakeFiles/freenectstatic.dir/cameras.c.o
/home/exomene/libfreenect-master/src/cameras.c:749:17: attention : ‘read_register’ defined but not used [-Wunused-function]
/home/exomene/libfreenect-master/src/cameras.c: In function ‘freenect_set_smoothing_mode’:
/home/exomene/libfreenect-master/src/cameras.c:1338:1: attention : contrôle a atteint la fin non void de la fonction [-Wreturn-type]
[ 42%] Building C object src/CMakeFiles/freenectstatic.dir/usb_libusb10.c.o
/home/exomene/libfreenect-master/src/usb_libusb10.c: In function ‘fnusb_open_subdevices’:
/home/exomene/libfreenect-master/src/usb_libusb10.c:382:1: attention : format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘struct libusb_device_handle *’ [-Wformat]
/home/exomene/libfreenect-master/src/usb_libusb10.c:385:1: attention : format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘struct libusb_device_handle *’ [-Wformat]
/home/exomene/libfreenect-master/src/usb_libusb10.c:178:25: attention : unused variable ‘nr_mot’ [-Wunused-variable]
[ 47%] Building C object src/CMakeFiles/freenectstatic.dir/registration.c.o
Linking C static library ../lib/libfreenect.a
[ 47%] Built target freenectstatic
Scanning dependencies of target freenect_sync
[ 52%] Building C object wrappers/c_sync/CMakeFiles/freenect_sync.dir/libfreenect_sync.c.o
Linking C shared library ../../lib/libfreenect_sync.so
[ 52%] Built target freenect_sync
Scanning dependencies of target glpclview
[ 57%] Building C object examples/CMakeFiles/glpclview.dir/glpclview.c.o
Linking C executable ../bin/glpclview
[ 57%] Built target glpclview
Scanning dependencies of target glview
[ 61%] Building C object examples/CMakeFiles/glview.dir/glview.c.o
Linking C executable ../bin/glview
[ 61%] Built target glview
Scanning dependencies of target hiview
[ 66%] Building C object examples/CMakeFiles/hiview.dir/hiview.c.o
Linking C executable ../bin/hiview
[ 66%] Built target hiview
Scanning dependencies of target regtest
[ 71%] Building C object examples/CMakeFiles/regtest.dir/regtest.c.o
Linking C executable ../bin/regtest
[ 71%] Built target regtest
Scanning dependencies of target regview
[ 76%] Building C object examples/CMakeFiles/regview.dir/regview.c.o
Linking C executable ../bin/regview
[ 76%] Built target regview
Scanning dependencies of target tiltdemo
[ 80%] Building C object examples/CMakeFiles/tiltdemo.dir/tiltdemo.c.o
Linking C executable ../bin/tiltdemo
[ 80%] Built target tiltdemo
Scanning dependencies of target fakenect
[ 85%] Building C object fakenect/CMakeFiles/fakenect.dir/fakenect.c.o
Linking C shared library ../lib/fakenect/libfreenect.so
[ 85%] Built target fakenect
Scanning dependencies of target record
[ 90%] Building C object fakenect/CMakeFiles/record.dir/record.c.o
Linking C executable ../bin/record
[ 90%] Built target record
Scanning dependencies of target freenect_sync_static
[ 95%] Building C object wrappers/c_sync/CMakeFiles/freenect_sync_static.dir/libfreenect_sync.c.o
Linking C static library ../../lib/libfreenect_sync.a
[ 95%] Built target freenect_sync_static
Scanning dependencies of target cppview
[100%] Building CXX object wrappers/cpp/CMakeFiles/cppview.dir/cppview.cpp.o
Linking CXX executable ../../bin/cppview
[100%] Built target cppview

Last question, I am supposed to do a make install after cmake and make?

Thank you all for your help,

Exomène

@leokoppel
Copy link

@Exomene Yes. If you don't run make install or manually tell the system where to look for the library, it's not going to find it. It will find the old version. See this: http://tldp.org/LDP/LG/current/smith.html on the usual build process (though in this case cmake replaces the configure script) and this: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html for details on shared libraries .

@csotiriou
Copy link

Is there any news on the implementation of support of model 1473?
Is there anything we can use right now that actually works, until official support comes? I have seen suggestions in this thread, but I haven't got the time to test all of them. Yesterday, I found out that https://github.com/dudefellah/libfreenect.git does not work for me..

Has anyone been able to run openKinect with 1473 using any variant?

@tong
Copy link

tong commented Mar 27, 2013

yes, @dudefellah version works for me on 1473, not the glview and i have to re-plug the kinect after each try.

@csotiriou
Copy link

Maybe it's because the device's sensors are not properly closed after you try. I noticed that, too.

Anyone has any news on wether any fix will be implemented or if any effort is made by the official OpenKinect? So far it seems OpenNI is the only viable option, and even then, the newest 2.0 version needs the Kinect SDK ( = does not support Linux and OS X )

@lucky13bbq
Copy link

I also got it working like dudefellah by editing cameras.c, but I removed attempt to use the motor differently. Here are my 2 small changes:


diff --git a/include/libfreenect.h b/include/libfreenect.h
index 4dfb6b1..ceb9111 100644
--- a/include/libfreenect.h
+++ b/include/libfreenect.h
@@ -57,7 +57,7 @@ extern "C" {
 /// and motor support while letting OpenNI have access to the cameras.
 /// If a device is not supported on a particular platform, its flag will be ignored.
 typedef enum {
-   FREENECT_DEVICE_MOTOR  = 0x01,
+   FREENECT_DEVICE_MOTOR  = 0x00,
    FREENECT_DEVICE_CAMERA = 0x02,
    FREENECT_DEVICE_AUDIO  = 0x04,
 } freenect_device_flags;
diff --git a/src/cameras.c b/src/cameras.c
index 7886a33..915fd29 100644
--- a/src/cameras.c
+++ b/src/cameras.c
@@ -905,7 +905,7 @@ static int freenect_fetch_zero_plane_info(freenect_device *dev)
 
    int res;
    res = send_cmd(dev, 0x04, cmd, 10, reply, 322); //OPCODE_GET_FIXED_PARAMS = 4,
-   if (res != 322) {
+   if (res != 322 && res != 334) {
        FN_ERROR("freenect_fetch_zero_plane_info: send_cmd read %d bytes (expected 322)\n", res);
        return -1;
    }

@dudefellah
Copy link

Yeah there's a number of ways to achieve the same ends. I still think renewagner@06e48e5 is a better option right now. There's still some stuff missing, of course. The stream seems to go out of sync quite easily. I'm guessing there's slight variations on what's being sent back and forth but I haven't had a whole lot of time lately, so I haven't really tried to figure it out. Whatever's changed in the data stream is causing glview to be a little jerky as the video stream is resynced.

I saw a thread a little while ago in my email (I can't seem to find it on github) referring to these: http://answers.ros.org/question/12876/kinect-for-windows/
http://answers.ros.org/answers/35351/revisions/
That might have a little more of what we're looking for on getting 1473 to work.

@ghost
Copy link

ghost commented Apr 2, 2013

Hi!
In my case, i tried dudefellas solution - the code of renewagner - but it still not worked.
I got the error

send_cmd: Data buffer is 322 bytes long, but got 334 bytes
freenect_fetch_zero_plane_info: send_cmd read 334 bytes (expected 322)
freenect_camera_init(): Failed to fetch zero plane info for device
Could not open device

Therefore I simply changed the code of camera.c like this

switch(dev->hwrev) {
    case HWREV_XBOX360_0:
-      expected_len = 322;
+      expected_len = 334;
      struct_offset = 94;
      break;

And it works.

BTW, with OpenNI-1.5. I have no problems to run model 1473.

@wizgrav
Copy link
Contributor

wizgrav commented May 5, 2013

@xxorde @killkrt I suspect the problem lies in the absence of the motor device in the newer kinects. I haven't modified the examples to take that into account. As it's orthodox easter here and I'm pretty far from home right now, I won't be able to inspect that for a couple of days more. When I get back to my main box, I'd be grateful if either of you could spare some time for a hangout or skype session so we can close this one for good. Msg me at wizgrav@gmail.com if you're interested

@csotiriou
Copy link

Wizgrav, me too, I build against your changes, and still no success. I get the usual "no devices found" error.

@timtro
Copy link

timtro commented Jul 23, 2013

At the risk of simply restating everyone else's problem:

I just got a 1473 from Costco in Canada, and when I clone the libfreenect repo, compile and try to run any of the bins, they "Could not open device" or "Cannot get device", although "Number of devices found" is 1. Using up-to-date Mint 15.

Is there a word on when this might be fixed? I'm quite happy to help if my meagre programming skill might help, but I doubt it.

@piedar
Copy link
Contributor

piedar commented Jul 23, 2013

Support for this model has been completed by wizgrav in #325 and is currently in unstable pending the next release.

@piedar piedar closed this as completed Jul 23, 2013
@wizgrav
Copy link
Contributor

wizgrav commented Jul 23, 2013

@timtro try cloning the unstable branch ( git clone -b unstable https://github.com/OpenKinect/libfreenect.git )

@tong
Copy link

tong commented Jul 24, 2013

just tested unstable branch and cannot confirm the fix. still get same errors (on all examples).
./glview
Kinect camera test
Number of devices found: 1
Could not open camera: -3
Could not open device

@wizgrav
Copy link
Contributor

wizgrav commented Jul 24, 2013

-3 is libusb error LIBUSB_ERROR_ACCESS. This probably means you don't have rights to access the device. Try running as root or install the udev rules

@tong
Copy link

tong commented Jul 24, 2013

Ah .. forgot this as i moved to a new system, now everything is working!
Thank you very much!

@timtro
Copy link

timtro commented Jul 24, 2013

That worked brilliantly. Thanks!

Best regards,

Tim.
http://www.timteatro.net

On Tue, Jul 23, 2013 at 6:10 PM, Yannis Gravezas
notifications@github.comwrote:

@timtro https://github.com/timtro try cloning the unstable branch ( git
clone -b unstable https://github.com/OpenKinect/libfreenect.git )


Reply to this email directly or view it on GitHubhttps://github.com//issues/316#issuecomment-21449998
.

ofTheo added a commit to ofTheo/libfreenect that referenced this issue Jan 23, 2014
…up. This seems to fix a known issue for OS X users where the device renumerates within a small time period and causes a freeze. Closes OpenKinect#340 and addresses OpenKinect#316. Signed-off-by: Theodore Watson <theo@openframeworks.cc> (ofTheo)
@MihaiDogariu
Copy link

Hello! I have stumbled upon the same error and ended up at this site. I have tried @wizgrav 's proposed solution and it worked for me as I can now run the glview command. However I can't find any audio recording application as this is what I was searching for. Is this supported for the KINECT 1473 model or am I troubling for nothing? I know that the thread is old but still hoping for a response. Thanks in advance!

@piedar
Copy link
Contributor

piedar commented Sep 1, 2014

@MihaiDogariu For audio support you'll need device-specific firmware. fwfetcher.py works for model 1414 but not 1473. Right now the easiest way to get 1473 firmware is from ofxKinectExtras. You can get a pointer to the firmware from ofxKinectExtras::getFWDatak4w and pass it to freenect_set_fw_address_k4w.

@MihaiDogariu
Copy link

@piedar What I have tried is written in the following link: http://www.keyboardmods.com/2011/10/kinect-speech-recognition-in-linux.html under the "Integrating the kinect" section. It is similar to what you have pointed out and it worked for me. It now recognizes the kinect device as an audio input device and I can record audio from it using Linux's default microphone recorder or Audacity, for a greater degree of customization as I can choose on how many channels I want to record the sound. Thank you for your quick response!

@dansupergameprogrammer
Copy link

I tried to pull the unstable branch and got the error

fatal: Remote branch unstable not found in upstream origin

Have the changes from the unstable branch been rolled into the master branch?

@piedar
Copy link
Contributor

piedar commented Nov 17, 2014

@dansupergameprogrammer
Yes, wizgrav's fix was merged to master before the unstable branch was deleted.

@dansupergameprogrammer
Copy link

Yes, awesome, thanks!

I was able to pull the build down with Homebrew using the --HEAD command and it works, the only driver I've found which does.

Now to write a Unity wrapper...

yarikoptic added a commit to yarikoptic/libfreenect that referenced this issue Feb 14, 2015
libfreenect v0.4.0 Oracle

* tag 'v0.4.0':
  Update for v0.4.0
  All headers (including libfreenect.hpp) are installed to `$PREFIX/include/libfreenect/`. All libfreenect files have `#include "libfreenect.h"` rather than `#include <libfreenect.h>`.  This works during build and after installation all include files are in the same directory. Rename libfreenect-audio.h -> libfreenect_audio.h and libfreenect-registration.h -> libfreenect_registration.h.  This makes them consistent with other libraries.
  wrappers/cpp: Call freenect_process_events_timeout in loop to prevent freezes - fixes OpenKinect#223
  OpenNI2-FreenectDriver: Fix silly silly string bugs; improve logging Fix ebuild for filename change
  OpenNI2-FreenectDriver: Convert all printf and cout statements to log messages
  Invoke fwfetcher.py with python2 - fixes OpenKinect#370 Refine README.md
  Remove C99 syntax - fixes OpenKinect#369
  Shiny new README.md Beautify ebuild and add audio USE flag
  Read int from fgetc for EOF comparison - fixes OpenKinect#365
  Replaced missing variable - fixes OpenKinect#366
  Post-merge cleanup
  small changes to allow compile on windows / visual studio
  Removed memset() after free() causing sporadic crashes when unplugging devices
  Fix ebuild
  Supports loading audio fw from memory as well as disk. Supports tilt,accel and led for K4W and 1473 device. Adds keep alive for K4W and 1473. Signed-off-by: Theodore Watson theo@openframeworks.cc (ofTheo)
  This code sets the LED of a 1473 Kinect or K4W Kinect to red on startup. This seems to fix a known issue for OS X users where the device renumerates within a small time period and causes a freeze. Closes OpenKinect#340 and addresses OpenKinect#316. Signed-off-by: Theodore Watson <theo@openframeworks.cc> (ofTheo)
  Remove outdated ebuild
  Add manpages for fakenect and fakenect-record
  Prefix freenect- to the name of the installed demos
  Rename record binary of fakenect as fakenect-record
@leonardodsan
Copy link

Hello,

I'm trying to use a Kinect device 1473 on a CubieTruck board (OS Linaro 12.04), I got the same problem with the official https://github.com/OpenKinect/libfreenect repository of: "Could not open device". Would you like to know the final solution of this topic to solve the problem?

@josuerocha
Copy link

I have the same problem on Ubuntu 16.04 with Kinect v1 1473. Any news upon solving this problem?

@wizgrav
Copy link
Contributor

wizgrav commented Dec 27, 2017

Wow this thread is still alive, that was a good flashback. Without further info from the console I think the first thing to try is checking if permissions are set ok. Try running the app as root. I have recently used the kinect on a raspberry 3 and can confirm that it works ok

@josuerocha
Copy link

@wizgrav did you use the 1473 version?

@wizgrav
Copy link
Contributor

wizgrav commented Dec 27, 2017

@josuerocha I'm not sure to be honest and can't actually check right now, my kinect is in malta and I'm currently in greece for the holidays. It should work though I setup several gigs with kinects and raspberries on my previous employer and I believe at least one of them would be 1473. Have you tried running as root and it didn't work? I have used 1473 in the past on several devices with success

@josuerocha
Copy link

josuerocha commented Dec 27, 2017

Yes. I ran it as root and the same errors persist:

jr@JR-MOBILE:~$ sudo freenect-glview
Kinect camera test
Number of devices found: 1
Found sibling device [same parent]
Failed to set the LED of K4W or 1473 device: -1
Found sibling device [same parent]
Could not open device: -1
Could not open device

@har96
Copy link

har96 commented Feb 27, 2018

Has there been any update on this? I pulled from the master branch and am still getting the same error @josuerocha pasted above. Using a 1473; I've already corrected permissions and such.

@josuerocha
Copy link

@har96 I don't think so. I bought a Kinect 1414 and gave up on 1473 in order to save some project time.

@har96
Copy link

har96 commented Mar 1, 2018

Mine is actually started working. I uploaded the audio.bin firmware and I'm getting the video stream now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests