Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4398

Raspberry Pi OS • Pi Zero 2 W will enumerate with g_ether but not as UVC with configfs

$
0
0
I have the Zero 2 W with the lastest Raspberry Pi OS Lite 64 bit (Debian 12 / Bookwork). Linux raspberrypi 6.6.62+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.62-1+rpt1 (2024-11-25) aarch64 GNU/Linux

I am trying to set up a very basic webcam gadget with the v4l2loopback. My bash script runs without error and dmesg shows the device:

Code:

[  318.839453] v4l2loopback: loading out-of-tree module taints kernel.[  318.840911] v4l2loopback driver version 0.12.7 loaded[  318.989933] configfs-gadget.g1 gadget.0: uvc: uvc_function_bind()[  318.990381] dwc2 3f980000.usb: bound driver configfs-gadget.g1
However, it is not showing up on my Mac as a new USB peripheral. When I list USB devices, nothing is there

I was able to use the same device, cable, port, etc. to get the device to be recognized on my mac as an ethernet USB device by simply updating the /boot/firmware/config.txt (“dtoverlay=dwc2,dr_mode=peripheral” ) adding "“ modules-load=dwc2,g_ether” to /boot/firmware/cmdline.txt and adding both modules to /etc/modules. After a reboot it came up and showed on the Mac.

My script to set up the device as a webcam is below. Any advice appreciated!

Code:

#!/bin/bash# Exit on errorset -e# ----------------------# Initial Setup# ----------------------# # Unload the unneeded video devicesmodprobe -r bcm2835_v4l2modprobe -r bcm2835_codecmodprobe -r bcm2835_isp# This creates the video0 loopback virtual cammodprobe v4l2loopback devices=1 video_nr=0 card_label="VirtualCam" exclusive_caps=1# This creates the /sys/kernel/config/usb_gadget directorymodprobe libcompositemkdir -p /sys/kernel/config/usb_gadget/g1cd /sys/kernel/config/usb_gadget/g1echo 0x0525 > idVendorecho 0xa4a2 > idProductmkdir -p strings/0x409echo 0123456789 > strings/0x409/serialnumberecho raspberrypi > strings/0x409/manufacturerecho UVC Gadget > strings/0x409/productmkdir configs/c.1mkdir configs/c.1/strings/0x409mkdir functions/uvc.0# ----------------------# Create Streaming Frames# ----------------------######################### Create 480p streaming framemkdir -p functions/uvc.0/streaming/uncompressed/u/480pecho 640 > functions/uvc.0/streaming/uncompressed/u/480p/wWidthecho 480 > functions/uvc.0/streaming/uncompressed/u/480p/wHeightecho 614400 > functions/uvc.0/streaming/uncompressed/u/480p/dwMaxVideoFrameBufferSizecat <<EOF > functions/uvc.0/streaming/uncompressed/u/480p/dwFrameInterval333333416667500000666666100000013333332000000EOF# ----------------------# Create mjpeg Frames# ----------------------######################### Create 480p mjepg framemkdir -p functions/uvc.0/streaming/mjpeg/m/480pecho 640 > functions/uvc.0/streaming/mjpeg/m/480p/wWidthecho 480 > functions/uvc.0/streaming/mjpeg/m/480p/wHeightecho 614400 > functions/uvc.0/streaming/mjpeg/m/480p/dwMaxVideoFrameBufferSizecat <<EOF > functions/uvc.0/streaming/mjpeg/m/480p/dwFrameInterval333333416667500000666666100000013333332000000EOF######################### Link headersmkdir functions/uvc.0/streaming/header/hcd functions/uvc.0/streaming/header/hln -s ../../uncompressed/uln -s ../../mjpeg/mcd ../../class/fsln -s ../../header/hcd ../../class/hsln -s ../../header/hcd ../../class/ssln -s ../../header/hcd ../../../controlmkdir header/hln -s header/h class/fsln -s header/h class/sscd ../../../######################### Set maxpacket and link function to configecho 2048 > functions/uvc.0/streaming_maxpacketln -s functions/uvc.0 configs/c.1######################### Bind UDCecho 3f980000.usb > UDCecho "Done"

Statistics: Posted by meydey — Tue Dec 03, 2024 9:44 pm



Viewing all articles
Browse latest Browse all 4398

Trending Articles