media: v4l2-core: v4l2-ioctl: Printing log with dev_warn() when the pixelformat is unknown
PATCH 1/1 media: v4l2-core: v4l2-ioctl: Printing log with dev_warn() when the pixelformat is unknown
The original implementation used WARN() to notify the user of the "unknown pixelformat" error. If fmt->description can be found, the function will simply return without warnings. Recently, the description had removed from uvc since v4l_fill_fmtdesc() can provide such kind of information. However, for some of the USB cameras, such as Intel Realsense F200 returns unknown format when probe(). Thus, the WARN() message shows and confuses the user. This work changed WARN() to dev_warn() to reduce the severity of the message.
The returned video format of Intel RealSense F200 is shown as follows.
kernel: uvcvideo 2-7:1.3: Unknown video format 52564e49-2d90-4a58-920b-773f1f2c556b
kernel: uvcvideo 2-7:1.3: Unknown video format 49524e49-2d90-4a58-920b-773f1f2c556b
kernel: uvcvideo 2-7:1.3: Unknown video format 494c4552-1314-f943-a75a-ee6bbf012e23
kernel: usb 2-7: Found UVC 1.10 device Intel(R) RealSense(TM) 3D Camera (Front F200) (8086:0a66)
--- drivers/media/v4l2-core/v4l2-ioctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/v4l2-core/v4l2-ioctl.c +3 -3
@@ -1246,7 +1246,7 @@ static int v4l_enumoutput(const struct v4l2_ioctl_ops *ops,return ops->vidioc_enum_output (file, fh, p); } -static void v4l_fill_fmtdesc (struct v4l2_fmtdesc *fmt) +static void v4l_fill_fmtdesc (struct video_device *vdev,struct v4l2_fmtdesc *fmt) {const unsigned sz =sizeof (fmt->description);const char *descr =NULL ;
@@ -1504,7 +1504,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)default :if (fmt->description[0 ])return ; -WARN (1 ,"Unknown pixelformat 0x%08x\n" , fmt->pixelformat); +dev_warn (&vdev->dev,"Unknown pixelformat 0x%08x\n" , fmt->pixelformat); flags =0 ;snprintf (fmt->description, sz,"%p4cc" , &fmt->pixelformat);
@@ -1589,7 +1589,7 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops,break ; }if (ret ==0 ) -v4l_fill_fmtdesc (p); +v4l_fill_fmtdesc (vdev, p);return ret; }
Signature · 1 line
2.39.2
Hi,
Quoted 9 lines · Kate Hsuan
The original implementation used
WARN()to notify the user of the "unknown pixelformat" error. Iffmt->descriptioncan be found, the function will simply return without warnings. Recently, the description had removed from uvc sincev4l_fill_fmtdesc()can provide such kind of information. However, for some of the USB cameras, such as Intel Realsense F200 returns unknown format whenprobe(). Thus, theWARN()message shows and confuses the user. This work changedWARN()todev_warn()to reduce the severity of the message.
Quoted 8 lines
The returned video format of Intel RealSense F200 is shown as follows.
kernel: uvcvideo 2-7:1.3: Unknown video format 52564e49-2d90-4a58-920b-773f1f2c556b
kernel: uvcvideo 2-7:1.3: Unknown video format 49524e49-2d90-4a58-920b-773f1f2c556b
kernel: uvcvideo 2-7:1.3: Unknown video format 494c4552-1314-f943-a75a-ee6bbf012e23
kernel: usb 2-7: Found UVC 1.10 device Intel(R) RealSense(TM) 3D Camera (Front F200) (8086:0a66)
Thanks, patch looks good to me:
Regards,
Hans
Quoted 35 lines
--- drivers/media/v4l2-core/v4l2-ioctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/media/v4l2-core/v4l2-ioctl.c +3
-3@@ -1246,7 +1246,7 @@ static int v4l_enumoutput(const struct v4l2_ioctl_ops *ops,return ops->vidioc_enum_output (file, fh, p); } -static void v4l_fill_fmtdesc (struct v4l2_fmtdesc *fmt) +static void v4l_fill_fmtdesc (struct video_device *vdev,struct v4l2_fmtdesc *fmt) {const unsigned sz =sizeof (fmt->description);const char *descr =NULL ;@@ -1504,7 +1504,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)default :if (fmt->description[0 ])return ; -WARN (1 ,"Unknown pixelformat 0x%08x\n" , fmt->pixelformat); +dev_warn (&vdev->dev,"Unknown pixelformat 0x%08x\n" , fmt->pixelformat); flags =0 ;snprintf (fmt->description, sz,"%p4cc" , &fmt->pixelformat);@@ -1589,7 +1589,7 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops,break ; }if (ret ==0 ) -v4l_fill_fmtdesc (p); +v4l_fill_fmtdesc (vdev, p);return ret; }
Quoted 42 lines · Hans de Goede
Hi,
Quoted 9 lines · Kate Hsuan
The original implementation used
WARN()to notify the user of the "unknown pixelformat" error. Iffmt->descriptioncan be found, the function will simply return without warnings. Recently, the description had removed from uvc sincev4l_fill_fmtdesc()can provide such kind of information. However, for some of the USB cameras, such as Intel Realsense F200 returns unknown format whenprobe(). Thus, theWARN()message shows and confuses the user. This work changedWARN()todev_warn()to reduce the severity of the message.Quoted 8 lines
The returned video format of Intel RealSense F200 is shown as follows.
kernel: uvcvideo 2-7:1.3: Unknown video format 52564e49-2d90-4a58-920b-773f1f2c556b
kernel: uvcvideo 2-7:1.3: Unknown video format 49524e49-2d90-4a58-920b-773f1f2c556b
kernel: uvcvideo 2-7:1.3: Unknown video format 494c4552-1314-f943-a75a-ee6bbf012e23
kernel: usb 2-7: Found UVC 1.10 device Intel(R) RealSense(TM) 3D Camera (Front F200) (8086:0a66)Thanks, patch looks good to me:
Reviewed-by Hans de Goede <[email protected]>Regards,
Hans
Quoted 12 lines
--- drivers/media/v4l2-core/v4l2-ioctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/media/v4l2-core/v4l2-ioctl.c +0
-0@@ -1246,7 +1246,7 @@ static int v4l_enumoutput(const struct v4l2_ioctl_ops *ops,return ops->vidioc_enum_output (file, fh, p); }
Quoted 11 lines
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) · line 1507
Quoted 11 lines
drivers/media/v4l2-core/v4l2-ioctl.c +2
-2-static void v4l_fill_fmtdesc (struct v4l2_fmtdesc *fmt) +static void v4l_fill_fmtdesc (struct video_device *vdev,struct v4l2_fmtdesc *fmt) {const unsigned sz =sizeof (fmt->description);const char *descr =NULL ;@@ -1504,7 +1504,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)default :if (fmt->description[0 ])return ; -WARN (1 ,"Unknown pixelformat 0x%08x\n" , fmt->pixelformat); +dev_warn (&vdev->dev,"Unknown pixelformat 0x%08x\n" , fmt->pixelformat);
I don't really like fixing this here. The real cause is in the uvc driver where it doesn't fill in the description for these non-standard formats.
A typical driver really should WARN here.
Quoted 4 lines
Quoted 4 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0flags =0 ;snprintf (fmt->description, sz,"%p4cc" , &fmt->pixelformat);@@ -1589,7 +1589,7 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops,
Quoted 9 lines
drivers/media/v4l2-core/v4l2-ioctl.c static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops, · line 1595
Quoted 8 lines
drivers/media/v4l2-core/v4l2-ioctl.c +1
-1break ; }if (ret ==0 ) -v4l_fill_fmtdesc (p); +v4l_fill_fmtdesc (vdev, p);return ret; }
I'll post a new patch fixing this just in uvc.
Regards,
Hans