diff --git a/src/v4l2/MediaControl.cpp b/src/v4l2/MediaControl.cpp index 807d4f4bf..e94d6560a 100644 --- a/src/v4l2/MediaControl.cpp +++ b/src/v4l2/MediaControl.cpp @@ -1162,9 +1162,11 @@ int MediaControl::getI2CBusAddress(const string& sensorEntityName, const string& } } - // entityName example: "imx319 10-0010", sensorEntityName example: "imx319" - if (entityName && (strlen(entityName) > (sensorEntityNameLen + 1U))) { - *i2cBus = entityName + sensorEntityNameLen + 1; + // VIDEO_PIXEL_ARRAY is the sensor entity. Find it through the topology, + // matching this specific candidate's exact name instead of the shared + // name prefix, since multiple sensor instances (e.g. wf/uf) can share it. + if (checkHasSource(sinkEntity, std::string(entity.info.name))) { + *i2cBus = entity.info.name + sensorEntityPrefix.length(); LOG1("i2cBus is %s", i2cBus->c_str()); return OK; }