[v3,0/2] libcamera: camera_manager: Non-fatal duplicate id detection
mbox series

Message ID 20261029-kbingham-duplicate-id-v3-0-0a6537277d50@ideasonboard.com
Headers show
Series
  • libcamera: camera_manager: Non-fatal duplicate id detection
Related show

Message

Kieran Bingham Oct. 29, 2026, 4:06 p.m. UTC
We face bug reports from users [0] where real life situations will currently
create a duplicate camera id, and we do not currently have a good
solution to identify a unique path for these devices.

[0] https://gitlab.freedesktop.org/camera/libcamera/-/work_items/303

We could look later to see if we create a sequential number to append to
these devices but for the moment lets make sure we don't crash users
systems with an assert.

Following a request from v1, I've now added a unit test which constucts
a test pipeline handler that can be instantiated multiple times to
validate the same code paths internally.

As an example: Running this test manually/explicitly produces:

```
kbingham@Monstersaurus:~/iob/libcamera/libcamera$ meson compile -C ./build/gcc test/pipeline/duplicate_camera_id && ./build/gcc/test/pipeline/duplicate_camera_id
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /usr/bin/ninja -C /home/kbingham/iob/libcamera/libcamera/build/gcc test/pipeline/duplicate_camera_id
ninja: Entering directory `/home/kbingham/iob/libcamera/libcamera/build/gcc'
[6/6] Linking target test/pipeline/duplicate_camera_id
[416:35:41.396354924] [1267705]  INFO Camera camera_manager.cpp:340 libcamera v0.7.2+209-ba3a4e35-dirty (2026-10-29T15:56:57GMT)
[416:35:41.397117370] [1267708]  INFO IPAManager ipa_manager.cpp:147 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/libcamera/build/gcc/src/ipa' to the IPA search path
[416:35:41.417150821] [1267708]  INFO Camera camera_manager.cpp:223 Adding camera 'NotVeryUniqueCameraId' for pipeline handler test
[416:35:41.417756261] [1267705]  INFO Camera camera_manager.cpp:340 libcamera v0.7.2+209-ba3a4e35-dirty (2026-10-29T15:56:57GMT)
[416:35:41.418159000] [1267709]  INFO IPAManager ipa_manager.cpp:147 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/libcamera/build/gcc/src/ipa' to the IPA search path
[416:35:41.432221038] [1267709]  INFO Camera camera_manager.cpp:223 Adding camera 'NotVeryUniqueCameraId' for pipeline handler test
[416:35:41.432250143] [1267709] ERROR Camera camera_manager.cpp:213 Trying to register a camera with a duplicated ID 'NotVeryUniqueCameraId'
[416:35:41.432279178] [1267709] ERROR Camera camera_manager.cpp:213 Trying to register a camera with a duplicated ID 'NotVeryUniqueCameraId'
```

And we can see the duplicate cameras are 'successfully' ignored.

--
Kieran

---
Kieran Bingham (2):
      libcamera: camera_manager: Non-fatal duplicate id detection
      test: pipeline: Add a duplicate camera construction test

 src/libcamera/camera_manager.cpp      |   2 +-
 test/meson.build                      |   1 +
 test/pipeline/duplicate_camera_id.cpp | 190 ++++++++++++++++++++++++++++++++++
 test/pipeline/meson.build             |  14 +++
 4 files changed, 206 insertions(+), 1 deletion(-)
---
base-commit: 212c689fcf2450bbfbaab25c7472895ac277b5d6
change-id: 20261028-kbingham-duplicate-id-cc835ed0846a

Best regards,