[libcamera-devel] [PATCH] Expose the Request Sequence Number in Python Bindings

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Dec 7 01:54:05 CET 2022


Hi Matthew,

Thank you for the patch.

On Tue, Dec 06, 2022 at 03:29:54PM -0800, Matthew Goodman via libcamera-devel wrote:
> This is a one line change to expose the Request object's sequence number on the
> pybind11 surfaces for use in upstream applications.
> 
> I'm new to this email based approach (let me know if I am doing this right),
> but the associated PR is here:
> https://github.com/kbingham/libcamera/pull/61

You're doing a fairly good job overall :-) A few comments:

- This last paragraph in the commit message shouldn't be part of the
  commit message itself (it shouldn't be recorded in the git history),
  so it should go after the --- line (see [*]).

- Please start the subject line with the correct prefix. You can use git
  log on the file or directory you're modifying to have an idea of what
  the right prefix is.

- Kieran likes to point to https://cbea.ms/git-commit/ as a good source
  of information regarding how to write commit messages (you can ignore
  the "Limit the subject line to 50 characters" rule, that's not
  achievable when adding prefixes). This should tell you that the commit
  message should explain *why* the change is useful, not just what it
  does.

- Please don't post HTML e-mails, especially for patches, that messes up
  the formatting and makes it impossible to apply them correctly. I
  recomment using git-send-email to send patches, it will avoid lots of
  issues with regular e-mail clients (web interfaces are particularly
  ill-suited, they are pretty much guaranteed to mess things up). We
  have a guide to assist configuration of git-send-email if you've never
  used it, you can find it at
  https://libcamera.org/contributing.html#submitting-patches.

The code change itself looks good :-)

> Signed-off-by: Matthew Goodman <matt at exclosure.io>
> ---

[*] here

> diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
> index 75947889..d14e18e2 100644
> --- a/src/py/libcamera/py_main.cpp
> +++ b/src/py/libcamera/py_main.cpp
> @@ -335,6 +335,7 @@ PYBIND11_MODULE(_libcamera, m)
>                 .def_property_readonly("status", &Request::status)
>                 .def_property_readonly("buffers", &Request::buffers)
>                 .def_property_readonly("cookie", &Request::cookie)
> +               .def_property_readonly("sequence", &Request::sequence)
>                 .def_property_readonly("has_pending_buffers", &
> Request::hasPendingBuffers)
>                 .def("set_control", [](Request &self, const ControlId &id,
> py::object value) {
>                         self.controls().set(id.id(), pyToControlValue(value,
> id.type()));

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list