RK3588 usb otg口实现UVC gadget,作为usb camara向windows 传输图像

1、打开内核相关配置

  CONFIG_VIDEO_V4L2_SUBDEV_API=y

  CONFIG_MEDIA_USB_SUPPORT=y

  CONFIG_MEDIA_CONTROLLER=y

  CONFIG_USB_VIDEO_CLASS=y

  CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y

 

  CONFIG_V4L_PLATFORM_DRIVERS=y

  CONFIG_MEDIA_CAMERA_SUPPORT=y

  CONFIG_VIDEO_DEV=y

  CONFIG_USB_CONFIGFS_F_UVC=y

 

2、安装uvc-gadget

  git clone https://git.ideasonboard.org/uvc-gadget.git/
  cd uvc-gadget
  git checkout v0.1.0 //最新0.3.0版本依赖libcamara,回退到0.1.0


  sudo apt-get update
  sudo apt-get install build-essential
  sudo apt install python3-pip
  sudo pip3 install meson==0.63
  sudo pip3 install ninja

  meson build
  ninja -C build

3.修改uvc-gadget/scripts/uvc-gadget.sh脚本
  diff --git a/scripts/uvc-gadget.sh b/scripts/uvc-gadget.sh
  index dceecd9..3476da0 100755
  --- a/scripts/uvc-gadget.sh
  +++ b/scripts/uvc-gadget.sh
  @@ -176,7 +176,10 @@ case "$1" in
  echo "Creating the USB gadget"
  #echo "Loading composite module"
  #modprobe libcomposite
  -
  +
  + umount /sys/kernel/config
  + mount -t configfs none /sys/kernel/config
  +
  echo "Creating gadget directory g1"
  mkdir -p $GADGET/g1

4、关闭系统自带usb adb,然后重启
  sudo systemctl disable usbdevice

5、测试uvc功能
  ①进入...uvc-gadget/scripts 目录
  sudo ./uvc-gadget.sh start

  ②进入....uvc-gadget/build/src
  sudo ./uvc-gadget -c /dev/videoxx              //videoxx为插入的usb摄像头的设备节点,###### windows主机 bus hound会探测到UVC camara,用AMCap可以看到摄像头图像

 

posted on 2024-02-27 15:48  lancer_hou  阅读(1660)  评论(1编辑  收藏  举报

导航