OpenNI 2 - Sensor only works once


#1

Environment is Linux x64 Ubuntu 16.0.4.

I can run any of the sample applications one time. After that (whether I exit cleanly from NiViewer with the ESC key or via CTRL+C), I can’t connect to the structure sensor again unless I unplug and replug it. Any ideas? After the first run I always get this:

openDevice failed:
Could not open “1d27/0600@1/16”: Failed to set USB interface

The other strange thing is that I have no /etc/openni2 directory at all. I have run the install script.
Thanks,
Marcus Kestler


#2

@marcus.kestler,

Each executable looks for an OpenNI2/Drivers subdirectory under the current directory when searching for PS1080.ini. For Linux use the following line in PS1080.ini:
UsbInterface=2

The following may also be necessary:

sudo apt-get install freeglut3-dev
sudo ln -s /lib/x86_64-linux-gnu/libudev.so.1.6.4 /lib/x86_64-linux-gnu/libudev.so.0

-Jim


#3

Still seeing the same thing (only works one time without replugging the sensor). I also get the following if I don’t run as root:

Warning: USB events thread - failed to set priority. This might cause loss of data…

This doesn’t prevent the app from running the first time.


#4

Hi Marcus,

Is this in an Ubuntu VM?

-Jim


#5

Hi Jim,
It is a native install.

Thanks


#6

Try running this way, once when it succeeds after re-plug, then once after it fails:

strace -y ./NiViewer

-Jim


#7

Is there a way for me to send you the text files? They are too large to post. I could PDF them but then they are harder to search.


#8

Hi Jim,
I attached the traces. Did see this email initially. Hope it gets routed
to you properly.

Thanks,
Marcus


#9

Marcus,

From the traces it looks like you’ve built OpenNi2 from source. That should be fine, but as a test, could you try installing and running from the pre-built distribution?

http://structure.io/openni

Also, here are updated instructions for Linux (tested on Ubuntu 16.04) pertaining to the pre-built distribution:

  • Execute sudo ./install.sh from the installation directory
  • Edit PS1080.ini in the OpenNi2/Drivers subdirectory of /Tools and /Samples/Bin and remove the semicolon from the beginning of the line specifiying the USB Interface. For Linux this should be: UsbInterface=2
  • Execute the following commands:
    sudo apt-get install freeglut3-dev
    sudo ln -s /lib/x86_64-linux-gnu/libudev.so.1.6.4 /lib/x86_64-linux-gnu/libudev.so.0

Thanks,

Jim


#10

Hi Jim,
Slightly different behavior. Instead of not being able to open the device, I get a transfer timeout the 2nd time I run it. Unplug/plug fixes it like before.
Message is:
Warning: USB events thread - failed to set priority. This might cause loss of data…
openDevice failed:
Could not open “1d27/0600@1/10”: USB transfer timeout!

Press any key to continue . . .


#11

Please post the output of:
lsusb -v -d 1d27:0600

Also, you’ve probably tried a different USB port? Would it be possible to try this on a different Ubuntu box?

-Jim


#12

Same behavior on different ports. I don’t have another ubuntu box right now.
Here is the output of lsusb -v -d …
Bus 001 Device 011: ID 1d27:0600 ASUS
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x1d27 ASUS
idProduct 0x0600
bcdDevice 0.01
iManufacturer 1 Occipital
iProduct 2 Structure Sensor
iSerial 3 42135
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 4 Occipital Config
bmAttributes 0x80
(Bus Powered)
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 1
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
bNumConfigurations 1
Device Status: 0x0000
(Bus Powered)


#13

Hi Jim,
I’ve been working on this and found a solution on my system. I’m not sure if this is generally viable, so it may be worth testing the code on systems like this.
I went in to the bios and disabled Enable Legacy USB Support. Now the device works properly. Maybe the dev team should look in to BIOS’ with that setting? Mine is an MSI Workstation laptop. I also applied the latest BIOS update, but it did not work until legacy support was turned off.
General info on the hardware is here:


I’ll be glad to test out any fixes/patches.
Thanks,
Marcus


#14

I take that back. It seems to have reverted to it’s old behavior. Kind of seems like a race condition perhaps? It worked a few times in a row, but now it is back to every other time.