基于WSL2调试UVC-Linux下多UVC设备显示问题案例分享

原创 嵌入式Lee 2025-01-04 23:14

.前言

前面我们在https://mp.weixin.qq.com/s/s3uC-SHaVcXWAZK1sK6EZw?token=6568576&lang=zh_CN

WSL2中配置支持UVC》一文中,分享了重新编译WSL2内核以支持UVC

基于此,我们能随意修改内核重新编译加载新的内核运行,这样我们就可以方便的在PC上进行UVC相关的调试了。这一篇就来分享一个具体的案例。

二.使能UVC调试信息

我们调试的主要手段就是打开UVC代码中的dbg调试打印,通过打印信息来确认执行流,状态等。 当然现在我们可以随意修改内核代码了,那么我们就可以在关心的位置添加我们自己的打印信息方便调试。

drivers/media/usb/uvc/uvc_driver.c中,通过以下语句定义了一个调试使能的参数

unsigned int uvc_dbg_param;

module_param_named(trace, uvc_dbg_param, uint, S_IRUGO|S_IWUSR);

最终的效果就是生成对应的文件

/sys/module/uvcvideo/parameters/trace

修改上述文件trace实际对应的就是修改变量uvc_dbg_param

类似的所有其他的参数如下

MODULE_PARM_DESC(clock, "Video buffers timestamp clock");module_param_named(hwtimestamps, uvc_hw_timestamps_param, uint, S_IRUGO|S_IWUSR);MODULE_PARM_DESC(hwtimestamps, "Use hardware timestamps");module_param_named(nodrop, uvc_no_drop_param, uint, S_IRUGO|S_IWUSR);MODULE_PARM_DESC(nodrop, "Don't drop incomplete frames");module_param_named(quirks, uvc_quirks_param, uint, S_IRUGO|S_IWUSR);MODULE_PARM_DESC(quirks, "Forced device quirks");module_param_named(trace, uvc_dbg_param, uint, S_IRUGO|S_IWUSR);MODULE_PARM_DESC(trace, "Trace level bitmask");module_param_named(timeout, uvc_timeout_param, uint, S_IRUGO|S_IWUSR);MODULE_PARM_DESC(timeout, "Streaming control requests timeout");

drivers/media/usb/uvc/uvcvideo.h

调试打印接口,调用的时dev_printk, 根据uvc_dbg_param变量的具体某一位是否置位(UVC_DBG_##flag)来判断是否要打印,flag是传入的分类名,比如PROBE对应的是 UVC_DBG_PROBEbit0,如果uvc_dbg_parambit0置位,则uvc_dbg(stream->dev, PROBE,对应的就会打印。

#define uvc_dbg(_dev, flag, fmt, ...)                   \do {                                    \    if (uvc_dbg_param & UVC_DBG_##flag)             \        dev_printk(KERN_DEBUG, &(_dev)->udev->dev, fmt,     \               ##__VA_ARGS__);              \} while (0)#define UVC_DBG_PROBE       (1 << 0)#define UVC_DBG_DESCR       (1 << 1)#define UVC_DBG_CONTROL     (1 << 2)#define UVC_DBG_FORMAT      (1 << 3)#define UVC_DBG_CAPTURE     (1 << 4)#define UVC_DBG_CALLS       (1 << 5)#define UVC_DBG_FRAME       (1 << 7)#define UVC_DBG_SUSPEND     (1 << 8)#define UVC_DBG_STATUS      (1 << 9)#define UVC_DBG_VIDEO       (1 << 10)#define UVC_DBG_STATS       (1 << 11)#define UVC_DBG_CLOCK       (1 << 12)

具体操作如下

Shell中查看参数,

上述的参数对应的文件位于对于/sys/module/{模块名}/parameters/

,对于uvc模块名为uvcvideo,所以对应/sys/module/uvcvideo/parameters/

查看如下

root@lhj:/home/lhj# ls /sys/module/uvcvideo/parameters/

clock hwtimestamps  nodrop  quirks  timeout  trace

root@lhj:/home/lhj#

所以只需要按照如下操作,这里是配置 uvc_dbg_parambit0~bit12都置位,使能所有类别的打印。

sudo su

echo 0x01FFF > /sys/module/uvcvideo/parameters/trace

cat /sys/module/uvcvideo/parameters/trace

显示8191

su qinyunti

以上使能之后就可以dmesg查看调试输出了。

.在关键位置添加打印信息

我们这里以一个具体的案例来分享,UVC增加双设备支持后,在windows下可以双设备同时显示,在linux下只能单独显示,打开一个设备后再打开另一个设备导致两个设备都不能显示,关闭一个设备后另一个设备能显示。

我们找到UVC probe关键的代码增加一些打印信息,当然具体情况具体分析,一般在关键路径增加一些状态和数据的打印方便分析。

uvc_v4l2_set_streamparm

uvc_v4l2_try_format

uvc_probe_video

我这里在函数uvc_v4l2_try_formatuvc_probe_video中增加打印信息

static int uvc_v4l2_try_format(struct uvc_streaming *stream,    struct v4l2_format *fmt, struct uvc_streaming_control *probe,    struct uvc_format **uvc_format, struct uvc_frame **uvc_frame){    struct uvc_format *format = NULL;    struct uvc_frame *frame = NULL;    u16 rwrh;    unsigned int dmaxd;    unsigned int i;    u32 interval;    int ret = 0;    u8 *fcc;    if (fmt->type != stream->type)        return -EINVAL;    fcc = (u8 *)&fmt->fmt.pix.pixelformat;    uvc_dbg(stream->devFORMAT, "Trying format 0x%08x (%c%c%c%c): %ux%u\n",        fmt->fmt.pix.pixelformat,        fcc[0], fcc[1], fcc[2], fcc[3],        fmt->fmt.pix.widthfmt->fmt.pix.height);    /* Check if the hardware supports the requested formatuse the default     * format otherwise.     */    for (i = 0; i < stream->nformats; ++i) {        format = &stream->format[i];        if (format->fcc == fmt->fmt.pix.pixelformat)            break;    }    if (i == stream->nformats) {        format = stream->def_format;        fmt->fmt.pix.pixelformat = format->fcc;    }    /* Find the closest image size. The distance between image sizes is     * the size in pixels of the non-overlapping regions between the     * requested size and the frame-specified size.     */    rw = fmt->fmt.pix.width;    rh = fmt->fmt.pix.height;    maxd = (unsigned int)-1;    for (i = 0; i < format->nframes; ++i) {        u16 w = format->frame[i].wWidth;        u16 h = format->frame[i].wHeight;        d = min(w, rw) * min(h, rh);        d = w*+ rw*rh - 2*d;        if (d < maxd) {            maxd = d;            frame = &format->frame[i];        }        if (maxd == 0)            break;    }    if (frame == NULL) {        uvc_dbg(stream->dev, FORMAT"Unsupported size %ux%u\n",            fmt->fmt.pix.width, fmt->fmt.pix.height);        return -EINVAL;    }    /* Use the default frame interval. */    interval = frame->dwDefaultFrameInterval;    uvc_dbg(stream->dev, FORMAT,        "Using default frame interval %u.%u us (%u.%u fps)\n",        interval / 10, interval % 1010000000 / interval,        (100000000 / interval) % 10);    /* Set the format index, frame index and frame interval. */    memset(probe, 0, sizeof(*probe));    probe->bmHint = 1;  /* dwFrameInterval */    probe->bFormatIndex = format->index;    probe->bFrameIndex = frame->bFrameIndex;    probe->dwFrameInterval = uvc_try_frame_interval(frame, interval);    /* Some webcams stall the probe control set request when the     * dwMaxVideoFrameSize field is set to zero. The UVC specification     * clearly states that the field is read-only from the host, so this     * is a webcam bug. Set dwMaxVideoFrameSize to the value reported by     * the webcam to work around the problem.     *     * The workaround could probably be enabled for all webcams, so the     * quirk can be removed if needed. It's currently useful to detect     * webcam bugs and fix them before they hit the market (providing     * developers test their webcams with the Linux driver as well as with     * the Windows driver).     */    mutex_lock(&stream->mutex);    if (stream->dev->quirks & UVC_QUIRK_PROBE_EXTRAFIELDS)        probe->dwMaxVideoFrameSize =            stream->ctrl.dwMaxVideoFrameSize;    /* Probe the device. */    ret = uvc_probe_video(stream, probe);    mutex_unlock(&stream->mutex);    if (ret < 0){        uvc_dbg(stream->dev, FORMAT,"%s %d %d\r\n",__FILE__,__LINE__,ret);        goto done;    }    /* After the probe, update fmt with the values returned from     * negotiation with the device. Some devices return invalid bFormatIndex     * and bFrameIndex values, in which case we can only assume they have     * accepted the requested format as-is.     */    uvc_dbg(stream->dev, FORMAT,"%s %d stream->nformats:%d\r\n",__FILE__,__LINE__,stream->nformats);    for (i = 0; i < stream->nformats; ++i) {        if (probe->bFormatIndex == stream->format[i].index) {            format = &stream->format[i];            uvc_dbg(stream->dev, FORMAT,"%s %d match format:%d\r\n",__FILE__,__LINE__,probe->bFormatIndex);            break;        }    }    if (i == stream->nformats)        uvc_dbg(stream->dev, FORMAT,            "Unknown bFormatIndex %u, using default\n",            probe->bFormatIndex);    uvc_dbg(stream->dev, FORMAT,"%s %d format->nframes:%d\r\n",__FILE__,__LINE__,format->nframes);    for (i = 0; i < format->nframes; ++i) {        if (probe->bFrameIndex == format->frame[i].bFrameIndex) {            frame = &format->frame[i];            uvc_dbg(stream->dev, FORMAT,"%s %d match frame:%d\r\n",__FILE__,__LINE__,probe->bFrameIndex);            break;        }    }    if (i == format->nframes)        uvc_dbg(stream->dev, FORMAT,            "Unknown bFrameIndex %u, using default\n",            probe->bFrameIndex);    fmt->fmt.pix.width = frame->wWidth;    fmt->fmt.pix.height = frame->wHeight;    fmt->fmt.pix.field = V4L2_FIELD_NONE;    fmt->fmt.pix.bytesperline = uvc_v4l2_get_bytesperline(format, frame);    fmt->fmt.pix.sizeimage = probe->dwMaxVideoFrameSize;    fmt->fmt.pix.pixelformat = format->fcc;    fmt->fmt.pix.colorspace = format->colorspace;    fmt->fmt.pix.xfer_func = format->xfer_func;    fmt->fmt.pix.ycbcr_enc = format->ycbcr_enc;    uvc_dbg(stream->dev, FORMAT,"%s %d width:%d,height:%d,field:%d,bytesperline:%d,sizeimage:%d,pixelformat:%d,colorspace:%d,xfer_func:%d,ycbcr_enc:%d\r\n",__FILE__,__LINE__,    fmt->fmt.pix.width,    fmt->fmt.pix.height,    fmt->fmt.pix.field,    fmt->fmt.pix.bytesperline,    fmt->fmt.pix.sizeimage,    fmt->fmt.pix.pixelformat,    fmt->fmt.pix.colorspace,    fmt->fmt.pix.xfer_func,    fmt->fmt.pix.ycbcr_enc);    if (uvc_format != NULL){        *uvc_format = format;        uvc_dbg(stream->dev, FORMAT"set uvc_format\r\n");    }    if (uvc_frame != NULL){        *uvc_frame = frame;        uvc_dbg(stream->dev, FORMAT"set uvc_frame\r\n");    }done:    return ret;}int uvc_probe_video(struct uvc_streaming *stream,    struct uvc_streaming_control *probe){    struct uvc_streaming_control probe_minprobe_max;    u16 bandwidth;    unsigned int i;    int ret;    /* Perform probingThe device should adjust the requested values     * according to its capabilitiesHoweversome devicesnamely the     * first generation UVC Logitech webcamsdon't implement the Video     * Probe control properlyand just return the needed bandwidthFor     * that reasonif the needed bandwidth exceeds the maximum available     * bandwidthtry to lower the quality.     */    ret = uvc_set_video_ctrl(streamprobe, 1);    if (ret < 0){        uvc_dbg(stream->dev, FORMAT,"%s %d %d\r\n",__FILE__,__LINE__,ret);        goto done;    }    /* Get the minimum and maximum values for compression settings. */    uvc_dbg(stream->dev, FORMAT,"%s %d stream->dev->quirks:%x\r\n",__FILE__,__LINE__,stream->dev->quirks);    if (!(stream->dev->quirks & UVC_QUIRK_PROBE_MINMAX)) {        ret = uvc_get_video_ctrl(stream, &probe_min, 1UVC_GET_MIN);        if (ret < 0){            uvc_dbg(stream->dev, FORMAT,"%s %d %d\r\n",__FILE__,__LINE__,ret);            goto done;        }        ret = uvc_get_video_ctrl(stream, &probe_max, 1UVC_GET_MAX);        if (ret < 0){            uvc_dbg(stream->dev, FORMAT,"%s %d %d\r\n",__FILE__,__LINE__,ret);            goto done;        }        probe->wCompQuality = probe_max.wCompQuality;        uvc_dbg(stream->dev, FORMAT,"%s %d probe->wCompQuality:%x\r\n",__FILE__,__LINE__,probe->wCompQuality);    }    for (i = 0; i < 2++i) {        ret = uvc_set_video_ctrl(stream, probe, 1);        if (ret < 0){            uvc_dbg(stream->dev, FORMAT,"%s %d %d\r\n",__FILE__,__LINE__,ret);            goto done;        }        ret = uvc_get_video_ctrl(stream, probe, 1UVC_GET_CUR);        if (ret < 0){            uvc_dbg(stream->dev, FORMAT,"%s %d %d\r\n",__FILE__,__LINE__,ret);            goto done;        }        uvc_dbg(stream->dev, FORMAT,"%s %d pstream->intf->num_altsetting:%x\r\n",__FILE__,__LINE__,stream->intf->num_altsetting);        if (stream->intf->num_altsetting == 1)            break;        bandwidth = probe->dwMaxPayloadTransferSize;        uvc_dbg(stream->dev, FORMAT,"%s %d bandwidth:%x\r\n",__FILE__,__LINE__,bandwidth);        if (bandwidth <= stream->maxpsize)            break;        if (stream->dev->quirks & UVC_QUIRK_PROBE_MINMAX) {            ret = -ENOSPC;            goto done;        }        /* TODO: negotiate compression parameters */        probe->wKeyFrameRate = probe_min.wKeyFrameRate;        probe->wPFrameRate = probe_min.wPFrameRate;        probe->wCompQuality = probe_max.wCompQuality;        probe->wCompWindowSize = probe_min.wCompWindowSize;        uvc_dbg(stream->dev, FORMAT,"%s %d probe->wKeyFrameRate:%x\r\n",__FILE__,__LINE__,probe->wKeyFrameRate);        uvc_dbg(stream->dev, FORMAT,"%s %d probe->wPFrameRate:%x\r\n",__FILE__,__LINE__,probe->wPFrameRate);        uvc_dbg(stream->dev, FORMAT,"%s %d probe->wCompQuality:%x\r\n",__FILE__,__LINE__,probe->wCompQuality);        uvc_dbg(stream->dev, FORMAT,"%s %d probe->wCompWindowSize:%x\r\n",__FILE__,__LINE__,probe->wCompWindowSize);    }done:    return ret;}

先使能UVCdbg信息

sudo su

echo 0x01FFF > /sys/module/uvcvideo/parameters/trace

cat /sys/module/uvcvideo/parameters/trace

su qinyunti

然后清除dmesg

sudo dmesg -c

确认清除

dmesg

usbipd bind -b 3-2

usbipd attach -w -b 3-2之后

查看dmesg

[   93.764118] vhci_hcd vhci_hcd.0pdev(0rhport(0sockfd(3)[   93.764805] vhci_hcd vhci_hcd.0devid(196610speed(3speed_str(high-speed)[   93.765632] vhci_hcd vhci_hcd.0: Device attached[   94.120776] usb 1-1: new high-speed USB device number 2 using vhci_hcd[   94.270769] usb 1-1: SetAddress Request (2) to port 0[   94.306545] usb 1-1: New USB device found, idVendor=1993, idProduct=0101, bcdDevice= 1.01[   94.307540] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0[   94.308758] usb 1-1: Product: .UVC[   94.309224] usb 1-1: Manufacturer: .Technology[   94.312458] usb 1-1: Probing generic UVC device 1[   94.314366] usb 1-1: Found format NV12 little-endian (0x3231564e)[   94.315230] usb 1-1: - 1280x720 (39.0 fps)[   94.315614] usb 1-1: Found format H264 little-endian (0x34363248)[   94.316145] usb 1-1: - 1280x720 (39.0 fps)[   94.316444] usb 1-1: Found format MJPG little-endian (0x47504a4d)[   94.316947] usb 1-1: - 1280x720 (39.0 fps)[   94.317194] usb 1-1: Found UVC 1.10 device .UVC (1993:0101)[   94.317582] usb 1-1: Scanning UVC chain:[   94.317812]  OT 3 <- PU 2 <- IT 1[   94.318047] usb 1-1: Found a valid video chain (1 -> 3)[   94.323796] usb 1-1: UVC device initialized[   94.324422] usb 1-1: Probing generic UVC device 1[   94.326098] usb 1-1: Found format NV12 little-endian (0x3231564e)[   94.326771] usb 1-1: - 1280x720 (39.0 fps)[   94.327083] usb 1-1: Found format H264 little-endian (0x34363248)[   94.327581] usb 1-1: - 1280x720 (39.0 fps)[   94.327998] usb 1-1: Found format MJPG little-endian (0x47504a4d)[   94.328650] usb 1-1: - 1280x720 (39.0 fps)[   94.328955] usb 1-1: Found UVC 1.10 device .UVC (1993:0101)[   94.329397] usb 1-1: Scanning UVC chain:[   94.329617]  OT 6 <- PU 5 <- IT 4[   94.329836] usb 1-1: Found a valid video chain (4 -> 6)[   94.334657] usb 1-1: UVC device initialized

设备的串口打印

ITF:1 ID:0 GET CS:1 REQ:87 B:281802d0 OF:216 LEN:3401 00 03 01 919 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 300 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:1 ID:0 SET CS:1 REQ:1 B:281802d0 OF:0 LEN:34probe format:3,frame:101 00 03 01 919 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 300 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:1 ID:0 GET CS:1 REQ:81 B:281802d0 OF:0 LEN:3401 00 03 01 919 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 300 ff 03 00 00 80 c3 c9 01 03 00 00 00 uvc set itf 3 0,active_itf:0ITF:3 ID:0 GET CS:1 REQ:87 B:281803cc OF:216 LEN:3401 00 03 01 919 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 300 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:3 ID:0 SET CS:1 REQ:1 B:281803cc OF:0 LEN:34probe format:3,frame:101 00 03 01 919 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 300 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:3 ID:0 GET CS:1 REQ:81 B:281803cc OF:0 LEN:3401 00 03 01 919 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 300 ff 03 00 00 80 c3 c9 01 03 00 00 00 

运行

sudo guvcview

查看dmesg

[  201.207930] usb 1-1: uvc_v4l2_open[  201.210377] usb 1-1: uvc_v4l2_release[  201.212104] usb 1-1: uvc_v4l2_open[  201.213039] usb 1-1: uvc_v4l2_release[  201.215030] usb 1-1: uvc_v4l2_open[  201.216886] usb 1-1Control 0x00980900 not found[  201.217702] usb 1-1Control 0x00980901 not found[  201.218261] usb 1-1Control 0x00980902 not found[  201.218770] usb 1-1Control 0x00980903 not found[  201.219250] usb 1-1Control 0x00980904 not found[  201.219726] usb 1-1Control 0x00980905 not found[  201.220225] usb 1-1Control 0x00980906 not found[  201.220745] usb 1-1Control 0x00980907 not found[  201.221266] usb 1-1Control 0x00980908 not found[  201.221701] usb 1-1Control 0x00980909 not found[  201.222089] usb 1-1Control 0x0098090a not found[  201.222467] usb 1-1Control 0x0098090b not found[  201.222827] usb 1-1Control 0x0098090c not found[  201.223221] usb 1-1Control 0x0098090d not found[  201.223588] usb 1-1Control 0x0098090e not found[  201.223973] usb 1-1Control 0x0098090f not found[  201.224394] usb 1-1Control 0x00980910 not found[  201.224778] usb 1-1Control 0x00980911 not found[  201.225139] usb 1-1Control 0x00980912 not found[  201.225478] usb 1-1Control 0x00980913 not found[  201.225824] usb 1-1Control 0x00980914 not found[  201.226177] usb 1-1Control 0x00980915 not found[  201.226549] usb 1-1Control 0x00980916 not found[  201.226929] usb 1-1Control 0x00980917 not found[  201.227379] usb 1-1Control 0x00980918 not found[  201.227785] usb 1-1Control 0x00980919 not found[  201.228152] usb 1-1Control 0x0098091a not found[  201.228523] usb 1-1Control 0x0098091b not found[  201.229016] usb 1-1Control 0x0098091c not found[  201.229670] usb 1-1Control 0x0098091d not found[  201.230266] usb 1-1Control 0x0098091e not found[  201.231027] usb 1-1Control 0x0098091f not found[  201.231680] usb 1-1Control 0x00980920 not found[  201.232314] usb 1-1Control 0x00980921 not found[  201.232860] usb 1-1Control 0x00980922 not found[  201.233365] usb 1-1Control 0x00980923 not found[  201.234030] usb 1-1Control 0x00980924 not found[  201.234480] usb 1-1Control 0x00980925 not found[  201.234925] usb 1-1Control 0x00980926 not found[  201.235382] usb 1-1Control 0x00980927 not found[  201.235820] usb 1-1Control 0x00980928 not found[  201.236251] usb 1-1Control 0x00980929 not found[  201.236697] usb 1-1Control 0x0098092a not found[  201.237144] usb 1-1Control 0x009a0900 not found[  201.237609] usb 1-1Control 0x009a0901 not found[  201.238100] usb 1-1Control 0x009a0902 not found[  201.238452] usb 1-1Control 0x009a0903 not found[  201.238796] usb 1-1Control 0x009a0904 not found[  201.239199] usb 1-1Control 0x009a0905 not found[  201.239802] usb 1-1Control 0x009a0906 not found[  201.240136] usb 1-1Control 0x009a0907 not found[  201.240470] usb 1-1Control 0x009a0908 not found[  201.240846] usb 1-1Control 0x009a0909 not found[  201.241240] usb 1-1Control 0x009a090a not found[  201.241628] usb 1-1Control 0x009a090b not found[  201.242255] usb 1-1Control 0x009a090c not found[  201.242884] usb 1-1Control 0x009a090d not found[  201.243589] usb 1-1Control 0x009a090e not found[  201.244387] usb 1-1Control 0x009a090f not found[  201.245005] usb 1-1Control 0x009a0910 not found[  201.245797] usb 1-1Control 0x009a0911 not found[  201.246278] usb 1-1Control 0x009a0912 not found[  201.246899] usb 1-1Control 0x009a0913 not found[  201.247883] usb 1-1Control 0x009a0914 not found[  201.248643] usb 1-1Control 0x009a0915 not found[  201.249343] usb 1-1Control 0x009a0916 not found[  201.249885] usb 1-1Control 0x009a0917 not found[  201.250389] usb 1-1Control 0x009a0918 not found[  201.250938] usb 1-1Control 0x009a0919 not found[  201.251443] usb 1-1Control 0x009a091a not found[  201.251968] usb 1-1Control 0x009a091b not found[  201.252459] usb 1-1Control 0x009a091c not found[  201.252964] usb 1-1Control 0x009a091d not found[  201.253356] usb 1-1Control 0x009a091e not found[  201.253736] usb 1-1Control 0x009a091f not found[  201.254114] usb 1-1Control 0x08000000 not found[  201.277422] usb 1-1Trying format 0x47504a4d (MJPG): 1280x720[  201.278244] usb 1-1Using default frame interval 25641.0 us (39.0 fps)[  201.280293] usb 1-1: drivers/media/usb/uvc/uvc_video.c 404 stream->dev->quirks:0[  201.284240] usb 1-1: drivers/media/usb/uvc/uvc_video.c 417 probe->wCompQuality:0[  201.287658] usb 1-1: drivers/media/usb/uvc/uvc_video.c 431 pstream->intf->num_altsetting:2[  201.288450] usb 1-1: drivers/media/usb/uvc/uvc_video.c 436 bandwidth:0[  201.288956] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 266 stream->nformats:3[  201.289574] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 270 match format:3[  201.290880] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 280 format->nframes:1[  201.291957] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 284 match frame:1[  201.292698] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 304 width:1280,height:720,field:1,bytesperline:0,sizeimage:0,pixelformat:1196444237,colorspace:0,xfer_func:0,ycbcr_enc:0[  201.294226] usb 1-1Trying format 0x47504a4d (MJPG): 1280x720[  201.294850] usb 1-1Using default frame interval 25641.0 us (39.0 fps)[  201.296655] usb 1-1: drivers/media/usb/uvc/uvc_video.c 404 stream->dev->quirks:0[  201.300138] usb 1-1: drivers/media/usb/uvc/uvc_video.c 417 probe->wCompQuality:0[  201.303232] usb 1-1: drivers/media/usb/uvc/uvc_video.c 431 pstream->intf->num_altsetting:2[  201.304038] usb 1-1: drivers/media/usb/uvc/uvc_video.c 436 bandwidth:0[  201.304572] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 266 stream->nformats:3[  201.305211] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 270 match format:3[  201.306009] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 280 format->nframes:1[  201.306951] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 284 match frame:1[  201.307689] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 304 width:1280,height:720,field:1,bytesperline:0,sizeimage:0,pixelformat:1196444237,colorspace:0,xfer_func:0,ycbcr_enc:0[  201.309043] usb 1-1set uvc_format[  201.309393] usb 1-1set uvc_frame[  201.317452------------[ cut here ]------------[  201.318141WARNINGCPU0 PID314 at drivers/media/common/videobuf2/videobuf2-core.c:815 vb2_core_reqbufs+0x141/0x3a0[  201.319212] Modules linked in:[  201.319551] CPU: 0 PID: 314 Comm: guvcview Not tainted 5.15.167.4-microsoft-standard-WSL2 #3[  201.320344] RIP: 0010:vb2_core_reqbufs+0x141/0x3a0[  201.320853Code85 c9 0f 84 29 02 00 00 8d 51 ff 48 8d 44 24 08 48 8d 54 94 0c eb 0d 48 83 c0 04 48 39 d0 0f 84 fe 00 00 00 8b 30 85 f6 75 ed <0f> 0b 41 bf ea ff ff ff 4c 89 e7 e8 9f 0b 49 00 4c 89 e7 c7 85 c8[  201.322443RSP0018:ffffc90005c83cb8 EFLAGS00010246[  201.322896RAX: ffffc90005c83cc0 RBX: ffffc90005c83e48 RCX0000000000000001[  201.323721RDX: ffffc90005c83cc4 RSI0000000000000000 RDI: ffff888103d38518[  201.324471RBP: ffff888103d38518 R080000000000000000 R090000000000000000[  201.325168R100000000000000000 R11: ffffffff825073e0 R12: ffff888103d385c0[  201.325884R130000000000000001 R14: ffff888103d38580 R150000000000000000[  201.326597FS:  00007fdf6cbbae80(0000GS:ffff8881dc600000(0000) knlGS:0000000000000000[  201.327312CS:  0010 DS0000 ES0000 CR00000000080050033[  201.327896CR2: 00007fdf6c914000 CR30000000102436000 CR4: 00000000003506b0[  201.328644Call Trace:[  201.328941]  <TASK>[  201.329197]  ? __warn+0x80/0x100[  201.329498]  ? vb2_core_reqbufs+0x141/0x3a0[  201.329784]  ? report_bug+0x9e/0xc0[  201.330069]  ? handle_bug+0x3c/0x70[  201.330411]  ? exc_invalid_op+0x14/0x70[  201.330884]  ? asm_exc_invalid_op+0x16/0x20[  201.331230]  ? vb2_core_reqbufs+0x141/0x3a0[  201.331569]  ? vb2_core_reqbufs+0x10c/0x3a0[  201.331970]  uvc_request_buffers+0x29/0x50[  201.332348]  uvc_ioctl_reqbufs+0x46/0xa0[  201.332755]  ? v4l_reqbufs+0x22/0x60[  201.333135]  __video_do_ioctl+0x3a0/0x3e0[  201.333470]  ? srso_return_thunk+0x5/0x10[  201.333746]  ? page_add_new_anon_rmap+0x4e/0xf0[  201.334123]  video_usercopy+0x2e1/0x760[  201.334492]  ? v4l_print_control+0x20/0x20[  201.334813]  ? srso_return_thunk+0x5/0x10[  201.335138]  v4l2_ioctl+0x49/0x50[  201.335458]  __x64_sys_ioctl+0x8a/0xc0[  201.335826]  do_syscall_64+0x35/0xb0[  201.336346]  entry_SYSCALL_64_after_hwframe+0x6c/0xd6[  201.336913] RIP: 0033:0x7fdf75fff88d[  201.337319] Code: 5b 41 5c c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 73 b5 0f 00 f7 d8 64 89 01 48[  201.339122] RSP: 002b:00007fff1e1e6228 EFLAGS: 00000246 ORIG_RAX: 0000000000000010[  201.340090] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fdf75fff88d[  201.340851] RDX: 000056188e4826c0 RSI: 00000000c0145608 RDI: 0000000000000004[  201.341590] RBP: 00000000c0145608 R08: 0000000000000000 R09: 0000000000000000[  201.342302] R10: 00007fdf75edd020 R11: 0000000000000246 R12: 0000000000000004[  201.342997] R13: 0000000000000000 R14: 00007fdf75edd020 R15: 000056188e4826c0[  201.343714]  TASK>[  201.343945---[ end trace ad1f2ae766fc9251 ]---[  201.344584] usb 1-1Trying format 0x3231564e (NV12): 1280x720[  201.345253] usb 1-1Using default frame interval 25641.0 us (39.0 fps)[  201.346991] usb 1-1: drivers/media/usb/uvc/uvc_video.c 404 stream->dev->quirks:0[  201.350002] usb 1-1: drivers/media/usb/uvc/uvc_video.c 417 probe->wCompQuality:0[  201.353228] usb 1-1: drivers/media/usb/uvc/uvc_video.c 431 pstream->intf->num_altsetting:2[  201.354172] usb 1-1: drivers/media/usb/uvc/uvc_video.c 436 bandwidth:0[  201.354830] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 266 stream->nformats:3[  201.355624] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 270 match format:1[  201.356352] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 280 format->nframes:1[  201.357123] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 284 match frame:1[  201.357714] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 304 width:1280,height:720,field:1,bytesperline:1280,sizeimage:1382400,pixelformat:842094158,colorspace:8,xfer_func:1,ycbcr_enc:1[  201.359176] usb 1-1Trying format 0x3231564e (NV12): 1280x720[  201.359782] usb 1-1Using default frame interval 25641.0 us (39.0 fps)[  201.361507] usb 1-1: drivers/media/usb/uvc/uvc_video.c 404 stream->dev->quirks:0[  201.364710] usb 1-1: drivers/media/usb/uvc/uvc_video.c 417 probe->wCompQuality:0[  201.368030] usb 1-1: drivers/media/usb/uvc/uvc_video.c 431 pstream->intf->num_altsetting:2[  201.368993] usb 1-1: drivers/media/usb/uvc/uvc_video.c 436 bandwidth:0[  201.369637] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 266 stream->nformats:3[  201.370419] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 270 match format:1[  201.371077] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 280 format->nframes:1[  201.371718] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 284 match frame:1[  201.372273] usb 1-1: drivers/media/usb/uvc/uvc_v4l2.c 304 width:1280,height:720,field:1,bytesperline:1280,sizeimage:1382400,pixelformat:842094158,colorspace:8,xfer_func:1,ycbcr_enc:1[  201.373622] usb 1-1set uvc_format[  201.373912] usb 1-1set uvc_frame[  201.378054] usb 1-1: uvc_v4l2_mmap[  201.378682] usb 1-1: uvc_v4l2_mmap[  201.379126] usb 1-1: uvc_v4l2_mmap[  201.379550] usb 1-1: uvc_v4l2_mmap[  201.379974] usb 1-1Setting frame interval to 1/25 (400000)[  201.381805] usb 1-1: drivers/media/usb/uvc/uvc_video.c 404 stream->dev->quirks:0[  201.385213] usb 1-1: drivers/media/usb/uvc/uvc_video.c 417 probe->wCompQuality:0[  201.388137] usb 1-1: drivers/media/usb/uvc/uvc_video.c 431 pstream->intf->num_altsetting:2[  201.389009] usb 1-1: drivers/media/usb/uvc/uvc_video.c 436 bandwidth:0[  201.497158] misc dxg: dxgk: dxgkio_is_feature_enabled: Ioctl failed: -22[  201.500618] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22[  201.501538] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22[  201.502355] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22[  201.503101] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22[  201.503963] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2[  201.670572] usb 1-1: Device requested null bandwidth, defaulting to lowest[  201.671624] usb 1-1: Selecting alternate setting 1 (1024 B/frame bandwidth)[  201.676945] usb 1-1Allocated 5 URB buffers of 32x1024 bytes each[  201.678552] usb 1-1: uvc_v4l2_poll[  201.836093] usb 1-1Frame complete (EOF found)[  201.995351] usb 1-1: frame 1 stats: 0/23/23 packets, 0/0/0 pts (!early !initial), 0/0 scr, last pts/stc/sof 0/0/0[  202.027253] usb 1-1: Frame complete (EOF found)[  202.187363] usb 1-1: frame 2 stats: 0/23/23 packets, 0/0/0 pts (!early !initial), 0/0 scr, last pts/stc/sof 0/0/0[  202.188630] usb 1-1Frame complete (EOF found)[  202.347510] usb 1-1: frame 3 stats: 0/23/23 packets, 0/0/0 pts (!early !initial), 0/0 scr, last pts/stc/sof 0/0/0[  202.379318] usb 1-1: Frame complete (EOF found)[  202.539504] usb 1-1: frame 4 stats: 0/22/22 packets, 0/0/0 pts (!early !initial), 0/0 scr, last pts/stc/sof 0/0/0[  202.541300] usb 1-1Frame complete (EOF found)[  202.679618] usb 1-1: uvc_v4l2_poll[  202.681203] vhci_hcd: unlink->seqnum 82[  202.682047] vhci_hcd: urb->status -104[  202.683629] vhci_hcd: unlink->seqnum 83[  202.684305] vhci_hcd: urb->status -104[  202.685409] vhci_hcd: unlink->seqnum 84[  202.686028] vhci_hcd: urb->status -104[  202.687147] vhci_hcd: unlink->seqnum 85[  202.687768] vhci_hcd: urb->status -104[  202.690592] vhci_hcd: unlink->seqnum 86[  202.691222] vhci_hcd: urb->status -104[  202.697097] usb 1-1Setting frame interval to 1/39 (256410)[  202.699608] usb 1-1: drivers/media/usb/uvc/uvc_video.c 404 stream->dev->quirks:0[  202.702845] usb 1-1: drivers/media/usb/uvc/uvc_video.c 417 probe->wCompQuality:0[  202.706362] usb 1-1: drivers/media/usb/uvc/uvc_video.c 431 pstream->intf->num_altsetting:2[  202.707301] usb 1-1: drivers/media/usb/uvc/uvc_video.c 436 bandwidth:0[  202.707997] usb 1-1: uvc_v4l2_mmap[  202.708448] usb 1-1: uvc_v4l2_mmap[  202.708839] usb 1-1: uvc_v4l2_mmap[  202.709265] usb 1-1: uvc_v4l2_mmap[  202.710815] usb 1-1: Device requested null bandwidth, defaulting to lowest[  202.711466] usb 1-1: Selecting alternate setting 1 (1024 B/frame bandwidth)[  202.716751] usb 1-1Allocated 5 URB buffers of 32x1024 bytes each[  202.717703] usb 1-1: uvc_v4l2_poll[  202.745431] usb 1-1Frame complete (EOF found)[  202.905409] usb 1-1: frame 1 stats: 0/23/23 packets, 0/0/0 pts (!early !initial), 0/0 scr, last pts/stc/sof 0/0/0[  202.937378] usb 1-1: Frame complete (EOF found)[  203.097862] usb 1-1: frame 2 stats: 0/23/23 packets, 0/0/0 pts (!early !initial), 0/0 scr, last pts/stc/sof 0/0/0[  203.099538] usb 1-1Frame complete (EOF found)[  203.257478] usb 1-1: frame 3 stats: 0/22/22 packets, 0/0/0 pts (!early !initial), 0/0 scr, last pts/stc/sof 0/0/0[  203.289444] usb 1-1: Frame complete (EOF found)[  203.449523] usb 1-1: frame 4 stats: 0/23/23 packets, 0/0/0 pts (!early !initial), 0/0 scr, last pts/stc/sof 0/0/0[  203.451155] usb 1-1Frame complete (EOF found)[  203.609555] usb 1-1: frame 5 stats: 0/23/23 packets, 0/0/0 pts (!early !initial), 0/0 scr, last pts/stc/sof 0/0/0[  203.641387] usb 1-1: Frame complete (EOF found)[  203.718912] usb 1-1: uvc_v4l2_poll[  203.719763] usb 1-1: uvc_v4l2_poll[  203.801564] usb 1-1: frame 6 stats: 0/23/23 packets, 0/0/0 pts (!early !initial), 0/0 scr, last pts/stc/sof 0/0/0[  203.803195] usb 1-1Frame complete (EOF found)[  203.961536] usb 1-1: frame 7 stats: 0/22/22 packets, 0/0/0 pts (!early !initial), 0/0 scr, last pts/stc/sof 0/0/0[  203.993402] usb 1-1: Frame complete (EOF found)[  204.153744] usb 1-1: frame 8 stats: 0/23/23 packets, 0/0/0 pts (!early !initial), 0/0 scr, last pts/stc/sof 0/0/0[  204.156312] usb 1-1Frame complete (EOF found)[  204.313624] usb 1-1: frame 9 stats: 0/23/23 packets, 0/0/0 pts (!early !initial), 0/0 scr, last pts/stc/sof 0/0/0[  204.345445] usb 1-1: Frame complete (EOF found)[  204.505525] usb 1-1: frame 10 stats: 0/23/23 packets, 0/0/0 pts (!early !initial), 0/0 scr, last pts/stc/sof 0/0/0[  204.506837] usb 1-1Frame complete (EOF found)[  204.665466] usb 1-1: frame 11 stats: 0/22/22 packets, 0/0/0 pts (!early !initial), 0/0 scr, last pts/stc/sof 0/0/0[  204.697380] usb 1-1Frame complete (EOF found)[  204.720845] usb 1-1: uvc_v4l2_poll[  204.722161] vhci_hcd: unlink->seqnum 162[  204.722797] vhci_hcd: urb->status -104[  204.724195] vhci_hcd: unlink->seqnum 163[  204.724792] vhci_hcd: urb->status -104[  204.725940] vhci_hcd: unlink->seqnum 164[  204.726487] vhci_hcd: urb->status -104[  204.727479] vhci_hcd: unlink->seqnum 165[  204.728023] vhci_hcd: urb->status -104[  204.729319] vhci_hcd: unlink->seqnum 166[  204.729871] vhci_hcd: urb->status -104[  204.742738] usb 1-1: uvc_v4l2_releaseqinyunti@qinyunti:~$

此时串口打印

sh>ITF:1 ID:0 SET CS:1 REQ:1 B:281802d0 OF:0 LEN:34probe format:3,frame:101 00 03 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 GET CS:1 REQ:82 B:281802d0 OF:36 LEN:3401 00 01 01 9a 19 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 3f 00 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:1 ID:0 GET CS:1 REQ:83 B:281802d0 OF:72 LEN:3401 00 03 01 9a 19 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 3f 00 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:1 ID:0 SET CS:1 REQ:1 B:281802d0 OF:0 LEN:34probe format:3,frame:101 00 03 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 GET CS:1 REQ:81 B:281802d0 OF:0 LEN:3401 00 03 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 SET CS:1 REQ:1 B:281802d0 OF:0 LEN:34probe format:3,frame:101 00 03 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 GET CS:1 REQ:82 B:281802d0 OF:36 LEN:3401 00 01 01 9a 19 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 3f 00 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:1 ID:0 GET CS:1 REQ:83 B:281802d0 OF:72 LEN:3401 00 03 01 9a 19 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 3f 00 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:1 ID:0 SET CS:1 REQ:1 B:281802d0 OF:0 LEN:34probe format:3,frame:101 00 03 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 GET CS:1 REQ:81 B:281802d0 OF:0 LEN:3401 00 03 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 SET CS:1 REQ:1 B:281802d0 OF:0 LEN:34probe format:1,frame:101 00 01 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 GET CS:1 REQ:82 B:281802d0 OF:36 LEN:3401 00 01 01 9a 19 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 3f 00 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:1 ID:0 GET CS:1 REQ:83 B:281802d0 OF:72 LEN:3401 00 03 01 9a 19 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 3f 00 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:1 ID:0 SET CS:1 REQ:1 B:281802d0 OF:0 LEN:34probe format:1,frame:101 00 01 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 GET CS:1 REQ:81 B:281802d0 OF:0 LEN:3401 00 01 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 SET CS:1 REQ:1 B:281802d0 OF:0 LEN:34probe format:1,frame:101 00 01 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 GET CS:1 REQ:82 B:281802d0 OF:36 LEN:3401 00 01 01 9a 19 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 3f 00 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:1 ID:0 GET CS:1 REQ:83 B:281802d0 OF:72 LEN:3401 00 03 01 9a 19 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 3f 00 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:1 ID:0 SET CS:1 REQ:1 B:281802d0 OF:0 LEN:34probe format:1,frame:101 00 01 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 GET CS:1 REQ:81 B:281802d0 OF:0 LEN:3401 00 01 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 SET CS:1 REQ:1 B:281802d0 OF:0 LEN:34probe format:1,frame:101 00 01 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 18 15 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 GET CS:1 REQ:82 B:281802d0 OF:36 LEN:3401 00 01 01 9a 19 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 3f 00 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:1 ID:0 GET CS:1 REQ:83 B:281802d0 OF:72 LEN:3401 00 03 01 9a 19 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 3f 00 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:1 ID:0 SET CS:1 REQ:1 B:281802d0 OF:0 LEN:34probe format:1,frame:101 00 01 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 18 15 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 GET CS:1 REQ:81 B:281802d0 OF:0 LEN:3401 00 01 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 18 15 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 SET CS:2 REQ:1 B:281800d8 OF:0 LEN:34commit format:1,frame:101 00 01 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 18 15 00 00 00 00 00 00 00 00 00 00 00 00 00 uvc set itf 1 1,active_itf:1dev:0,itf:1,format:1,frame:1mjpeg 0 used:8424(uS) len:22567dev:0,itf:1,format:1,frame:1mjpeg 0 used:8419(uS) len:22613dev:0,itf:1,format:1,frame:1mjpeg 0 used:8418(uS) len:22054dev:0,itf:1,format:1,frame:1mjpeg 0 used:8421(uS) len:23084dev:0,itf:1,format:1,frame:1mjpeg 0 used:8421(uS) len:22819dev:0,itf:1,format:1,frame:1mjpeg 0 used:8422(uS) len:22746uvc set itf 1 0,active_itf:0ITF:1 ID:0 SET CS:1 REQ:1 B:281802d0 OF:0 LEN:34probe format:1,frame:101 00 01 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 18 15 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 GET CS:1 REQ:82 B:281802d0 OF:36 LEN:3401 00 01 01 9a 19 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 3f 00 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:1 ID:0 GET CS:1 REQ:83 B:281802d0 OF:72 LEN:3401 00 03 01 9a 19 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 3f 00 ff 03 00 00 80 c3 c9 01 03 00 00 00 ITF:1 ID:0 SET CS:1 REQ:1 B:281802d0 OF:0 LEN:34probe format:1,frame:101 00 01 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 18 15 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 GET CS:1 REQ:81 B:281802d0 OF:0 LEN:3401 00 01 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 18 15 00 00 00 00 00 00 00 00 00 00 00 00 00 ITF:1 ID:0 SET CS:2 REQ:1 B:281800d8 OF:0 LEN:34commit format:1,frame:101 00 01 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 18 15 00 00 00 00 00 00 00 00 00 00 00 00 00 uvc set itf 1 1,active_itf:1dev:0,itf:1,format:1,frame:1mjpeg 0 used:8420(uS) len:21833dev:0,itf:1,format:1,frame:1

对照可以看到dwMaxPayloadTransferSize0,而该值从GET_CUR

前面的ret = uvc_get_video_ctrl(stream, probe, 1, UVC_GET_CUR);获取

即设备返回的34字节的偏移22字节处的值

ctrl->dwMaxPayloadTransferSize = get_unaligned_le32(&data[22]);

从打印看HOST SET_CUR发送的值是,这部分填写0device的逻辑是收到SET_CUR后覆盖,GET_CUR时返回的是上一次的值。

ITF:1 ID:0 SET CS:1 REQ:1 B:281802d0 OF:0 LEN:34

probe format:3,frame:1

01 00 03 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

ITF:1 ID:0 GET CS:1 REQ:82 B:281802d0 OF:36 LEN:34

01 00 01 01 9a 19 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 3f 00 ff 03 00 00 80 c3 c9 01 03 00 00 00 

ITF:1 ID:0 GET CS:1 REQ:83 B:281802d0 OF:72 LEN:34

01 00 03 01 9a 19 03 00 00 00 00 00 00 00 00 00 00 00 00 c0 3f 00 ff 03 00 00 80 c3 c9 01 03 00 00 00 

ITF:1 ID:0 SET CS:1 REQ:1 B:281802d0 OF:0 LEN:34

probe format:3,frame:1

01 00 03 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

ITF:1 ID:0 GET CS:1 REQ:81 B:281802d0 OF:0 LEN:34

01 00 03 01 9a e9 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

这里device的逻辑有问题,需要修改下,

SET时只有非零值才会生效,才会覆盖CUR值,0值不覆盖原来的CUR值。

UVC的规格书中其实也有类似的介绍。

修改了上述问题之后,再测试看到了打印如下信息

“Dropping payload (out of sync)”

我们查找对应的代码处

可以看到如下逻辑,看到fid一直不变才会有这个打印,那么基本就确认问题了

再去看设备那边的代码,确实是多设备使用了同一个fid记录,增加设备时忘记改这里了,导致一个设备tog fid,然后另一个设备又tog fid,最终看起来是fid没变。修改就很简单,各个设备使用各自的fid记录就可以了。

以上实际也可以通过抓包查看发出的包是否FID FED正确也可以发现,分享以上,重点在于以上分析调试方法。打印相关信息会更加直观。

.使用qv4l2进行UVC查看

除了之前提的guvcview这里还推荐下qv4l2工具,在linux下进行uvc的查看。

sudo apt install v4l-utils

sudo apt install qv4l2

sudo qv4l2

这里双UVC设备显示如下

.总结

以上主要是分享基于WSL2如何修改内核UVC相关代码,增加调试信息去进行调试,问题本身不是很重要,重点是分享分析过程。而分享的案例本身的问题,一个是Probe Commit处理时对SET_CUR的处理不合理,将0值也进行了覆盖,一个是增加多设备支持时把负载头的FID共用了,没有区分开,导致一个设备发完一帧TOGFID,下一个设备又发一帧又TOGFID,两次TOG之后导致某一个设备的FID始终不变,windows下能够处理这种问题(这里发的是MJPEG猜测系统是根据负载头的FED位区分,或者是根据MPJEG本身头尾标志区分的)linux下则无法区分帧,解决办法是多个设备各自使用自己的FID记录。这里也可以看出windows确实兼容性是做的很好的,考虑了很多容错处理,虽然这里是设备那边的问题,但是这种不是致命的问题windows能正常显示,linux则不能。




评论 (0)
  • 在嵌入式语音系统的开发过程中,广州唯创电子推出的WT588系列语音芯片凭借其优异的音质表现和灵活的编程特性,广泛应用于智能终端、工业控制、消费电子等领域。作为该系列芯片的关键状态指示信号,BUSY引脚的设计处理直接影响着系统交互的可靠性和功能拓展性。本文将从电路原理、应用场景、设计策略三个维度,深入解析BUSY引脚的技术特性及其工程实践要点。一、BUSY引脚工作原理与信号特性1.1 电气参数电平标准:输出3.3V TTL电平(与VDD同源)驱动能力:典型值±8mA(可直接驱动LED)响应延迟:语
    广州唯创电子 2025-03-26 09:26 204浏览
  • 在电子设计中,电磁兼容性(EMC)是确保设备既能抵御外部电磁干扰(EMI),又不会对自身或周围环境产生过量电磁辐射的关键。电容器、电感和磁珠作为三大核心元件,通过不同的机制协同作用,有效抑制电磁干扰。以下是其原理和应用场景的详细解析:1. 电容器:高频噪声的“吸尘器”作用原理:电容器通过“通高频、阻低频”的特性,为高频噪声提供低阻抗路径到地,形成滤波效果。例如,在电源和地之间并联电容,可吸收电源中的高频纹波和瞬态干扰。关键应用场景:电源去耦:在IC电源引脚附近放置0.1μF陶瓷电容,滤除数字电路
    时源芯微 2025-03-27 11:19 154浏览
  • 案例概况在丹麦哥本哈根,西门子工程师们成功完成了一项高安全设施的数据集成项目。他们利用宏集Cogent DataHub软件,将高安全设施内的设备和仪器与远程监控位置连接起来,让技术人员能够在不违反安全规定、不引入未经授权人员的情况下,远程操作所需设备。突破OPC 服务器的远程连接难题该项目最初看似是一个常规的 OPC 应用:目标是将高安全性设施中的冷水机(chiller)设备及其 OPC DA 服务器,与远程监控站的两套 SCADA 系统(作为 OPC DA 客户端)连接起来。然而,在实际实施过
    宏集科技 2025-03-27 13:20 109浏览
  • 文/陈昊编辑/cc孙聪颖‍2025 年,作为中国实施制造强国战略第一个十年计划的关键里程碑,被赋予了极为重大的意义。两会政府工作报告清晰且坚定地指出,要全力加速新质生产力的发展进程,推动传统产业全方位向高端化、智能化与绿色化转型。基于此,有代表敏锐提议,中国制造应从前沿技术的应用切入,逐步拓展至产业生态的构建,最终延伸到提升用户体验的维度,打出独树一帜、具有鲜明特色的发展牌。正是在这样至关重要的时代背景之下,于 AWE 2025(中国家电及消费电子博览会)这一备受瞩目的舞台上,高端厨房的中国方案
    华尔街科技眼 2025-03-25 16:10 82浏览
  • ​2025年3月27日​,贞光科技授权代理品牌紫光同芯正式发布新一代汽车安全芯片T97-415E。作为T97-315E的迭代升级产品,该芯片以大容量存储、全球化合规认证、双SPI接口协同为核心突破,直击智能网联汽车"多场景安全并行"与"出口合规"两大行业痛点,助力车企抢占智能驾驶与全球化市场双赛道。行业趋势锚定:三大升级回应智能化浪潮1. 大容量存储:破解车联网多任务瓶颈随着​车机功能泛在化​(数字钥匙、OTA、T-BOX等安全服务集成),传统安全芯片面临存储资源挤占难题。T97-415E创新性
    贞光科技 2025-03-27 13:50 148浏览
  • 在当今竞争激烈的工业环境中,效率和响应速度已成为企业制胜的关键。为了满足这一需求,我们隆重推出宏集Panorama COOX,这是Panorama Suite中首款集成的制造执行系统(MES)产品。这一创新产品将Panorama平台升级为全面的工业4.0解决方案,融合了工业SCADA和MES技术的双重优势,帮助企业实现生产效率和运营能力的全面提升。深度融合SCADA与MES,开启工业新纪元宏集Panorama COOX的诞生,源于我们对创新和卓越运营的不懈追求。通过战略性收购法国知名MES领域专
    宏集科技 2025-03-27 13:22 182浏览
  • WT588F02B是广州唯创电子推出的一款高性能语音芯片,广泛应用于智能家电、安防设备、玩具等领域。然而,在实际开发中,用户可能会遇到烧录失败的问题,导致项目进度受阻。本文将从下载连线、文件容量、线路长度三大核心因素出发,深入分析烧录失败的原因并提供系统化的解决方案。一、检查下载器与芯片的物理连接问题表现烧录时提示"连接超时"或"设备未响应",或烧录进度条卡顿后报错。原因解析接口错位:WT588F02B采用SPI/UART双模通信,若下载器引脚定义与芯片引脚未严格对应(如TXD/RXD交叉错误)
    广州唯创电子 2025-03-26 09:05 146浏览
  • 汽车导航系统市场及应用环境参照调研机构GII的研究报告中的市场预测,全球汽车导航系统市场预计将于 2030年达到472亿美元的市场规模,而2024年至2030年的年复合成长率则为可观的6.7%。汽车导航系统无疑已成为智能汽车不可或缺的重要功能之一。随着人们在日常生活中对汽车导航功能的日渐依赖,一旦出现定位不准确或地图错误等问题,就可能导致车主开错路线,平白浪费更多行车时间,不仅造成行车不便,甚或可能引发交通事故的发生。有鉴于此,如果想要提供消费者完善的使用者体验,在车辆开发阶段便针对汽车导航功能
    百佳泰测试实验室 2025-03-27 14:51 188浏览
  • 六西格玛首先是作为一个量度质量水平的指标,它代表了近乎完美的质量的水平。如果你每天都吃一个苹果,有一间水果店的老板跟你说,他们所卖的苹果,质量达到六西格玛水平,换言之,他们每卖一百万个苹果,只会有3.4个是坏的。你算了一下,发现你如果要从这个店里买到一个坏苹果,需要805年。你会还会选择其他店吗?首先发明六西格玛这个词的人——比尔·史密斯(Bill Smith)他是摩托罗拉(Motorloa)的工程师,在追求这个近乎完美的质量水平的时候,发明了一套方法模型,开始时是MAIC,后来慢慢演变成DMA
    优思学院 2025-03-27 11:47 149浏览
  • 家电,在人们的日常生活中扮演着不可或缺的角色,也是提升人们幸福感的重要组成部分,那你了解家电的发展史吗?#70年代结婚流行“四大件”:手表、自行车、缝纫机,收音机,合成“三转一响”。#80年代随着改革开放的深化,中国经济开始飞速发展,黑白电视机、冰箱、洗衣机这“新三件”,成为了人们对生活的新诉求。#90年代彩电、冰箱、全自动洗衣机开始大量进入普通家庭,快速全面普及,90年代末,家电产品实现了从奢侈品到必需品的转变。#00年代至今00年代,随着人们追求高品质生活的愿望,常用的电视机、洗衣机等已经远
    启英AI平台 2025-03-25 14:12 89浏览
  • 长期以来,智能家居对于大众家庭而言就像空中楼阁一般,华而不实,更有甚者,还将智能家居认定为资本家的营销游戏。商家们举着“智慧家居、智慧办公”的口号,将原本价格亲民、能用几十年的家电器具包装成为了高档商品,而消费者们最终得到的却是家居设备之间缺乏互操作性、不同品牌生态之间互不兼容的碎片化体验。这种早期的生态割裂现象致使消费者们对智能家居兴趣缺失,也造就了“智能家居无用论”的刻板印象。然而,自Matter协议发布之后,“命运的齿轮”开始转动,智能家居中的生态割裂现象与品牌生态之间的隔阂正被基于IP架
    华普微HOPERF 2025-03-27 09:46 109浏览
  • 在智能语音产品的开发过程中,麦克风阵列的选型直接决定了用户体验的优劣。广州唯创电子提供的单麦克风与双麦克风解决方案,为不同场景下的语音交互需求提供了灵活选择。本文将深入解析两种方案的性能差异、适用场景及工程实现要点,为开发者提供系统化的设计决策依据。一、基础参数对比分析维度单麦克风方案双麦克风方案BOM成本¥1.2-2.5元¥4.8-6.5元信噪比(1m)58-62dB65-68dB拾音角度全向360°波束成形±30°功耗8mW@3.3V15mW@3.3V典型响应延迟120ms80ms二、技术原
    广州唯创电子 2025-03-27 09:23 154浏览
我要评论
0
0
点击右上角,分享到朋友圈 我知道啦
请使用浏览器分享功能 我知道啦