Do you have any guid about uvc cemera?

g_webcam not work properly.
This is what i tried.

> sudo modprobe g_webcam
> v4l2-ctl --list-devices
dwc3-gadget (gadget):
/dev/video4
rkisp1-statistics (platform: rkisp1):
/dev/video2
/dev/video3
rkisp1_mainpath (platform:ff910000.rkisp1):
/dev/video0
/dev/video1
>dmesg
[ 55.350022] g_webcam gadget: uvc_function_bind
[ 55.354586] g_webcam gadget: Webcam Video Gadget
[ 55.355017] g_webcam gadget: g_webcam ready
> uvc-gadget -d -i ~/tmp/test.jpg -u /dev/video4

dmesg log

[ 59.752149] g_webcam gadget: UVC disconnect failed with -110
[ 77.700889] ------------[ cut here ]------------
[ 77.701315] WARNING: at drivers/usb/gadget/composite.c:327
[ 77.701803] Modules linked in: g_webcam usb_f_uvc libcomposite binfmt_misc bcmdhd ip_tables x_tables autofs4

[ 77.702885] CPU: 0 PID: 1225 Comm: uvc-gadget Not tainted 4.4.154-73-rockchip-00007-g155a65a #2
[ 77.703647] Hardware name: ROCK PI 4B (DT)
[ 77.704013] task: ffffffc0ed5d3800 task.stack: ffffffc0defd4000
[ 77.704569] PC is at usb_function_activate+0x3c/0x88 [libcomposite]
[ 77.705149] LR is at usb_function_activate+0x30/0x88 [libcomposite]
[ 77.705708] pc : [] lr : [] pstate: a00001c5
[ 77.706355] sp : ffffffc0defd7ab0
[ 77.706649] x29: ffffffc0defd7ab0 x28: ffffffc0ed5d3800
[ 77.707142] x27: 0000000000000000 x26: ffffffc0eec27000
[ 77.707634] x25: 0000000000000186 x24: ffffffc0e0389e00
[ 77.708126] x23: ffffff80092ee738 x22: ffffffc0dec2c000
[ 77.708618] x21: 0000000000000140 x20: ffffffc0e44e0e10
[ 77.709110] x19: ffffffc0e44e0d80 x18: 0000000000000000
[ 77.709602] x17: 0000000000000000 x16: ffffff800821ac2c
[ 77.710094] x15: 0000000000000000 x14: 0000000000011f94
[ 77.710586] x13: 00000000fff47464 x12: 0000000000000000
[ 77.711077] x11: 00000000fff474f4 x10: 00000000f774c000
[ 77.711569] x9 : 0000000000000000 x8 : ffffffc0dd04b600
[ 77.712060] x7 : 0000000000000000 x6 : 000000000000003f
[ 77.712552] x5 : 0000000000000040 x4 : 0000000000000000
[ 77.713043] x3 : 00000040eed09000 x2 : 00000000ffffffff
[ 77.713534] x1 : 00000040eed09000 x0 : 0000000000000000
[ 77.714026]
PC: 0xffffff8001060d0c:
[ 77.714470] 0d0c f9000001 d2802000 f2fbd5a0 f900167f f9005660 91040000 f9005a60 17ffffca
[ 77.715236] 0d2c 128002b5 17ffffe4 d503201f 01069838 ffffff80 01067d86 ffffff80 01067da8
[ 77.715999] 0d4c ffffff80 a9bd7bfd 910003fd a90153f3 f90013f5 aa0003f3 aa1e03e0 d503201f
[ 77.716763] 0d6c f9401660 f9401813 91024274 aa1403e0 95efd82d aa0003f5 b9408a60 35000160
[ 77.717527] 0d8c d4210000 128002b3 aa1503e1 aa1403e0 95efd872 f94013f5 2a1303e0 a94153f3
[ 77.718290] 0dac a8c37bfd d65f03c0 51000400 b9008a60 350000a0 f9400260 95df5038 2a0003f3
[ 77.719053] 0dcc 17fffff2 52800013 17fffff0 a9be7bfd 910003fd a90153f3 aa0103f3 aa0003f4
[ 77.719817] 0dec aa1e03e0 d503201f f9403a61 b4000061 aa1303e0 d63f0020 a94a8261 f9005e7f
[ 77.720582]
LR: 0xffffff8001060d00:
[ 77.721026] 0d00 36fffa80 a94a8261 f9000420 f9000001 d2802000 f2fbd5a0 f900167f f9005660
[ 77.721789] 0d20 91040000 f9005a60 17ffffca 128002b5 17ffffe4 d503201f 01069838 ffffff80
[ 77.722553] 0d40 01067d86 ffffff80 01067da8 ffffff80 a9bd7bfd 910003fd a90153f3 f90013f5
[ 77.723316] 0d60 aa0003f3 aa1e03e0 d503201f f9401660 f9401813 91024274 aa1403e0 95efd82d
[ 77.724080] 0d80 aa0003f5 b9408a60 35000160 d4210000 128002b3 aa1503e1 aa1403e0 95efd872
[ 77.724843] 0da0 f94013f5 2a1303e0 a94153f3 a8c37bfd d65f03c0 51000400 b9008a60 350000a0
[ 77.725607] 0dc0 f9400260 95df5038 2a0003f3 17fffff2 52800013 17fffff0 a9be7bfd 910003fd
[ 77.726370] 0de0 a90153f3 aa0103f3 aa0003f4 aa1e03e0 d503201f f9403a61 b4000061 aa1303e0
[ 77.727135]
SP: 0xffffffc0defd7a30:
[ 77.727578] 7a30 dec2c000 ffffffc0 092ee738 ffffff80 e0389e00 ffffffc0 00000186 00000000
[ 77.728341] 7a50 eec27000 ffffffc0 00000000 00000000 ed5d3800 ffffffc0 defd7ab0 ffffffc0
[ 77.729105] 7a70 01060d80 ffffff80 defd7ab0 ffffffc0 01060d8c ffffff80 a00001c5 00000000
[ 77.729868] 7a90 defd7ab0 ffffffc0 01060d80 ffffff80 00000000 00000080 e44e0e10 ffffffc0
[ 77.730632] 7ab0 defd7ae0 ffffffc0 010770dc ffffff80 dec2c000 ffffffc0 e44e0d80 ffffffc0
[ 77.731395] 7ad0 e0389e00 ffffffc0 dec2c000 ffffffc0 defd7b00 ffffffc0 01077e6c ffffff80
[ 77.732159] 7af0 dd04b540 ffffffc0 dec2c000 ffffffc0 defd7b30 ffffffc0 08885a64 ffffff80
[ 77.732922] 7b10 dec2c000 ffffffc0 092ee000 ffffff80 dec2c088 ffffffc0 e0389e00 ffffffc0
[ 77.733691]
X8: 0xffffffc0dd04b580:
[ 77.734135] b580 dd04b580 ffffffc0 dd04b580 ffffffc0 dd04b590 ffffffc0 dd04b590 ffffffc0
[ 77.734899] b5a0 dd04b5a0 ffffffc0 dd04b5a0 ffffffc0 00000000 ffffffff 00000000 00000000
[ 77.735662] b5c0 dec2c610 ffffffc0 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.736426] b5e0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.737189] b600 00000000 00000000 081c77fc ffffff80 44656144 000003e8 000003e8 000003e8
[ 77.737953] b620 000003e8 000003e8 000003e8 000003e8 000003e8 00000000 00000000 00000000
[ 77.738716] b640 00000000 00000000 00000000 00000000 ffffffff 0000003f 00000000 00000000
[ 77.739480] b660 00000000 00000000 e464c200 ffffffc0 00000000 00000000 00000000 00000000
[ 77.740249]
X16: 0xffffff800821abac:
[ 77.740703] abac 540003c0 9100e3a1 aa1603e0 97feffa5 2a0003f3 37f80040 b9405fb3 f9402ba0
[ 77.741467] abcc b4000140 f94023a2 d503201f 52800001 91002000 f9000002 d503201f 35000161
[ 77.742231] abec b9405bb3 4b130293 36000075 aa1603e0 97febfd7 93407e60 a94153f3 a9425bf5
[ 77.742995] ac0c a8c67bfd d65f03c0 128001b3 17fffff7 928001a0 17fffff9 92800100 17fffff7
[ 77.743758] ac2c a9bd7bfd 910003fd a90153f3 f90013f5 aa0103f4 aa0203f5 aa0003f3 aa1e03e0
[ 77.744522] ac4c d503201f 2a1503e3 2a1403e2 aa1303e1 12800c60 97feb53a f94013f5 a94153f3
[ 77.745286] ac6c a8c37bfd d65f03c0 a9bd7bfd 910003fd a90153f3 a9025bf5 aa0003f3 aa0103f4
[ 77.746049] ac8c aa1e03e0 aa0203f5 aa0303f6 d503201f 2a1603e3 2a1503e2 aa1403e1 2a1303e0
[ 77.746815]
X19: 0xffffffc0e44e0d00:
[ 77.747270] 0d00 00000000 00000000 00000000 00000000 ffffffff 0000003f 00000000 00000000
[ 77.748034] 0d20 00000000 00000000 e464c200 ffffffc0 00000000 00000000 00000000 00000000
[ 77.748797] 0d40 00000000 00000000 00000000 00000000 de962980 ffffffc0 09216a88 ffffff80
[ 77.749561] 0d60 dd008180 ffffffc0 e44e08e8 ffffffc0 080bbe2c ffffff80 00000000 00000000
[ 77.750324] 0d80 ed043ab0 ffffffc0 e44e0f00 ffffffc0 00000000 00000000 00000000 00000000
[ 77.751088] 0da0 00000000 00000000 00000000 00000000 00000000 00000000 00011200 0102ef02
[ 77.751851] 0dc0 021d6b00 01040401 00000002 00000000 010900a8 ffffff80 010900a8 ffffff80
[ 77.752615] 0de0 e3469e00 ffffffc0 e3469e00 ffffffc0 01090150 ffffff80 00000007 00000000
[ 77.753380]
X20: 0xffffffc0e44e0d90:
[ 77.753824] 0d90 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.754588] 0db0 00000000 00000000 00011200 0102ef02 021d6b00 01040401 00000002 00000000
[ 77.755351] 0dd0 010900a8 ffffff80 010900a8 ffffff80 e3469e00 ffffffc0 e3469e00 ffffffc0
[ 77.756115] 0df0 01090150 ffffff80 00000007 00000000 00000000 00000000 00000000 00000000
[ 77.756878] 0e10 00080007 dead4ead 00000000 00000000 ed5d3800 ffffffc0 00000000 00000000
[ 77.757642] 0e30 00000000 00000000 00000000 00000000 00000000 dead4ead ffffffff 00000000
[ 77.758405] 0e50 ffffffff ffffffff e44e0e58 ffffffc0 e44e0e58 ffffffc0 0870ef04 ffffff80
[ 77.759168] 0e70 0870ef60 ffffff80 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.759934]
X22: 0xffffffc0dec2bf80:
[ 77.760389] bf80 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.761152] bfa0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.761916] bfc0 00000000 00000000 00000000 00000000 00000000 00000000 7379732f 2e6d6574
[ 77.762680] bfe0 63696c73 70612f65 61642d74 2d796c69 72677075 2e656461 76726573 00656369
[ 77.763443] c000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.764207] c020 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.764970] c040 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.765734] c060 00000000 00000000 00000000 00000000 00000000 00000000 0107e140 ffffff80
[ 77.766499]
X23: 0xffffff80092ee6b8:
[ 77.766954] e6b8 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.767717] e6d8 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.768481] e6f8 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.769244] e718 00000000 00000000 00000000 00000000 eebb7000 ffffffc0 0900d2c0 ffffff80
[ 77.770007] e738 00000001 00000000 00020002 dead4ead ffffffff 00000000 ffffffff ffffffff
[ 77.770771] e758 092ee758 ffffff80 092ee758 ffffff80 00000000 00000000 00000000 00000000
[ 77.771535] e778 08fe6bdb ffffff80 00000000 00000000 00000000 00000000 092ee7f8 ffffff80
[ 77.772299] e798 ee8801c0 ffffffc0 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.773064]
X24: 0xffffffc0e0389d80:
[ 77.773518] 9d80 00000000 00000000 00000000 00000000 defe2d80 ffffffc0 00000004 00000000
[ 77.774282] 9da0 00000008 00000008 00000020 00000000 00002035 00000000 00000000 00000000
[ 77.775046] 9dc0 00000000 00000000 00000000 00000000 e0389dd0 ffffffc0 e0389dd0 ffffffc0
[ 77.775810] 9de0 e0389de0 ffffffc0 e0389de0 ffffffc0 dfda7ad0 ffffffc0 ffffffff 7f7f7f7f
[ 77.776573] 9e00 00000000 00000000 00000000 00000000 ef19cc60 ffffffc0 dff17948 ffffffc0
[ 77.777337] 9e20 def178b0 ffffffc0 08d6d2f0 ffffff80 00000000 dead4ead ffffffff 00000000
[ 77.778101] 9e40 ffffffff ffffffff 00000001 00000000 00000802 0000001f 00000001 00000000
[ 77.778864] 9e60 00000000 dead4ead ffffffff 00000000 ffffffff ffffffff e0389e78 ffffffc0
[ 77.779630]
X26: 0xffffffc0eec26f80:
[ 77.780084] 6f80 ff7effff ff7fffff ff77ffff ffafffff ffefffff ff67ffff fff6ffff ffafffff
[ 77.780848] 6fa0 ff6effff ff657eff fffeffff ffec7fff ff74ffff ffe7ffff ff7fffff 7f67ff7f
[ 77.781612] 6fc0 ff3effff ffffffff ffe7ffff fff7ffff ff6effff fff6ffff ff67ffff ff77ffff
[ 77.782375] 6fe0 ffa7ffff ffe2ffff ffebffff ffd6ffff fff6ffff ffa6ffff ff6fffff 7ff7ff7f
[ 77.783139] 7000 00200080 00000002 00000000 00000000
[ 77.783589] dwmmc_rockchip fe310000.dwmmc: Unexpected interrupt latency
[ 77.784168] 00000000
[ 77.784381] 00000000 eec27000 ffffffc0
[ 77.784622] 7020 00000000 00000001 eec27038 ffffffc0 ee8b8070 ffffffc0 ffff002f 7f7f467f
[ 77.785385] 7040 fffff7ff ffffffff ffffffff ffffffff fffff7ff 00fffeff 0c370c37 dead4ead
[ 77.786149] 7060 ffffffff ffffffff ffffffff ffffffff 000000bb fffff6ff 00000000 00000000
[ 77.786915]
X28: 0xffffffc0ed5d3780:
[ 77.787369] 3780 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.788133] 37a0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.788896] 37c0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 77.789660] 37e0 00000004 00000002 00000002 00000006 00000044 00000062 00000022 00000056
[ 77.790423] 3800 00400000 00000000 ffffffff ffffffff 00000000 00000000 00000000 00000000
[ 77.791187] 3820 defd4000 ffffffc0 00000002 00400000 00000000 00000000 00000000 00000000
[ 77.791950] 3840 00000001 00000000 00000005 00000000 ffff26d4 00000000 ed12d400 ffffffc0
[ 77.792714] 3860 00000000 00000001 00000078 00000078 00000078 00000000 08c685a0 ffffff80
[ 77.793479]
X29: 0xffffffc0defd7a30:
[ 77.793934] 7a30 dec2c000 ffffffc0 092ee738 ffffff80 e0389e00 ffffffc0 00000186 00000000
[ 77.794697] 7a50 eec27000 ffffffc0 00000000 00000000 ed5d3800 ffffffc0 defd7ab0 ffffffc0
[ 77.795461] 7a70 01060d80 ffffff80 defd7ab0 ffffffc0 01060d8c ffffff80 a00001c5 00000000
[ 77.796224] 7a90 defd7ab0 ffffffc0 01060d80 ffffff80 00000000 00000080 e44e0e10 ffffffc0
[ 77.796988] 7ab0 defd7ae0 ffffffc0 010770dc ffffff80 dec2c000 ffffffc0 e44e0d80 ffffffc0
[ 77.797751] 7ad0 e0389e00 ffffffc0 dec2c000 ffffffc0 defd7b00 ffffffc0 01077e6c ffffff80
[ 77.798515] 7af0 dd04b540 ffffffc0 dec2c000 ffffffc0 defd7b30 ffffffc0 08885a64 ffffff80
[ 77.799278] 7b10 dec2c000 ffffffc0 092ee000 ffffff80 dec2c088 ffffffc0 e0389e00 ffffffc0

[ 77.800187] —[ end trace 3bfca9be04dbddde ]—
[ 77.800596] Call trace:
[ 77.800825] Exception stack(0xffffffc0defd78e0 to 0xffffffc0defd7a10)
[ 77.801397] 78e0: ffffffc0e44e0d80 0000008000000000 ffffffc0defd7ab0 ffffff8001060d8c
[ 77.802094] 7900: ffffffbdc35eb8c0 ffffff8009205000 ffffffc0defd7970 ffffff80081c2f0c
[ 77.802792] 7920: ffffffbdc35eb8c0 ffffffc0de9a3000 0000000000000000 ffffffc0dd026330
[ 77.803488] 7940: ffffffbdc35eb8c0 ffffff8009205000 ffffffc0e1c3aa38 0000000000000015
[ 77.804185] 7960: ffffffc0defd7990 ffffff8008181964 ffffffc0defd7990 ffffff8008c56f58
[ 77.804882] 7980: 0000000000000000 00000040eed09000 00000000ffffffff 00000040eed09000
[ 77.805568] 79a0: 0000000000000000 0000000000000040 000000000000003f 0000000000000000
[ 77.806265] 79c0: ffffffc0dd04b600 0000000000000000 00000000f774c000 00000000fff474f4
[ 77.806961] 79e0: 0000000000000000 00000000fff47464 0000000000011f94 0000000000000000
[ 77.807656] 7a00: ffffff800821ac2c 0000000000000000
[ 77.808113] [] usb_function_activate+0x3c/0x88 [libcomposite]
[ 77.808793] [] uvc_function_connect+0x28/0x54 [usb_f_uvc]
[ 77.809434] [] uvc_v4l2_open+0x70/0x94 [usb_f_uvc]
[ 77.810001] [] v4l2_open+0x9c/0xe4
[ 77.810450] [] chrdev_open+0x15c/0x168
[ 77.810933] [] do_dentry_open+0x288/0x2e4
[ 77.811427] [] vfs_open+0x80/0x84
[ 77.811862] [] path_openat+0xb64/0xd34
[ 77.812341] [] do_filp_open+0x48/0x94
[ 77.812811] [] do_sys_open+0x158/0x238
[ 77.813283] [] compat_SyS_open+0x38/0x48
[ 77.813777] [] el0_svc_naked+0x24/0x28
[ 77.814469] g_webcam gadget: UVC connect failed with -22

1 Like

I think we never tested it. So you need to forward the USB camera on PC?

Yes.
Can you help me?

the usage of USB OTG is the key feature of our products

This issue is a little bit troublesome. We need more testing and debugging on it. I will get back to you once we have some clue.

thank you for your response!