Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UVC gadget driver broken #5520

Closed
folkertvanheusden opened this issue Jun 26, 2023 · 2 comments
Closed

UVC gadget driver broken #5520

folkertvanheusden opened this issue Jun 26, 2023 · 2 comments

Comments

@folkertvanheusden
Copy link
Contributor

folkertvanheusden commented Jun 26, 2023

Describe the bug

There are two userspace packages that exhibit the same problem: as soon as the need to write to /sys/kernel/config/usb_gadget/g1/UDC (e.g. 20980000.usb), the write fails and dmesg shows: UDC core: g1: couldn't find an available UDC or it's busy.

This problem occurs with the latest 6.1 kernel but it may also (unless I made a mistake) happen with 5.15.89.

Steps to reproduce the behaviour

Create a webcam-gadget-service with libusbgx or uvc-gadget.

Device (s)

Raspberry Pi Zero W / WH

System

Raspberry Pi reference 2023-05-03
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 47eee1f0ddcf8811559d51eea1c1bb48335e3e88, stage2

Jan 24 2023 11:44:05
Copyright (c) 2012 Broadcom
version 83c51fe331295bd916eb2edd3efffe2f0ffea946 (clean) (release) (start_x)

Linux raspberrypi 6.1.10+ #1628 Mon Feb 6 19:15:47 GMT 2023 armv6l GNU/Linux

Logs

UDC core: g1: couldn't find an available UDC or it's busy

Additional context

No response

@pelwell
Copy link
Contributor

pelwell commented Jun 26, 2023

Although there may technically be enough information here to allow somebody who was sufficiently motivated to install and configure all the necessary software to reproduce the issue, the lack of step-by-step instructions and test code is makes this problem less attractive than others.

@folkertvanheusden
Copy link
Contributor Author

Although there may technically be enough information here to allow somebody who was sufficiently motivated to install and configure all the necessary software to reproduce the issue, the lack of step-by-step instructions and test code is makes this problem less attractive than others.

git clone https://github.com/peterbay/uvc-gadget/
cd uvc-gadget
make
sudo -i
echo dtoverlay=dwc2 >> /boot/config.txt
echo g_webcam >> /etc/modules
echo dwc2 >> /etc/modules
reboot

Then when the pi has restarted, login and:

cd uvc-gadget
./piwebcam

In the output you will see ls: write error: Device or resource busy. That is caused by: ls /sys/class/udc > /sys/kernel/config/usb_gadget/pi4/UDC.


[several hours later]

Ok found it: altough everywhere on the web it is suggested to install the g_webcam module, you should sudo modprobe usb_f_uvc (and make sure dtoverlay=dwc2 is in /boot/config.txt).
After that the code mentioned works fine. Very much fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants