From 3b338aa5e759609210079b8883e5a289fb0c1bc0 Mon Sep 17 00:00:00 2001 From: Dafna Hirschfeld Date: Tue, 9 Mar 2021 07:38:27 +0100 Subject: libcamera: media_device: Add hwRevision method Add a method 'hwRevision' to return the info.hw_version reported by the driver. Signed-off-by: Dafna Hirschfeld Reviewed-by: Paul Elder Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- include/libcamera/internal/media_device.h | 2 ++ src/libcamera/media_device.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h index d0459cde..c3292508 100644 --- a/include/libcamera/internal/media_device.h +++ b/include/libcamera/internal/media_device.h @@ -41,6 +41,7 @@ public: const std::string deviceNode() const { return deviceNode_; } const std::string model() const { return model_; } unsigned int version() const { return version_; } + unsigned int hwRevision() const { return hwRevision_; } const std::vector &entities() const { return entities_; } MediaEntity *getEntityByName(const std::string &name) const; @@ -79,6 +80,7 @@ private: std::string deviceNode_; std::string model_; unsigned int version_; + unsigned int hwRevision_; int fd_; bool valid_; diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp index 8987de12..9ec84e56 100644 --- a/src/libcamera/media_device.cpp +++ b/src/libcamera/media_device.cpp @@ -231,6 +231,7 @@ int MediaDevice::populate() driver_ = info.driver; model_ = info.model; version_ = info.media_version; + hwRevision_ = info.hw_revision; /* * Keep calling G_TOPOLOGY until the version number stays stable. @@ -323,6 +324,15 @@ done: * \return The MediaDevice API version */ +/** + * \fn MediaDevice::hwRevision() + * \brief Retrieve the media device hardware revision + * + * The hardware revision is in a driver-specific format. + * + * \return The MediaDevice hardware revision + */ + /** * \fn MediaDevice::entities() * \brief Retrieve the list of entities in the media graph -- cgit v1.2.1