I’ll give an observation which is the core of why I believe this fails, and then go through the long list of what I went through to find it (though I was unable to find a workaround).
OpenNI has some sample programs. One of them is “SimpleRead”. SimpleRead works great, but only when run as root. I don’t know if SimpleRead reads or writes a device special file (I know nothing about OpenNI, nor do I know what the USB hotplug creates when the XtionPro is plugged in), but somewhere is something requiring root permissions to function. The failure comes from OpenNI not allowing access when run through OpenCV…presumably running vid_proc as root should work around permissions, but for whatever reason, root permissions are not inherited as expected.
For reference, when SimpleRead fails for lack of permissions, this is the identifier of the device which apparently requires root:
Couldn't open device
Could not open "1d27/0601@1/8": Failed to open the USB device!
I can verify the OpenCV “open” command does not find anything with either argument “CV_CAP_OPENNI_ASUS” nor with “CV_CAP_ANY” (it seems OpenCV does not believe any OpenCV capable devices exist). I do not have the OpenCV library itself set up for debug so the gdb did not say anything about why no device is found (gdb always fails in “events.c”, but there is so much linked in I don’t know which events.c is being complained about for lack of debugging symbols). Whatever stage has a permissions issue can’t be tracked through gdb.
dmesg was not interesting (audio can be ignored for this purpose). Connecting the device validates that up to the USB part things work as they should:
[ 1769.461865] tegra-xhci tegra-xhci: Firmware timestamp: 2014-09-16 02:10:07 UTC, Falcon state 0x20
[ 1769.807150] usb 1-3: new high-speed USB device number 8 using tegra-xhci
[ 1769.845533] usb 1-3: New USB device found, idVendor=1d27, idProduct=0601
[ 1769.845748] usb 1-3: New USB device strings: Mfr=5, Product=4, SerialNumber=0
[ 1769.845912] usb 1-3: Product: PrimeSense Device
[ 1769.846048] usb 1-3: Manufacturer: PrimeSense
[ 1770.111616] usb_audio: Warning! Unlikely big volume range (=4181), cval->res is probably wrong.
[ 1770.111714] usb_audio:  FU [Mic Capture Volume] ch = 2, val = 0/12544/3usb_audio: Warning! Unlikely big volume range (=4181), cval->res is probably wrong.
[ 1770.123429] usb_audio:  FU [Mic Capture Volume] ch = 1, val = 0/12544/3
strace was mostly not useful, but “sort of” implies that the USB did its job and the driver for the ASUS XtionPro LIVE does not respond as having any OpenCV-capable device (and explicitly does not have the CV_CAP_OPENNI_ASUS device). This makes me believe OpenCV relies on OpenNI and the issue is within the OpenNI software, which I know very little about. Unfortunately I could not see a system call blocked from permissions (more likely it was a library call which doesn’t forward the permissions issue other than to say “it don’t work”).
Going back to OpenNI, this is when I found out the SimpleRead sample program only works when run as root. I also noted that running your test program “vid_proc” as root does not work around the issue.
Someone who knows more about OpenNI and OpenCV will need to figure out how to either (A) get OpenCV to be able to call OpenNI with root permissions, or (B) get OpenNI to work as non-root. This latter might be a part of udev rules which is easily changed, but I don’t know what the XtionPRO device files are (if you know the name of the device special files you can use udev rules to modify permissions).
For reference, here is that URL again on OpenNI2 install: