USB camera recovery issue with intermittent connection issue

I am currently running into an issue that camera has intermittent usb connection issue due to its rough work environment. At the beginning, camera is working well. However, when usb connection got lose, TX would fail to recognize the device (/dev/video1), and even after the connection comes back. The only way to recover is to reboot TX2 reboot in order for camera to work again. I have tried to reset usb driver with ioctl(fd, USBDEVFS_RESET, 0) when the issue occurs but it doesn’t help. Is there a way to recover the camera detection without rebooting TX2? Thanks

USB is hotplug, so if you have physical access you can unplug/replug. If not, then you might be out of luck.

However…and someone else may know the answer to this…sometimes hotplug redetect can be forced by an echo into one of the “/sys” files. I don’t know if this is the case for you, but someone else may know which echo would accomplish this via echo.

If you post the “lsusb -t” content and say which of the devices is the camera in question, then this would probably help for anyone answering the "echo to “/sys” possibility (different root HUBs would use different files in “/sys”).

lsusb -t does give information about the devices on USB ports. In my case, when camera usb3 connection is intermittent, even when the connection is good again, lsusb doesn’t see the device until the next unplug and plug. Still searching for solution.

It’s hard to say, but one area of weakness in USB which I can think of is that not all drivers respond correctly to sleep or suspend states. Those drivers tend to go to sleep, but not wake backup. You could disable USB autosuspend and see if issues go away.

I’m not positive, but I believe autosuspend can still be added on a TX2 in the “/boot/extlinux/extlinux.conf” (I could be wrong, but it wouldn’t hurt to test). In extlinux.conf append this to the space delimited “APPEND” key/value pair: " usbcore.autosuspend=-1".

When booted you should see “usbcore.autosuspend=-1” somewhere in “cat /proc/cmdline”. If things work without failure, then it is a sign that one of the drivers isn’t handling power suspend and wake correctly.