wlhe / uvc-gadget

enhance uvc-gadget test application
GNU General Public License v2.0
140 stars 143 forks source link

A segment error occurred while switching image formats #12

Open Ouch-call opened 1 year ago

Ouch-call commented 1 year ago

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?

kbingham commented 1 year ago

It looks like you're on a really old kernel version: 4.19.111 While you shouldn't ever expect kernel crashes, the fact your on an old kernel means you likely need to validate this with the BSP vendor. What platform/SoC are you using for this?

We're actively working on our (the original) uvc-gadget now, so we may be able to support you better on newer software.

https://git.ideasonboard.org/uvc-gadget.git

Ouch-call commented 1 year ago

Thank you, I use rk1126 board, so it is the kernel version?

kbingham commented 1 year ago

If the crash is in the kernel, then it is the kernel that needs to be fixed. v4.19 is very old now.

You could ask your vendor to test and provide a newer kernel.

If this is a commercial project and you need support beyond what Rockchip support can provide, we can help you get a newer kernel running, and utilising uvc-gadget.

Ouch-call commented 1 year ago

Ok thanks, I will check if there is a new version of the kernel. What is the minimum version of the kernel required for uvc-gadget? If you still want to be supported in v4.19, is there any other way besides updating the kernel

Ouch-call commented 1 year ago

I changed a new kernel and can run normally. Thank you very much for your advice!