Skip to content

Commit

Permalink
fix: implement stop_server and restrict the server to run only in sta…
Browse files Browse the repository at this point in the history
…ndalone mode.
  • Loading branch information
taorye committed Dec 18, 2024
1 parent 6773bbd commit b2af9af
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions buildroot/board/cvitek/SG200X/overlay/etc/init.d/uvc_tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -242,21 +242,31 @@ case "$1" in
unmount_uvc_configfs
;;
"server")
(
echo "Waiting for UDC start..."
while [ -z "$(cat /sys/kernel/config/usb_gadget/g0/UDC)" ]; do
echo -n "."
sleep 1
done
sleep 3 # necessary delay time
echo -e "\nServer is starting..." # 输出选择了 server 模式 / Output that the server mode is selected
echo -e "===============================\n\n\n"
# 在这里添加你希望在 server 模式下执行的其他操作 / Add other operations you want to perform in server mode here
/etc/init.d/uvc-gadget-server.elf -u /dev/$(basename /sys/class/udc/*/device/gadget/video4linux/video*) -d -i /bin/cat_224.jpg
) >/tmp/uvc-gadget.log 2>&1 &
if [ -z "$(fuser /etc/init.d/uvc-gadget-server.elf)" ]; then
(
echo "Waiting for UDC start..."
while [ -z "$(cat /sys/kernel/config/usb_gadget/g0/UDC)" ]; do
echo -n "."
sleep 1
done
sleep 3 # necessary delay time
if [ -z "$(fuser /etc/init.d/uvc-gadget-server.elf)" ]; then
echo -e "\nServer is starting..." # 输出选择了 server 模式 / Output that the server mode is selected
echo -e "===============================\n\n\n"
# 在这里添加你希望在 server 模式下执行的其他操作 / Add other operations you want to perform in server mode here
/etc/init.d/uvc-gadget-server.elf -u /dev/$(basename /sys/class/udc/*/device/gadget/video4linux/video*) -d -i /bin/cat_224.jpg
else
echo -e "\nServer has started..."
echo -e "===============================\n\n\n"
fi
) >/tmp/uvc-gadget.log 2>&1 &
fi
;;
"stop_server")
fuser -k /etc/init.d/uvc-gadget-server.elf
;;
*)
echo "Usage: $0 {mount <file>|unmount|server}" # 提示正确的使用方式 / Prompt the correct usage
echo "Usage: $0 {mount <file>|unmount|server|stop_server}" # 提示正确的使用方式 / Prompt the correct usage
;;
esac

Expand Down

0 comments on commit b2af9af

Please sign in to comment.