Skip to content

Raspberry Pi Zero W support with Buster Lite Aug 2020 release #2

@jasonmnemonic

Description

@jasonmnemonic

Hi Kieran,

sorry for getting back to you a bit later than I would but I am happy that I have someone to talk to in figuring this out and I appreciate your time and community support. Just to let you know that I am OK with C++ (and C) but I am not a Linux expert so I do have my oddities where I think I may have done something incorrect but do let me know and point the way; I am more than happy to learn :-)

Also some context in why I am here. I have been trying to have the 4K Pi Camera V2 to stream from the Pi to a Windows10 PC like a webcam and I realised that there is this USB OTG where I can configure the Pi to become gadget(s). To start off with, I learned the various configurations from https://github.com/wlhe/uvc-gadget and https://github.com/climberhunt/uvc-gadget but could only tinker to get climberhunt's fork to work for me. That's where I started to get confused and also understand a bit more of what is going on... Anyway, I have been trying to configure a UVC webcam and a RNDIS gadget which somehow do not want to work with each other -- UVC fails but RNDIS works; more of this in raspberrypi/linux#3965 and that's when I thought it would be nice to understand the work of ideas-on-board and appreciate whats is going on so I can also help figure some issues and hopefully get somewhere in contributing to this; see https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=148361#p1650763 which I see you have also participated in.

But for now, I am interested in getting a RPI0W with Buster Lite Aug 2020 to run this uvc-gadget from you (or Ideas-on-board or Laurent's repository git://git.ideasonboard.org/uvc-gadget.git) which I see to have issues building and running. I got somewhere at the end with David's (climberhunt's) fork but this original fork has more updates. Hopefully, with this conversation/discussion, I can learn more about how stuff works which I appreciate! :-)

OK, from climberhunts, I have the uvc-gadget built and then modified the multi-gadget.sh to be loaded by systemd so that a UVC Camera and RNDIS gadget can be seen in Windows Device Manager but it does not work; so when I setup as a UVC Camera standalone, it works. Based on the experience there, I understand that UVC is a video standard that allows e.g. Windows to see it as a USB streaming device and this uvc-gadget code takes a capture video from Pi Camera via v4l2 and redirects it to UVC output to Windows so Skype can see the camera video feed.

With this same configuration as a standalone uvc-gadget with multi-gadget.sh that I have so far (here is where I have a feeling it is the wrong configuration); the Laurent's uvc-gadget does not work for me. Here is what I have done.

  1. Download uvc-gadget git repository from here (which mirrors Laurent's?). Follow the cmake and make instructions so I have the uvc-gadget ELF binary.

  2. Copy uvc-gadget binary to where my boot script's multi-gadget.sh (climberhunts) refers to this binary. I have a look at your ./scripts/uvc-gadget.sh which I thought of initially using but not sure if I can use it as it seems that it is not for the Pi (I think).

  3. At this point, my Pi is configured to have UVC Camera and it is configured using ConfigFS similar to climberhunt's example. My RPI0W has /dev/video0, /dev/video1 and (/dev/video10, 11, 12, 13, 14, 15, 16; cannot remember why) but only /dev/video0 is the one that does v4l2 video capture and /dev/video1 is the UVC output.

So in climberhunt's script, it would be the binary is started as sudo /home/pi/uvc-gadget/uvc-gadget -f1 -s2 -r1 -u /dev/video1 -v /dev/video0 where -u device is UVC Video Output device and -v device is V4L2 Video Capture device and his script captures at 1920x1080.

My gadget's ConfigFS paths are /sys/kernel/config/usb_gadget/pi4 so I have my ConfigFS paths as

/sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0
/sys/kernel/config/usb_gadget/pi4/configs/c.1
/sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0/control/header/h
/sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0/streaming/mjpeg/
and so on...

  1. At this point, if I do not have uvc-gadget running but I intend to run uvc-gadget, this is what I try to do on the terminal.

This uvc-gadget has the following options:

Available options are
-c device V4L2 source device
-h Print this help screen and exit
-i image MJPEG image

UVC device instance specifier

and I have been trying different things on my terminal and I get:

`~/uvc-gadget $ ./uvc-gadget -c /dev/video0 pi4/functions/uvc.usb0
Error: driver returned invalid frame ival type 2
Error opening device /dev/video0: unable to enumerate formats.

~/uvc-gadget $ ./uvc-gadget -c /dev/video0 functions/uvc.usb0
Failed to identify function configuration

~/uvc-gadget $ ./uvc-gadget -c /dev/video0 uvc.usb0
Error: driver returned invalid frame ival type 2
Error opening device /dev/video0: unable to enumerate formats.

~/uvc-gadget $ ./uvc-gadget -c /dev/video0 g1/functions/uvc.usb0
Failed to identify function configuration
`

what have I done wrong?

PS: at the moment, I cannot seem to get the segmentation fault as I initially mentioned wlhe/uvc-gadget#1. I know over there I have done something wrong as well but here it would be nice if I can get it working for the RPI0W and then ask some questions and pointers on the code since it is quite an interesting piece of work to look at.

So, I guess the above is enough to help us have a conversation and hopefully guide me figure out what I am doing wrongly... Thanks Kieran! :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions