GithubHelp home page GithubHelp logo

uvc-gadget's People

Contributors

wlhe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uvc-gadget's Issues

Streaming hangs and no data is received

Hi,

I've setup the UVC gadget on my arm-based embedded device.
I've cross-compiled the uvc-gadget app and it runs OK, and seems to be working OK.

Also, I can see new /dev/video devices when I connect my embedded device to my Linux PC by USB. So seems to be working ok.

However, when I start the video stream on my PC, it just hangs and no video data is received.

These are the logs:
of your app (seems to be ok):

[root@insp_bk7xxx:~]# ./uvc-gadget -f 1 -v /dev/video5 -u /dev/video7 -s 0
V4L2 device is HD WebCam on bus usb-ff540000.usb-1.1
V4L2: Getting current format: MJPG 640x480
V4L2: Setting format to: MJPG 640x480
V4L2: Getting current format: MJPG 640x480
v4l2 open succeeded, file descriptor = 3
uvc device is ff580000.usb on bus gadget
uvc open succeeded, file descriptor = 4
V4L2: Buffer 0 mapped at address 0xb6c05000.
V4L2: Buffer 1 mapped at address 0xb6a43000.
V4L2: 2 buffers allocated.
control request (req 86 cs 02)
control request (req 86 cs 02)
streaming request (req 87 cs 01)
streaming request (req 01 cs 01)
setting probe control, length = 26
streaming request (req 81 cs 01)
control request (req 87 cs 02)
control request (req 82 cs 02)
control request (req 83 cs 02)
control request (req 84 cs 02)
control request (req 87 cs 02)
control request (req 84 cs 02)
streaming request (req 01 cs 01)
setting probe control, length = 26
...
setting probe control, length = 26
streaming request (req 81 cs 01)
streaming request (req 01 cs 02)
setting commit control, length = 26
UVC: 2 buffers allocated.
V4L2: Starting video stream.
UVC: Starting video stream.

This is the log on my PC:
image

And it hangs like this forever getting no data.

ZYNQ UVC:Unable to implement UVC

PURPOSE:
Recently, I want to realize USB3.0 image data transmission based on zynq, and I want to use UVC to realize it. Just as Xilinx wiki provides ideas, the reference website is:https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/2046001302/Building+Linux+usb+device+drivers+with+2021.1#UVC-Gadget(如图1所示)。

Picture 1:
image

PROBLEM:
After the virtual machine is ready, as shown in Figure 2 and figure 3, the effect of the board test is shown in Figure 5. It is found that it has been stuck in "v4l2: 2 buffers allocated", as shown in Figure 4. At this time, the camera software cannot search for "USB webcam":
Picture 2:
image
Picture 3:
image
Picture 4:
image

What does uvc_frame_info structure represent

Hi,
I wanted to understand uvc_frame_info structure

struct uvc_frame_info {
unsigned int width;
unsigned int height;
unsigned int intervals[8];
};

static const struct uvc_frame_info uvc_frames_yuyv[] = {
{
640,
360,
{666666, 10000000, 50000000, 0},
},

what does {666666, 10000000, 50000000, 0}, represent even though intervals has 8 values why only four are filled

No RPI camera support

Appears not to support the RPI onboard camera. The uvc-gadget stream starts and can be connected to via USB OTG but there is no data received.
sudo uvc-gadget -u /dev/video1 -v /dev/video0

plugin a USB camera to PI and this did work
sudo uvc-gadget -u /dev/video2 -v /dev/video0

UVC: Possible USB shutdown requested from Host

We are using zynq Ultrascale + MPSoC with custom board.
Our board has 2 USB ports(Host 2.0 and device 3.0), 2 SDI(one input and another output).
Kernel version on board is 4.19.0 and In host PC 5.4.0-58-generic.
Final project according to customers requirement is Streaming 1080p video taking input from SDI and taking output from USB UVC(device).
Currently We are trying with connecting C922 Pro Stream Webcam to USB(host) port.This creates /dev/video0 node.
Then modprobe g_webcam. This creates /dev/video1.
Using the application. At host side /dev/video0 is created.
When I try to display using application such as guvcview, at the device side, getting below attached log.
I need some more input so that I can move forward with this project.
From host side:
ffplay /dev/video0
Dequeued v4l2 buffer contains corrupted data (0 bytes).
From device:
[ 1563.216999] VS request completed with status -18.
[ 1563.229986] VS request completed with status -18.
UVC: Possible USB shutdown requested from Host, seen during VIDIOC_DQBUF
[ 1563.234674] VS request completed with status -18.
select timeout
[ 1573.292465] dwc3 fe200000.dwc3: request 00000000af72569b was not queued to ep2in
[ 1573.299868] dwc3 fe200000.dwc3: request 00000000bbc4cf8d was not queued to ep2in
[ 1573.307273] dwc3 fe200000.dwc3: request 00000000849239a7 was not queued to ep2in
[ 1573.314668] dwc3 fe200000.dwc3: request 0000000023561ba0 was not queued to ep2in
UVC: Stopping video stream.
USBGITLOG.txt

Can't get camera control parameter. GET INFO error

Hello everyone,
Recently, I am trying developing the gadget uvc function, I can get the video streaming normal. When I want to control the camera parameter such as zoom and focus. I happened some troubles.
I use AMCAP software and when I open the attribute and camera control menus, I find all of the controls is not use. Shown as the below image :
amcap

I use bushound to catch the data and I find when the host send get info command and the gadget does not respond.
norespond
I don't know why. Does anyone have happend the same issue?

VS request completed with status -18

We are using zynq Ultrascale + MPSoC with custom board.
Our board has 2 USB ports(Host 2.0 and device 3.0), 2 SDI(one input and another output).
Kernel version on board is 4.19.0 and In host PC 5.4.0-58-generic.
Final project according to customers requirement is Streaming 1080p video taking input from SDI and taking output from USB(device).
Currently We are trying with connecting C922 Pro Stream Webcam to USB(host) port.This creates /dev/video0 node.
Then modprobe g_webcam. This creates /dev/video1.
Using the application https://github.com/wlhe/uvc-gadget
At host side /dev/video0 is created.
When I try to display using application such as guvcview, at the device side, getting below attached log.
I need some more input so that I can move forward with this project.
USBGITLOG.txt
host

uvc_events_process_data get a wrong format

I changed some default setting in source code that I didn't need to input a lot of param, I wanna output 1280x720p MJPEG format..

When I run the app in my board, It can find a video device in Ubuntu. But it lost when I try to open the device in VLC , cheese or other application.

And I add some printf and found that, I got a format change in uvc_evetns_process_data, It printed YUYV which I dont need.

Is it driver or kernel problem? I use Linux kunos 4.9.170

[root@/]$ /mnt/uvc-gadget -d
uvc device is sunxi_usb_udc on bus gadget
uvc open succeeded, file descriptor = 3
uvc fd = 3
UVC: Setting format to: MJPG 1280x720
control request (req 86 cs 02)
streaming request (req 87 cs 01)
streaming request (req 01 cs 01)
setting probe control, length = 34
uvc_events_process_data : format->fcc = YUYV

uvc gadget doesn't worked on mac and windows in MJPEG mode

Hello,

I am trying to mount a pi4 as a uvc gadget on my mac OSx laptop and also on my windows laptop.

When I tested with -d option I can see a scrolling test pattern like this https://processors.wiki.ti.com/images/1/12/Luvcview.jpg

But when i launched the following command it doesn't worked:

sudo modprobe g_webcam streaming_maxpacket=1024
./uvc-gadget -u /dev/video2 -v /dev/video0 -f 1 -r 1

When i tested the same command on linux it's working pretty well actually but not on windows/mac. To get the video stream i am using zoom software application.

Could help me to resolve the issue?

ioctl error while running in standalone mode of Raspi4

I am running raspi4 in standalone mode i.e, no capture device attcahed to it and assuming that can send a prestored video from Pi to the host machine and can see the output on host machine using vlc/OBS etc. Please correct me if i am wrong .

I ran the command ./uvc-gadget -d -i /home/pi/Downloads/test.mjpeg -u /dev/video0 -v uvc.0 with the 'wlhe' repo but i get 'ioctl' error even though i am passing mjpeg format only .
Snap of error :
image

My issue is similar to this raised in a similar kind of repo by kbingham because for me also ioctl: VIDIOC_ENUM_FMT , Type: Video Capture . Can anyone please share if there is an updated repo which has resolved this issue .
Also i am using VLC and selecting capture device as this newly made UVC camera in the host side.Please correct me if i am wrong .

Thanks for your time and effort ! Really appreciate that.

Script can't create directory

sudo ./uvc-gadget.sh start
Detecting platform:
board : Raspberry Pi 4 Model B Rev 1.1
udc : fe980000.usb
Creating the USB gadget
Creating gadget directory g1
mkdir: cannot create directory ‘/sys/kernel/config/usb_gadget’: Operation not permitted

100% cpu load when not streaming

not enough knowledge on this but looking at the source @line +/- 450

/* Return immediately if V4l2 streaming has not yet started. */
if (!dev->is_streaming){
    return 0;
}

guess we could sleep(2); instead of returning directly is no one is listening?
not sure how the events work, will we miss them or are they queued?

Odd video size and rates - RPI

Sending from a Logitech c270 USB cam plugged into Raspberry Pi 4 running Buster.

Only 640x480 15fps works well , also 1280 x 720 but at 2fps although camera should do 15fps

ffmpeg on OSX reports rather odd formats supported:

[avfoundation @ 0x7fcbeb831400] Selected framerate (29.970030) is not supported by the device.
[avfoundation @ 0x7fcbeb831400] Supported modes:
[avfoundation @ 0x7fcbeb831400]   640x360@[15.000015 15.000015]fps
[avfoundation @ 0x7fcbeb831400]   640x360@[10.000000 10.000000]fps  
[avfoundation @ 0x7fcbeb831400]   640x360@[2.000000 2.000000]fps
[avfoundation @ 0x7fcbeb831400]   1280x720@[2.000000 2.000000]fps
[avfoundation @ 0x7fcbeb831400]   640x360@[15.000015 15.000015]fps
[avfoundation @ 0x7fcbeb831400]   640x360@[10.000000 10.000000]fps
[avfoundation @ 0x7fcbeb831400]   640x360@[2.000000 2.000000]fps
[avfoundation @ 0x7fcbeb831400]   1280x720@[2.000000 2.000000]fps

A segment error occurred while switching image formats

When the g_webcame gadget of linux came up, I used the uvc gadget tool to test a 360p jpg image. It was normal to connect it with the application software on the win10 terminal, and then there was a mistake when setting the image format,Here is my run command

./uvc-gadget -d -i ./11.jpg -u /dev/video88 -r 0 -f 1 -o 1,
Below is the kernel log

[ 594.086445] setup request 21 01 value 0200 index 0001 001a [ 594.102452] g_webcam gadget: uvc_function_set_alt(1, 1) [ 594.102493] g_webcam gadget: reset UVC [ 594.105935] use of bytesused == 0 is deprecated and will be removed in the future, [ 594.105978] use VIDIOC_DECODER_CMD(V4L2_DEC_CMD_STOP) instead. [ 594.106140] uvcg_queue_buffer11 ret = 0 [ 594.106243] uvcg_queue_buffer11 ret = 0 [ 594.106349] uvcg_queue_buffer11 ret = 0 [ 594.107036] uvcg_queue_buffer11 ret = 0 [ 594.107383] uvcg_queue_buffer11 ret = 0 [ 594.107696] uvcg_queue_buffer11 ret = 0 [ 594.107995] uvcg_queue_buffer11 ret = 0 [ 594.108337] uvcg_queue_buffer11 ret = 0 [ 682.518523] g_webcam gadget: uvc_function_set_alt(1, 0) [ 682.519132] Unable to handle kernel NULL pointer dereference at virtual address 00000208 [ 682.532003] pgd = 830bb5d2 [ 682.534822] [00000208] *pgd=758a6835 [ 682.538455] Internal error: Oops: 17 [#1] PREEMPT SMP ARM [ 682.543867] Modules linked in: g_webcam(O) usbip_vudc usbip_core usb_f_uvc(O) lontium_lt9611(O) rtc_pcf8563 [ 682.553645] CPU: 0 PID: 1025 Comm: uvc-gadget Tainted: G O 4.19.111 #145 [ 682.561662] Hardware name: Generic DT based system [ 682.566491] PC is at vep_dequeue+0x24/0xcc [usbip_vudc] [ 682.571747] LR is at usb_ep_dequeue+0x18/0x1c [ 682.576129] pc : [<af0315f0>] lr : [<b062fb5c>] psr: a00f0013 [ 682.582419] sp : ec25bcd0 ip : ec25bcf0 fp : ec25bcec [ 682.587662] r10: af0160c0 r9 : b066c6d8 r8 : ecab6c88 [ 682.592904] r7 : ec34e400 r6 : ecab6c34 r5 : edda4140 r4 : ec8ffc80 [ 682.599453] r3 : af0315cc r2 : 0000006a r1 : ec8ffc80 r0 : 00000000 [ 682.606001] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user [ 682.613159] Control: 10c5387d Table: 3c8dc06a DAC: 00000055 [ 682.613354] usbip_core: usbip_recv:328: vudc_rx : [ 682.613361] usbip_core: usbip_recv:332: receiving.... [ 682.618910]

[ 683.660671] bfe0: 0002702c aec2672c 00011d48 a6f03558 600f0030 00000003 00000000 00000000 [ 683.668894] [<af0315f0>] (vep_dequeue [usbip_vudc]) from [<b062fb5c>] (usb_ep_dequeue+0x18/0x1c) [ 683.677730] [<b062fb5c>] (usb_ep_dequeue) from [<af011360>] (uvcg_video_enable+0x54/0x1ec [usb_f_uvc]) [ 683.687081] [<af011360>] (uvcg_video_enable [usb_f_uvc]) from [<af010994>] (uvc_v4l2_streamoff+0x30/0x3c [usb_f_uvc]) [ 683.697728] [<af010994>] (uvc_v4l2_streamoff [usb_f_uvc]) from [<b066c6fc>] (v4l_streamoff+0x24/0x28) [ 683.706976] [<b066c6fc>] (v4l_streamoff) from [<b066f36c>] (__video_do_ioctl+0x1d4/0x3ac) [ 683.715183] [<b066f36c>] (__video_do_ioctl) from [<b0672d44>] (video_usercopy+0x210/0x4a4) [ 683.723479] [<b0672d44>] (video_usercopy) from [<b0672ff0>] (video_ioctl2+0x18/0x1c) [ 683.731255] [<b0672ff0>] (video_ioctl2) from [<b066ab38>] (v4l2_ioctl+0x44/0x58) [ 683.738684] [<b066ab38>] (v4l2_ioctl) from [<b0231294>] (do_vfs_ioctl+0xb8/0x7c4) [ 683.746202] [<b0231294>] (do_vfs_ioctl) from [<b02319dc>] (ksys_ioctl+0x3c/0x60) [ 683.753629] [<b02319dc>] (ksys_ioctl) from [<b0231a10>] (sys_ioctl+0x10/0x14) [ 683.760797] [<b0231a10>] (sys_ioctl) from [<b0101000>] (ret_fast_syscall+0x0/0x4c) [ 683.768384] Exception stack(0xec25bfa8 to 0xec25bff0) [ 683.773467] bfa0: aec26b88 00000000 00000003 40045613 aec26738 00000003 [ 683.781666] bfc0: aec26b88 00000000 00000000 00000036 00000000 00000000 a6f96000 aec2674c [ 683.789862] bfe0: 0002702c aec2672c 00011d48 a6f03558 [ 683.794951] Code: e1a05000 e1a04001 0a000026 e5910038 (e5903208) [ 683.801242] ---[ end trace 37b3ade4166b491b ]--- [ 683.810953] Kernel panic - not syncing: Fatal exception
So what could be causing it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.