{"id":18668,"url":"https://patchwork.libcamera.org/api/patches/18668/?format=json","web_url":"https://patchwork.libcamera.org/patch/18668/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230530144719.2711-1-laurent.pinchart@ideasonboard.com>","date":"2023-05-30T14:47:19","name":"[libcamera-devel] android: mm: Stub libhardware for build tests","commit_ref":"b9ecd85ed1fee2e9d715368b24592ad3009131d8","pull_url":null,"state":"accepted","archived":false,"hash":"5110edb529ac3bc288e890c60624804f021573a1","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18668/mbox/","series":[{"id":3895,"url":"https://patchwork.libcamera.org/api/series/3895/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3895","date":"2023-05-30T14:47:19","name":"[libcamera-devel] android: mm: Stub libhardware for build tests","version":1,"mbox":"https://patchwork.libcamera.org/series/3895/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18668/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18668/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 760DFC31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 May 2023 14:47:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E36EE60599;\n\tTue, 30 May 2023 16:47:21 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5B1B260595\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 May 2023 16:47:20 +0200 (CEST)","from pendragon.ideasonboard.com (om126205198071.34.openmobile.ne.jp\n\t[126.205.198.71])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4A0DD7EC;\n\tTue, 30 May 2023 16:46:57 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1685458041;\n\tbh=GQdFD88xUq9wH23d+1rHaHWsPWIJlDpej2LH1hNW/N8=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=W+noEERfGS6nBdhd49iFZ7trkNvOyz1LKmANnyH/9zoAZxY42Y1M0s3SF0om+uHzz\n\tsLHBvFfJwoWGAzVQCZ/Vd5LX6oPjHL40AzvHkxh7YhGyu+w+bLkHxn/A2gjb3YrC0T\n\tObCu8MWqdzfBAV8uXH3PIAxvsplhNyzQeMulfZ7fkHQxTpcFUJCTA0uEM/SOy2RMI8\n\tlieUgre5n/L/yt9zYk1LcuUZUET6L7IhfKuPQ6sHfe060yelWMCq/wpvKBBghrQvSI\n\tn5xZ2Dh49cCAuA2nLqgaApNKuCrj/eK/RxFDZiyfu88AxFNwXkdLihHBb9bwgcP59i\n\t34kBwElE129wA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1685458019;\n\tbh=GQdFD88xUq9wH23d+1rHaHWsPWIJlDpej2LH1hNW/N8=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=epIIjs9M4el6cKL7DPortTY4acQM+mP/cVOeb6sCXT3YNk3CsS+ice86ZMafOyuvG\n\tjlVfgE13+L5Bzap9pXdZV8OuYlgtwu+0lshgmfWsK7HaT4NuLZLiO0mOGnNh1UgTC1\n\tLtNW6qFH//7xRYIlam/lvCII/emjc8r6vvTc9qbo="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"epIIjs9M\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 30 May 2023 17:47:19 +0300","Message-Id":"<20230530144719.2711-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.39.3","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] android: mm: Stub libhardware for build\n\ttests","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Commit 66c618f378aa (\"android: mm: generic: use\nGRALLOC_HARDWARE_MODULE_ID\") made libhardware a required dependency for\nthe Android camera HAL on non-Chrome OS platforms. This isn't an issue\nfor real devices, as Android provides libhardware, but it prevents\ncompile-testing the camera HAL on traditional Linux systems.\n\nTo restore the compile-test coverage, stub the libhardware function used\nby the camera HAL when libhardware isn't found.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/android/mm/libhardware_stub.c | 17 +++++++++++++++++\n src/android/mm/meson.build        | 12 ++++++++----\n 2 files changed, 25 insertions(+), 4 deletions(-)\n create mode 100644 src/android/mm/libhardware_stub.c\n\n\nbase-commit: 76e1cb9f7176b4e7a935295d4e633ee24a0fef67\nprerequisite-patch-id: 2e7126df41498860ace9c0cd6b1e2ed748bac2f9","diff":"diff --git a/src/android/mm/libhardware_stub.c b/src/android/mm/libhardware_stub.c\nnew file mode 100644\nindex 000000000000..00f15cd90cac\n--- /dev/null\n+++ b/src/android/mm/libhardware_stub.c\n@@ -0,0 +1,17 @@\n+/* SPDX-License-Identifier: Apache-2.0 */\n+/*\n+ * Copyright (C) 2023, Ideas on Board\n+ *\n+ * libhardware_stub.c - Android libhardware stub for test compilation\n+ */\n+\n+#include <errno.h>\n+\n+#include <hardware/hardware.h>\n+\n+int hw_get_module(const char *id __attribute__((__unused__)),\n+\t\t  const struct hw_module_t **module)\n+{\n+\t*module = NULL;\n+\treturn -ENOTSUP;\n+}\ndiff --git a/src/android/mm/meson.build b/src/android/mm/meson.build\nindex 85f12f910198..e3e0484c3720 100644\n--- a/src/android/mm/meson.build\n+++ b/src/android/mm/meson.build\n@@ -4,10 +4,14 @@ platform = get_option('android_platform')\n if platform == 'generic'\n     android_hal_sources += files(['generic_camera_buffer.cpp',\n                                   'generic_frame_buffer_allocator.cpp'])\n-    android_deps += [\n-        libdl,\n-        dependency('libhardware'),\n-    ]\n+    android_deps += [libdl]\n+\n+    libhardware = dependency('libhardware', required : false)\n+    if libhardware.found()\n+        android_deps += [libhardware]\n+    else\n+        android_hal_sources += files(['libhardware_stub.c'])\n+    endif\n elif platform == 'cros'\n     android_hal_sources += files(['cros_camera_buffer.cpp',\n                                   'cros_frame_buffer_allocator.cpp'])\n","prefixes":["libcamera-devel"]}