{"id":15321,"url":"https://patchwork.libcamera.org/api/1.1/patches/15321/?format=json","web_url":"https://patchwork.libcamera.org/patch/15321/","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":"<20220201171820.399574-1-kieran.bingham@ideasonboard.com>","date":"2022-02-01T17:18:20","name":"[libcamera-devel,v4] v4l2: Provide libcamerify wrapper script","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"948b62a74a07b3cb70e0d8afc174ae87ead6300f","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/15321/mbox/","series":[{"id":2910,"url":"https://patchwork.libcamera.org/api/1.1/series/2910/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2910","date":"2022-02-01T17:18:20","name":"[libcamera-devel,v4] v4l2: Provide libcamerify wrapper script","version":4,"mbox":"https://patchwork.libcamera.org/series/2910/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15321/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15321/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 B5EF3BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  1 Feb 2022 17:18:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1FE3C609E2;\n\tTue,  1 Feb 2022 18:18:25 +0100 (CET)","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 C3F11609B9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  1 Feb 2022 18:18:23 +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 4B311332;\n\tTue,  1 Feb 2022 18:18:23 +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=\"SmsFxj6h\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1643735903;\n\tbh=kzhMqCTWLbFRRRstZe+yR4YNspAWUnOwMjIE8Sf7bb4=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=SmsFxj6hFDvbA4I83gv1TeJ39O488+9kgdZVRxydi5P63vtv+UBzTwiL9xJ0ab7Jz\n\t+auXnFe6isrTG7tCAIbGlcp2lIyy/lLcmc51OxXE10DWwshv81AOMN/iivaJl3xBqM\n\tqMMxp/vpcQPeE2+OJRdYy2JDNBMa2VvsMUsE7FVc=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Tue,  1 Feb 2022 17:18:20 +0000","Message-Id":"<20220201171820.399574-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 v4] 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---\nv4:\n - Fix up forgotten cleanup in the meson.build and remove path summary.\n\n src/v4l2/libcamerify.in | 47 +++++++++++++++++++++++++++++++++++++++++\n src/v4l2/meson.build    | 11 ++++++++++\n 2 files changed, 58 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..6e587488cd3a 100644\n--- a/src/v4l2/meson.build\n+++ b/src/v4l2/meson.build\n@@ -33,3 +33,14 @@ 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+cdata = configuration_data()\n+cdata.set('LIBCAMERA_V4L2_SO', get_option('prefix') / get_option('libdir') / 'v4l2-compat.so')\n+\n+configure_file(input : 'libcamerify.in',\n+               output : 'libcamerify',\n+               configuration : cdata,\n+               install_dir : get_option('bindir'))\n","prefixes":["libcamera-devel","v4"]}