@@ -743,14 +743,6 @@ int Camera::Private::isAccessAllowed(State low, State high,
void Camera::Private::disconnect()
{
- /*
- * If the camera was running when the hardware was removed force the
- * state to Configured state to allow applications to free resources
- * and call release() before deleting the camera.
- */
- if (state_.load(std::memory_order_acquire) == Private::CameraRunning)
- state_.store(Private::CameraConfigured, std::memory_order_release);
-
disconnected_.store(true, std::memory_order_relaxed);
}
@@ -935,7 +927,9 @@ const std::string &Camera::id() const
* physical device disconnection. The media device is passed as a parameter.
*
* As soon as this signal is emitted the camera instance will refuse all new
- * application API calls by returning errors immediately.
+ * application API calls by returning errors immediately. The only exception is
+ * the stop() function which must be called on the camera if it was in running
+ * state before, to ensure all resources are released.
*/
Camera::Camera(std::unique_ptr<Private> d, const std::string &id,
@@ -1451,7 +1445,6 @@ int Camera::start(const ControlList *controls)
* running, it is a no-op.
*
* \return 0 on success or a negative error code otherwise
- * \retval -ENODEV The camera has been disconnected from the system
* \retval -EACCES The camera is not running so can't be stopped
*/
int Camera::stop()
@@ -1465,7 +1458,7 @@ int Camera::stop()
if (d->state() != Private::CameraRunning)
return 0;
- int ret = d->isAccessAllowed(Private::CameraRunning);
+ int ret = d->isAccessAllowed(Private::CameraRunning, true);
if (ret < 0)
return ret;