Skip to content

cameraif.available() always returns True #1

Description

@cursor

What is wrong

cameraif.available() is exported as a capability probe, but the implementation is a constant:

static mp_obj_t cameraif_available(void) {
    return mp_const_true;
}

A probe that cannot fail is not a probe. Code that branches on available() before constructing a Camera will always take the camera path, including on firmware built without a sensor driver or on a board with no CSI.

What it should mean

Either:

  • return whether this firmware was built with at least one CONFIG_CAMERA_* driver linked and the CSI controller is present, or
  • be removed from the public surface until it can tell the truth.

Why it surfaced

The examples catalog work needed a honest "does this board have a camera?" check. board_config.camera already raises usefully; available() does not add anything until it can fail.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions