This is on the i.MX6. We've have had some success implementing the webcam gadget in our application, but we don't know how to detect when the device is unplugged from the host.
If the host-side application stops streaming, we can unplug from USB, re-plug in to USB and start streaming again, all without disturbing the main application running in Linux.
The problem occurs if the user disconnects the camera from the host without stopping video and then reconnects and tries to start video streaming again. Our application freezes, and sometimes the kernel crashes. If we had a way to detect that the device is unplugged from the host, we could probably take appropriate action to shut down streaming in an orderly manner. Is there a way to do this?
Thanks very much,