Closed azalac closed 4 years ago
Hi @azalac In situations where the camera can no longer be detected and hardware_reset() does not solve the problem, some RealSense users have solved the problem by resetting the entire USB port with an Ubuntu script instead of just resetting the camera. I recommend googling for ubuntu usb reset script for research leads.
The link below has an example of a USB port reset project that a RealSense user developed.
https://github.com/IntelRealSense/librealsense/issues/2161#issuecomment-587457793
Another RealSense user with camera enumeration problems greatly improved reliability by using industrial grade USB cables.
https://github.com/IntelRealSense/librealsense/issues/2741#issuecomment-548914984
If a program uses set_real_time in the False state then it may also be more prone to issues when stopping the pipeline, whereas such errors are less likely to occur if set_real_time is set to True. Here is an example:
Hi @MartyG-RealSense, I believe there may be additional variables in this issue, but I'm not able to determine them. I tried reproducing the issue manually, and I wasn't able to do it. After using a script to start my python script and kill it repeatedly I was able to reproduce it, but only after quite a few runs.
Ultimately, I got this error:
RuntimeError: set_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: Connection timed out
With this kernel message repeated many times:
[57075.652123] uvcvideo: Failed to query (SET_CUR) UVC control 1 on unit 3: -110 (exp. 1024).
This is the output from the usb reset script (I didn't realize I had to run as root, but I reran it as root after):
001 002 003 004
::::: > found camera at bus: 002 port: 004
Resetting USB device /dev/bus/usb/002/004
Error in ioctl: No such device
::::: > reset 002 004 with cpp ioctl
::::: > unload driver
rmmod: ERROR: ../libkmod/libkmod-module.c:793 kmod_module_remove_module() could not remove 'uvcvideo': Operation not permitted
rmmod: ERROR: could not remove module uvcvideo: Operation not permitted
::::: > reload driver
Curiously, the camera was still on lsusb before running this script. After running the script, the camera was no longer on lsusb.
Here's the most interesting logs from dmesg after running the script:
[57366.189379] uvcvideo: Unknown video format 36315752-1a66-a242-9065-d01814a8ef8a
[57366.189384] uvcvideo: Found UVC 1.50 device Intel(R) RealSense(TM) Depth Camera 415 (8086:0ad3)
[57366.189388] uvcvideo: Failed to query (GET_INFO) UVC control 2 on unit 6: -19 (exp. 1).
[57366.189391] uvcvideo: Failed to query (GET_INFO) UVC control 3 on unit 6: -19 (exp. 1).
[57366.189394] uvcvideo: Failed to query (GET_INFO) UVC control 4 on unit 6: -19 (exp. 1).
[57366.189397] uvcvideo: Failed to query (GET_INFO) UVC control 2 on unit 7: -19 (exp. 1).
[57366.189399] uvcvideo: Failed to query (GET_INFO) UVC control 3 on unit 7: -19 (exp. 1).
[57366.189402] uvcvideo: Failed to query (GET_INFO) UVC control 6 on unit 7: -19 (exp. 1).
[57366.189405] uvcvideo: Failed to query (GET_INFO) UVC control 7 on unit 7: -19 (exp. 1).
[57366.189408] uvcvideo: Failed to query (GET_INFO) UVC control 8 on unit 7: -19 (exp. 1).
[57366.189411] uvcvideo: Failed to query (GET_INFO) UVC control 9 on unit 7: -19 (exp. 1).
[57366.189414] uvcvideo: Failed to query (GET_INFO) UVC control 10 on unit 7: -19 (exp. 1).
[57366.189417] uvcvideo: Failed to query (GET_INFO) UVC control 1 on unit 7: -19 (exp. 1).
[57366.189419] uvcvideo: Failed to query (GET_INFO) UVC control 4 on unit 7: -19 (exp. 1).
[57366.189421] uvcvideo: Failed to query (GET_INFO) UVC control 5 on unit 7: -19 (exp. 1).
[57366.189423] uvcvideo: Failed to query (GET_INFO) UVC control 11 on unit 7: -19 (exp. 1).
[57366.194663] uvcvideo: UVC non compliance - GET_DEF(PROBE) not supported. Enabling workaround.
[57366.194665] uvcvideo: Failed to query (129) UVC probe control : -19 (exp. 48).
[57366.194667] uvcvideo: Failed to initialize the device (-5).
[57366.392762] usb 2-3: new SuperSpeed Gen 1 USB device number 5 using xhci_hcd
[57371.652151] usb 2-3: device descriptor read/8, error -110
[57371.759968] usb 2-3: new SuperSpeed Gen 1 USB device number 5 using xhci_hcd
[57377.028105] usb 2-3: device descriptor read/8, error -110
[57377.360750] usb 2-3: new SuperSpeed Gen 1 USB device number 6 using xhci_hcd
[57382.404155] usb 2-3: device descriptor read/8, error -110
[57382.511967] usb 2-3: new SuperSpeed Gen 1 USB device number 6 using xhci_hcd
[57387.780128] usb 2-3: device descriptor read/8, error -110
[57387.916021] usb usb2-port3: attempt power cycle
[57388.844770] usb 2-3: new SuperSpeed Gen 1 USB device number 7 using xhci_hcd
[57393.924155] usb 2-3: device descriptor read/8, error -110
[57394.031977] usb 2-3: new SuperSpeed Gen 1 USB device number 7 using xhci_hcd
[57399.300110] usb 2-3: device descriptor read/8, error -110
[57399.632754] usb 2-3: new SuperSpeed Gen 1 USB device number 8 using xhci_hcd
[57404.676151] usb 2-3: device descriptor read/8, error -110
[57404.783970] usb 2-3: new SuperSpeed Gen 1 USB device number 8 using xhci_hcd
[57410.052117] usb 2-3: device descriptor read/8, error -110
[57410.192025] usb usb2-port3: unable to enumerate USB device
I'm fairly sure the usb reset script misreported the usb port, because the camera was plugged into 2:3, not 2:4. Hopefully it reset the correct port.
I'm using the cable that comes with the camera, should I still find a better cable? The camera seems to be pretty reliable when running, but I can get a better cable if needed.
I'm not setting real_time to False, I don't think this is related to the last issue you mentioned.
Thank you for the help.
For most situations, using the official cable supplied with the camera is ideal because it has been validated by Intel for use with RealSense cameras and is high quality and very reliable.
For longer cables, the data sheet document for the 400 Series cameras officially recommends Newnex as a supplier of high-grade cable products that have been tested with RealSense.
https://www.newnex.com/realsense-3d-camera-connectivity.php
When you say that the script runs for "many hours" in your opening message, roughly how long is this please? In a long-run of a RealSense 400 Series camera, so long as the camera remains within recommended temperature tolerances then it should be able to run indefinitely. If a problem does occur in a long-run, it may typically appear after 3 to 4 days and be related to a problem in the USB system (the cable or the port), or a glitch with the computer hardware or the computer's operating system.
Hi @azalac Do you still reuire assistance with this case, please? Thanks!
Case closed due to no further comments received.
Issue Description
I have a python script that I'm using to process the output of the camera. Since this script is still in development, it occasionally hard crashes (seg faults, when I sigkill it due to freezes, etc). After doing this a few times (3-4), my D415 stops connecting to my PC entirely, forcing me to reboot to fix it. I've previously used a D435, and I still had the issue. Unfortunately, I don't have access to the D435 anymore, so I won't be able to use it.
I've tried unplugging the camera, and plugging it back in, but that doesn't fix anything. I can't send a hardware reset to the camera, since it's not even detected in lsusb.
I don't believe this is a power issue. I can run the script for many hours without issue. The only time this occurs is after my script crashes, and the pipelines don't get closed properly.
Looking at dmesg, it seems like there's a driver issue. I've tried reloading the uvcvideo kernel module, but it didn't have any effect. I've also tried to disable and re-enable the entire hub, but it only caused the hub to stop working properly.
Here's the relevant parts from dmesg:
I'm not sure if the 'Failed to query' errors are normal - I get many of them even when the camera's working properly.
During this specific issue, I didn't re-plug the camera before reloading the uvcvideo module, but I've done it in the past and it's had no effect. After re-plugging it, I just get lots of 'new device / device read error' messages in dmesg before I finally get an 'unable to enumerate' error.
I've had this issue countless times (at least 10 times by now), so I've looked at a lot of usb related realsense issues but I haven't found any that are similar to my issue. Any help would be greatly appreciated.