Jump to content

USB Gadget as Camera usb_f_uvc: Invalid argument -22


wuhanstudio

Recommended Posts

Armbianmonitor:

 

Hi, 

 

I was trying to use OrangePi One to add a filter to my USB camera, so that I can apply some image processing to the original input image.

image.png.557a4c0d86464d5f6e63abe62151908a.png

The original project uses raspberrypi: https://github.com/likeablob/rpi-wfh-webcam

 

It captures the image from a USB Camera, then applys some image processing on Raspberry Pi. Lastly, it creates a virtual camera that sends the output image to the PC.

 

spam_s.gif.e0b10f8e8fc8eb630be3492446d17eed.gif

 

I would like to achieve the same effect using OrangePi One (Armbian), and the only problem left is to simulate a virtual camera using the USB Gadget.

 

What I tried:

 

$ sudo modprobe g_webcam

musb-hdrc.4.auto: failed to start g_webcam: -22

 

According to this post, a more preferred way to do this is to use configfs:

 

 

I followed instructions here: 

https://developer.ridgerun.com/wiki/index.php?title=How_to_use_the_UVC_gadget_driver_in_Linux

 

But unfortunately, it returned with the same error: Invalid Argument:
 

sudo modprobe libcomposite dwc2 usb_f_uvc

mkdir -p /sys/kernel/config/usb_gadget/g1
cd /sys/kernel/config/usb_gadget/g1
echo 0x0525 > idVendor
echo 0x0102 > idProduct

mkdir -p strings/0x409
echo 0123456789 > strings/0x409/serialnumber
echo $(hostname) > strings/0x409/manufacturer
echo "UVC Gadget" > strings/0x409/product

mkdir configs/c.1
mkdir configs/c.1/strings/0x409

mkdir functions/uvc.0
mkdir -p functions/uvc.0/streaming/uncompressed/u/360p

cat <<EOF > functions/uvc.0/streaming/uncompressed/u/360p/dwFrameInterval
666666
1000000
5000000
EOF

mkdir functions/uvc.0/streaming/header/h
cd functions/uvc.0/streaming/header/h
ln -s ../../uncompressed/u
cd ../../class/fs
ln -s ../../header/h
cd ../../class/hs
ln -s ../../header/h
cd ../../class/ss
ln -s ../../header/h
cd ../../../control
mkdir -p header/h
ln -s header/h class/fs
ln -s header/h class/ss
cd ../../../

echo 2048 > functions/uvc.0/streaming_maxpacket
ln -s functions/uvc.0 configs/c.1

ls /sys/class/udc > UDC

 

Does this mean the Allwinner H2/H3 USB IP Core does not support g_webcam / usb_f_uvc ?

 

(Both g_serial and g_eth works, but not g_webcam)

Edited by wuhanstudio
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines