Skip to content

Commit

Permalink
Merge branch 'fix-uvc-gadget-cant-parse-config-file-with-first-empty-…
Browse files Browse the repository at this point in the history
…line'

1. provide source file of uvc-gadget-server
2. fix uvc_tool.sh to parse config file right
  • Loading branch information
taorye committed Dec 16, 2024
2 parents 5394d82 + 32fedad commit 3ce208e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Binary file not shown.
12 changes: 6 additions & 6 deletions buildroot/board/cvitek/SG200X/overlay/etc/init.d/uvc_tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ parse_uvc_config() {
' "$input_file")
fi

# 如果没有解析到任何数据,或者文件不可读取,则返回默认值 / If no data is parsed or file is unreadable, return default values
if [ -z "$parsed_data" ]; then
echo "Warn: No valid config, using default instead." 1>&2 # 输出到标准错误 / Output to stderr
parsed_data="mjpg 640 360"$'\n'"yuyv 640 360"
fi

# 确保至少包含 'mjpg' 和 'yuyv' 格式 / Ensure at least one 'mjpg' and 'yuyv' format exists
has_mjpg=$(echo "$parsed_data" | grep -w "mjpg")
has_yuyv=$(echo "$parsed_data" | grep -w "yuyv")
Expand All @@ -86,12 +92,6 @@ parse_uvc_config() {
parsed_data="$parsed_data"$'\n'"yuyv 640 360"
fi

# 如果没有解析到任何数据,或者文件不可读取,则返回默认值 / If no data is parsed or file is unreadable, return default values
if [ -z "$parsed_data" ]; then
echo "Warn: No valid config, using default instead." 1>&2 # 输出到标准错误 / Output to stderr
parsed_data="mjpg 640 360"$'\n'"yuyv 640 360"
fi

echo "$parsed_data" # 返回解析的数据 / Return the parsed data
}

Expand Down

0 comments on commit 3ce208e

Please sign in to comment.