[libcamera-devel,0/4] Introduce UVC hotplug support
mbox series

Message ID 20200506103346.3433-1-email@uajain.com
Headers show
Series
  • Introduce UVC hotplug support
Related show

Message

Umang Jain May 6, 2020, 10:33 a.m. UTC
Hi all,

This is the patch series which introduces support for hotplugging
and hot-unplugging UVC devices (like external webcam) while the
camera-manager is running. The implementation comes with a automated
unit test and qcam integration. To test, simply compile the patch
series, fire up qcam, attach a UVC device and start streaming!

However, while writing the unit-test in order to test this,
I might have uncovered a bug in libcamera which I have not been
able to dig deeper as of now. The unit-test simply bind/unbind a 
available UVC camera to simulate the hotplug/unplug event.
However, while unbinding a camera, I noticed that camera-manager
still keeps around some reference of media-directory(ies) in 
/sys/module/uvcvideo/drivers/usb:uvcvideo/ which makes
the symlinks keep linger around *until* the CameraManager
is stopped. Hence, the test currently has a "restart the
CameraManager" workaround to cleanup symlinks in that sysfs
directory, before cleanly rebinding.

Umang Jain (4):
  libcamera: device_enumerator: Emit a signal when a new device is
    hotplugged
  libcamera: camera_manager: Introduce signals when a camera is
    added/removed
  qcam: main_window: Introduce hotplug support
  tests: Introduce hotplug hot-unplug unit test

 include/libcamera/camera_manager.h        |   4 +
 src/libcamera/camera_manager.cpp          |  47 ++++++-
 src/libcamera/device_enumerator.cpp       |  10 ++
 src/libcamera/include/device_enumerator.h |   3 +
 src/qcam/main_window.cpp                  |  31 +++++
 src/qcam/main_window.h                    |   3 +
 test/hotplug-cameras.cpp                  | 152 ++++++++++++++++++++++
 test/meson.build                          |   1 +
 8 files changed, 249 insertions(+), 2 deletions(-)
 create mode 100644 test/hotplug-cameras.cpp