Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

USB Gadget as Camera usb_f_uvc: Invalid argument -22

Featured Replies

 

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

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.