Skip to content

Instantly share code, notes, and snippets.

@kbingham
Created September 26, 2022 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbingham/34664071fcbcf237fce7f2a55f84e7a8 to your computer and use it in GitHub Desktop.
Save kbingham/34664071fcbcf237fce7f2a55f84e7a8 to your computer and use it in GitHub Desktop.
lcdebug - helper to debug libcamera
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Support debugging libcamera commands and applications.
# We default to enabling the most debug
# (that's why we're being used right)
FILTER="*"
LEVEL="0"
STRACE=""
while [[ $# -gt 0 ]]
do
case $1 in
-x)
set -x;
shift;
;;
-s|--strace)
STRACE="strace -e ioctl -f --"
shift;
;;
-f|--filter)
FILTER="$2";
shift; shift;
;;
-l|--level)
LEVEL="$2";
shift; shift;
;;
-h|--help)
echo "The following filters are available:"
git grep "^LOG_DEFINE_CATEGORY" | \
awk -F '[()]' '{print $2}' | \
sort
exit
;;
*|--) # unknown option, The rest belongs to the command
break;
;;
esac
done
LIBCAMERA_LOG_LEVELS=$FILTER:$LEVEL $STRACE "${@}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment