S55webcam.sh 文件:
#!/bin/sh
echo $"*****************************************"
echo $"*************** webcam *****************"
echo $"*****************************************"
echo $"Usage: $0 $1"
case "$1" in
start)
/usr/local/share/script/usb_webcam.sh start
;;
stop)
/usr/local/share/script/usb_webcam.sh stop
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
esac
exit $?
usb_webcam.sh 文件:
#!/bin/sh
#
# Init S2 WEBCAM...
#
if [ -f /etc/ambarella.conf ]; then
. /etc/ambarella.conf
fi
start()
{
kernel_ver=$(uname -r)
SYS_USB_G_TYPE="webcam"
echo device > /proc/ambarella/usbphy0
#Install USB module
if [ -r /lib/modules/$kernel_ver/kernel/drivers/usb/usb-common.ko ]; then
modprobe usb-common
fi
if [ -r /lib/modules/$kernel_ver/kernel/drivers/usb/core/usbcore.ko ]; then
modprobe usbcore
fi
# if [ -r /lib/modules/$kernel_ver/kernel/drivers/usb/host/ehci-hcd.ko ]; then
# modprobe ehci-hcd
# fi
# if [ -r /lib/modules/$kernel_ver/kernel/drivers/usb/host/ohci-hcd.ko ]; then
# modprobe ohci-hcd
# fi
if [ -r /lib/modules/$kernel_ver/kernel/drivers/usb/gadget/udc-core.ko ]; then
modprobe udc-core
fi
if [ -r /lib/modules/$kernel_ver/kernel/drivers/usb/gadget/ambarella_udc.ko ]; then
modprobe ambarella_udc
fi
if [ -r /lib/modules/$kernel_ver/kernel/drivers/media/v4l2-core/videobuf2-core.ko ]; then
modprobe videobuf2-core
fi
if [ -r /lib/modules/$kernel_ver/kernel/drivers/media/v4l2-core/videobuf2-memops.ko ]; then
modprobe videobuf2-memops
fi
if [ -r /lib/modules/$kernel_ver/kernel/drivers/media/v4l2-core/videobuf2-vmalloc.ko ]; then
modprobe videobuf2-vmalloc
fi
if [ -r /lib/modules/$kernel_ver/kernel/fs/configfs/configfs.ko ]; then
modprobe configfs
fi
if [ -r /lib/modules/$kernel_ver/kernel/drivers/usb/gadget/libcomposite.ko ]; then
modprobe libcomposite
fi
if [ -r /lib/modules/$kernel_ver/kernel/drivers/usb/gadget/g_$SYS_USB_G_TYPE.ko ]; then
modprobe g_$SYS_USB_G_TYPE
fi
}
stop()
{
kernel_ver=$(uname -r)
}
restart()
{
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?