{"id":15320,"url":"https://patchwork.libcamera.org/api/1.1/patches/15320/?format=json","web_url":"https://patchwork.libcamera.org/patch/15320/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20220201171241.392413-1-kieran.bingham@ideasonboard.com>","date":"2022-02-01T17:12:41","name":"[libcamera-devel,v3] v4l2: Provide libcamerify wrapper script","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"2da117fa0a0c6f75f893c6f53e9dbfb855a1f36a","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15320/mbox/","series":[{"id":2909,"url":"https://patchwork.libcamera.org/api/1.1/series/2909/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2909","date":"2022-02-01T17:12:41","name":"[libcamera-devel,v3] v4l2: Provide libcamerify wrapper script","version":3,"mbox":"https://patchwork.libcamera.org/series/2909/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15320/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15320/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 4C390BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  1 Feb 2022 17:12:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 44F66609DF;\n\tTue,  1 Feb 2022 18:12:46 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 73824609B9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  1 Feb 2022 18:12:44 +0100 (CET)","from Monstersaurus.ksquared.org.uk.beta.tailscale.net\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 06B40332;\n\tTue,  1 Feb 2022 18:12:43 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"JVoVSMhs\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1643735564;\n\tbh=nvrboo63yT2Dgyf886Xkmmf7qA8gEiD75CQWmRqa9pg=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=JVoVSMhsvc0u+0gdwRGVhuXBH9scoOkcAQfuJCunKWyg+jyHaMf8+BXcYNwWzb89J\n\tyTjAX42Sh5gblMn6EIC0d6z7dW3Aiv0ibnAp8Qck+Dw1eylk/zlljCZDj9sHS9dZUu\n\tsFQppmlSqRQe3XBzf75IS89Znaw8xUinpONrlbTk=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Tue,  1 Feb 2022 17:12:41 +0000","Message-Id":"<20220201171241.392413-1-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.32.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3] v4l2: Provide libcamerify wrapper\n\tscript","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Support easier usage of the v4l2 compatibility layer with a script that\nhandles the LD_PRELOAD for applications.\n\nThe wrapper can be prefixed to launch any application with the preload\nset:\n\n $ libcamera-v4l2 v4l2-ctl --list-devices\n \\_SB_.PCI0.GP13.XHC0.RHUB.PRT4- (libcamera:0):\n \t/dev/video0\n\n platform/vimc.0 Sensor B (libcamera:1):\n \t/dev/video2\n \t/dev/video3\n \t/dev/video4\n\nSpecifying '-d' once before the command to run will enable V4L2Compat\nlayer debug output from libcamera.\n\nSpecifying '-d' twice will enable all debug levels from all libcamera\ncomponents and provide a very detailed log for analysis.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n\nv3:\n - Export LD_PRELOAD last.\n - Fix up options parsing style\n - Exit 1 on failure, exit 0 on help.\n - Add license.\n\n\n src/v4l2/libcamerify.in | 47 +++++++++++++++++++++++++++++++++++++++++\n src/v4l2/meson.build    | 14 ++++++++++++\n 2 files changed, 61 insertions(+)\n create mode 100755 src/v4l2/libcamerify.in","diff":"diff --git a/src/v4l2/libcamerify.in b/src/v4l2/libcamerify.in\nnew file mode 100755\nindex 000000000000..c4ea273fa627\n--- /dev/null\n+++ b/src/v4l2/libcamerify.in\n@@ -0,0 +1,47 @@\n+#!/bin/sh\n+# SPDX-License-Identifier: GPL-2.0-or-later\n+\n+help() {\n+\techo \"$0: Load an application with libcamera V4L2 compatibility layer preload\"\n+\techo \" $0 [OPTIONS...] executable [args]\"\n+\techo \" -d, --debug\tIncrease log level\"\n+}\n+\n+debug=0\n+while [ $# -gt 0 ]; do\n+\tcase $1 in\n+\t\t-d|--debug)\n+\t\t\tdebug=$((debug+1))\n+\t\t\t;;\n+\t\t-h)\n+\t\t\thelp;\n+\t\t\texit 0\n+\t\t\t;;\n+\t\t--)\n+\t\t\tshift;\n+\t\t\tbreak;;\n+\t\t-*)\n+\t\t\techo \"Unrecognised option: $1\";\n+\t\t\thelp;\n+\t\t\texit 1\n+\t\t\t;;\n+\t\t*)\n+\t\t\tbreak\n+\t\t\t;;\n+\tesac\n+\tshift\n+done\n+\n+[ $debug -gt 0 ] && loglevel=V4L2Compat:0\n+[ $debug -gt 1 ] && loglevel=0\n+[ \"$loglevel\" != \"\" ] && export LIBCAMERA_LOG_LEVELS=$loglevel\n+\n+if [ \"$LD_PRELOAD\" = \"\" ] ; then\n+   LD_PRELOAD='@LIBCAMERA_V4L2_SO@'\n+else\n+   LD_PRELOAD=\"$LD_PRELOAD \"'@LIBCAMERA_V4L2_SO@'\n+fi\n+\n+export LD_PRELOAD\n+\n+exec \"$@\"\ndiff --git a/src/v4l2/meson.build b/src/v4l2/meson.build\nindex f78497b6799b..07ff9a6939d2 100644\n--- a/src/v4l2/meson.build\n+++ b/src/v4l2/meson.build\n@@ -33,3 +33,17 @@ v4l2_compat = shared_library('v4l2-compat',\n                              install : true,\n                              dependencies : [libcamera_private, libdl],\n                              cpp_args : v4l2_compat_cpp_args)\n+\n+# Provide a wrapper script to support easily loading applications with the V4L2\n+# adaptation layer\n+\n+config_h.set('LIBCAMERA_V4L2_SO', get_option('prefix') / get_option('libdir') / 'v4l2-compat.so')\n+\n+summary({\n+    'LIBCAMERA_V4L2_SO' : config_h.get('LIBCAMERA_V4L2_SO'),\n+}, section : 'Paths')\n+\n+configure_file(input : 'libcamerify.in',\n+               output : 'libcamerify',\n+               configuration : config_h,\n+               install_dir : get_option('bindir'))\n","prefixes":["libcamera-devel","v3"]}