* [PATCH v2 0/2] media: uvcvideo: Drop format descriptions
@ 2023-01-04 11:19 Laurent Pinchart
2023-01-04 11:19 ` [PATCH v2 1/2] media: uvcvideo: Remove " Laurent Pinchart
2023-01-04 11:19 ` [PATCH v2 2/2] media: uvcvideo: Drop custom format names for DV formats Laurent Pinchart
0 siblings, 2 replies; 6+ messages in thread
From: Laurent Pinchart @ 2023-01-04 11:19 UTC (permalink / raw)
To: linux-media; +Cc: Ricardo Ribalda, Kieran Bingham
Hello,
This small patch series is a new version of the previous single patch
"[PATCH] media: uvcvideo: Remove format descriptions". In addition to
fixing a bug in 1/2, the newly added patch 2/2 takes it a step forward
with a further simplification.
I could squash 2/2 with 1/2 if desired, but I've decided to keep it
separate at least for now in case there would be a preference for
keeping the format name string for DV formats.
Laurent Pinchart (2):
media: uvcvideo: Remove format descriptions
media: uvcvideo: Drop custom format names for DV formats
drivers/media/usb/uvc/uvc_driver.c | 19 +++----------------
drivers/media/usb/uvc/uvc_v4l2.c | 2 --
drivers/media/usb/uvc/uvcvideo.h | 2 --
3 files changed, 3 insertions(+), 20 deletions(-)
base-commit: fb1316b0ff3fc3cd98637040ee17ab7be753aac7
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] media: uvcvideo: Remove format descriptions
2023-01-04 11:19 [PATCH v2 0/2] media: uvcvideo: Drop format descriptions Laurent Pinchart
@ 2023-01-04 11:19 ` Laurent Pinchart
2023-01-04 11:48 ` Ricardo Ribalda
2023-01-04 11:19 ` [PATCH v2 2/2] media: uvcvideo: Drop custom format names for DV formats Laurent Pinchart
1 sibling, 1 reply; 6+ messages in thread
From: Laurent Pinchart @ 2023-01-04 11:19 UTC (permalink / raw)
To: linux-media; +Cc: Ricardo Ribalda, Kieran Bingham
The V4L2 core fills format description on its own in v4l_fill_fmtdesc(),
there's no need to manually set the descriptions in the driver. This
prepares for removal of the format descriptions from the uvc_fmts table.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes since v1:
- Don't replace %pUl with %p4cc when the format is unknown
---
drivers/media/usb/uvc/uvc_driver.c | 25 ++++++++++++-------------
drivers/media/usb/uvc/uvc_v4l2.c | 2 --
drivers/media/usb/uvc/uvcvideo.h | 2 --
3 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 72c025d8e20b..9852d6f63ae8 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -228,6 +228,7 @@ static int uvc_parse_format(struct uvc_device *dev,
struct uvc_format_desc *fmtdesc;
struct uvc_frame *frame;
const unsigned char *start = buffer;
+ char fmtname[12] = { 0, };
unsigned int width_multiplier = 1;
unsigned int interval;
unsigned int i, n;
@@ -252,14 +253,10 @@ static int uvc_parse_format(struct uvc_device *dev,
fmtdesc = uvc_format_by_guid(&buffer[5]);
if (fmtdesc != NULL) {
- strscpy(format->name, fmtdesc->name,
- sizeof(format->name));
format->fcc = fmtdesc->fcc;
} else {
dev_info(&streaming->intf->dev,
"Unknown video format %pUl\n", &buffer[5]);
- snprintf(format->name, sizeof(format->name), "%pUl\n",
- &buffer[5]);
format->fcc = 0;
}
@@ -271,8 +268,6 @@ static int uvc_parse_format(struct uvc_device *dev,
*/
if (dev->quirks & UVC_QUIRK_FORCE_Y8) {
if (format->fcc == V4L2_PIX_FMT_YUYV) {
- strscpy(format->name, "Greyscale 8-bit (Y8 )",
- sizeof(format->name));
format->fcc = V4L2_PIX_FMT_GREY;
format->bpp = 8;
width_multiplier = 2;
@@ -313,7 +308,6 @@ static int uvc_parse_format(struct uvc_device *dev,
return -EINVAL;
}
- strscpy(format->name, "MJPEG", sizeof(format->name));
format->fcc = V4L2_PIX_FMT_MJPEG;
format->flags = UVC_FMT_FLAG_COMPRESSED;
format->bpp = 0;
@@ -331,13 +325,13 @@ static int uvc_parse_format(struct uvc_device *dev,
switch (buffer[8] & 0x7f) {
case 0:
- strscpy(format->name, "SD-DV", sizeof(format->name));
+ strscpy(fmtname, "SD-DV", sizeof(fmtname));
break;
case 1:
- strscpy(format->name, "SDL-DV", sizeof(format->name));
+ strscpy(fmtname, "SDL-DV", sizeof(fmtname));
break;
case 2:
- strscpy(format->name, "HD-DV", sizeof(format->name));
+ strscpy(fmtname, "HD-DV", sizeof(fmtname));
break;
default:
uvc_dbg(dev, DESCR,
@@ -347,8 +341,8 @@ static int uvc_parse_format(struct uvc_device *dev,
return -EINVAL;
}
- strlcat(format->name, buffer[8] & (1 << 7) ? " 60Hz" : " 50Hz",
- sizeof(format->name));
+ strlcat(fmtname, buffer[8] & (1 << 7) ? " 60Hz" : " 50Hz",
+ sizeof(fmtname));
format->fcc = V4L2_PIX_FMT_DV;
format->flags = UVC_FMT_FLAG_COMPRESSED | UVC_FMT_FLAG_STREAM;
@@ -376,7 +370,12 @@ static int uvc_parse_format(struct uvc_device *dev,
return -EINVAL;
}
- uvc_dbg(dev, DESCR, "Found format %s\n", format->name);
+ if (format->fcc) {
+ if (fmtname[0])
+ uvc_dbg(dev, DESCR, "Found format %s\n", fmtname);
+ else
+ uvc_dbg(dev, DESCR, "Found format %p4cc", &format->fcc);
+ }
buflen -= buffer[0];
buffer += buffer[0];
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index ed2525e7e2a5..727fafb47c1f 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -661,8 +661,6 @@ static int uvc_ioctl_enum_fmt(struct uvc_streaming *stream,
fmt->flags = 0;
if (format->flags & UVC_FMT_FLAG_COMPRESSED)
fmt->flags |= V4L2_FMT_FLAG_COMPRESSED;
- strscpy(fmt->description, format->name, sizeof(fmt->description));
- fmt->description[sizeof(fmt->description) - 1] = 0;
fmt->pixelformat = format->fcc;
return 0;
}
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index ae0066eceffd..cb504b9d7ec9 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -262,8 +262,6 @@ struct uvc_format {
u32 fcc;
u32 flags;
- char name[32];
-
unsigned int nframes;
struct uvc_frame *frame;
};
--
Regards,
Laurent Pinchart
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] media: uvcvideo: Drop custom format names for DV formats
2023-01-04 11:19 [PATCH v2 0/2] media: uvcvideo: Drop format descriptions Laurent Pinchart
2023-01-04 11:19 ` [PATCH v2 1/2] media: uvcvideo: Remove " Laurent Pinchart
@ 2023-01-04 11:19 ` Laurent Pinchart
2023-01-04 11:51 ` Ricardo Ribalda
1 sibling, 1 reply; 6+ messages in thread
From: Laurent Pinchart @ 2023-01-04 11:19 UTC (permalink / raw)
To: linux-media; +Cc: Ricardo Ribalda, Kieran Bingham
Unlike V4L2, UVC makes a distinction between the SD-DV, SDL-DV and HD-DV
formats. It also indicates whether the DV format uses 50Hz or 60Hz. This
information is parsed by the driver to construct a format name string
that is printed in a debug message, but serves no other purpose as V4L2
has a single V4L2_PIX_FMT_DV pixel format that covers all those cases.
As the information is available in the UVC descriptors, and thus
accessible to users with lsusb if they really care, don't log it in a
debug message and drop the format name string to simplify the code.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/media/usb/uvc/uvc_driver.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 9852d6f63ae8..ba41f13a2491 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -228,7 +228,6 @@ static int uvc_parse_format(struct uvc_device *dev,
struct uvc_format_desc *fmtdesc;
struct uvc_frame *frame;
const unsigned char *start = buffer;
- char fmtname[12] = { 0, };
unsigned int width_multiplier = 1;
unsigned int interval;
unsigned int i, n;
@@ -325,14 +324,10 @@ static int uvc_parse_format(struct uvc_device *dev,
switch (buffer[8] & 0x7f) {
case 0:
- strscpy(fmtname, "SD-DV", sizeof(fmtname));
- break;
case 1:
- strscpy(fmtname, "SDL-DV", sizeof(fmtname));
- break;
case 2:
- strscpy(fmtname, "HD-DV", sizeof(fmtname));
break;
+
default:
uvc_dbg(dev, DESCR,
"device %d videostreaming interface %d: unknown DV format %u\n",
@@ -341,9 +336,6 @@ static int uvc_parse_format(struct uvc_device *dev,
return -EINVAL;
}
- strlcat(fmtname, buffer[8] & (1 << 7) ? " 60Hz" : " 50Hz",
- sizeof(fmtname));
-
format->fcc = V4L2_PIX_FMT_DV;
format->flags = UVC_FMT_FLAG_COMPRESSED | UVC_FMT_FLAG_STREAM;
format->bpp = 0;
@@ -370,12 +362,8 @@ static int uvc_parse_format(struct uvc_device *dev,
return -EINVAL;
}
- if (format->fcc) {
- if (fmtname[0])
- uvc_dbg(dev, DESCR, "Found format %s\n", fmtname);
- else
- uvc_dbg(dev, DESCR, "Found format %p4cc", &format->fcc);
- }
+ if (format->fcc)
+ uvc_dbg(dev, DESCR, "Found format %p4cc", &format->fcc);
buflen -= buffer[0];
buffer += buffer[0];
--
Regards,
Laurent Pinchart
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] media: uvcvideo: Remove format descriptions
2023-01-04 11:19 ` [PATCH v2 1/2] media: uvcvideo: Remove " Laurent Pinchart
@ 2023-01-04 11:48 ` Ricardo Ribalda
0 siblings, 0 replies; 6+ messages in thread
From: Ricardo Ribalda @ 2023-01-04 11:48 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media, Kieran Bingham
Hi Laurent
On Wed, 4 Jan 2023 at 12:19, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> The V4L2 core fills format description on its own in v4l_fill_fmtdesc(),
can we s/fills/overwrites/ ?
> there's no need to manually set the descriptions in the driver. This
> prepares for removal of the format descriptions from the uvc_fmts table.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
With or without my nits:
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> Changes since v1:
>
> - Don't replace %pUl with %p4cc when the format is unknown
> ---
> drivers/media/usb/uvc/uvc_driver.c | 25 ++++++++++++-------------
> drivers/media/usb/uvc/uvc_v4l2.c | 2 --
> drivers/media/usb/uvc/uvcvideo.h | 2 --
> 3 files changed, 12 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index 72c025d8e20b..9852d6f63ae8 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -228,6 +228,7 @@ static int uvc_parse_format(struct uvc_device *dev,
> struct uvc_format_desc *fmtdesc;
> struct uvc_frame *frame;
> const unsigned char *start = buffer;
> + char fmtname[12] = { 0, };
> unsigned int width_multiplier = 1;
> unsigned int interval;
> unsigned int i, n;
> @@ -252,14 +253,10 @@ static int uvc_parse_format(struct uvc_device *dev,
> fmtdesc = uvc_format_by_guid(&buffer[5]);
>
> if (fmtdesc != NULL) {
> - strscpy(format->name, fmtdesc->name,
> - sizeof(format->name));
> format->fcc = fmtdesc->fcc;
> } else {
> dev_info(&streaming->intf->dev,
> "Unknown video format %pUl\n", &buffer[5]);
> - snprintf(format->name, sizeof(format->name), "%pUl\n",
> - &buffer[5]);
> format->fcc = 0;
> }
>
> @@ -271,8 +268,6 @@ static int uvc_parse_format(struct uvc_device *dev,
> */
> if (dev->quirks & UVC_QUIRK_FORCE_Y8) {
> if (format->fcc == V4L2_PIX_FMT_YUYV) {
> - strscpy(format->name, "Greyscale 8-bit (Y8 )",
> - sizeof(format->name));
> format->fcc = V4L2_PIX_FMT_GREY;
> format->bpp = 8;
> width_multiplier = 2;
> @@ -313,7 +308,6 @@ static int uvc_parse_format(struct uvc_device *dev,
> return -EINVAL;
> }
>
> - strscpy(format->name, "MJPEG", sizeof(format->name));
> format->fcc = V4L2_PIX_FMT_MJPEG;
> format->flags = UVC_FMT_FLAG_COMPRESSED;
> format->bpp = 0;
> @@ -331,13 +325,13 @@ static int uvc_parse_format(struct uvc_device *dev,
>
> switch (buffer[8] & 0x7f) {
> case 0:
> - strscpy(format->name, "SD-DV", sizeof(format->name));
> + strscpy(fmtname, "SD-DV", sizeof(fmtname));
> break;
> case 1:
> - strscpy(format->name, "SDL-DV", sizeof(format->name));
> + strscpy(fmtname, "SDL-DV", sizeof(fmtname));
> break;
> case 2:
> - strscpy(format->name, "HD-DV", sizeof(format->name));
> + strscpy(fmtname, "HD-DV", sizeof(fmtname));
> break;
> default:
> uvc_dbg(dev, DESCR,
> @@ -347,8 +341,8 @@ static int uvc_parse_format(struct uvc_device *dev,
> return -EINVAL;
> }
>
> - strlcat(format->name, buffer[8] & (1 << 7) ? " 60Hz" : " 50Hz",
> - sizeof(format->name));
> + strlcat(fmtname, buffer[8] & (1 << 7) ? " 60Hz" : " 50Hz",
> + sizeof(fmtname));
>
> format->fcc = V4L2_PIX_FMT_DV;
> format->flags = UVC_FMT_FLAG_COMPRESSED | UVC_FMT_FLAG_STREAM;
> @@ -376,7 +370,12 @@ static int uvc_parse_format(struct uvc_device *dev,
> return -EINVAL;
> }
>
> - uvc_dbg(dev, DESCR, "Found format %s\n", format->name);
> + if (format->fcc) {
> + if (fmtname[0])
> + uvc_dbg(dev, DESCR, "Found format %s\n", fmtname);
> + else
> + uvc_dbg(dev, DESCR, "Found format %p4cc", &format->fcc);
> + }
>
> buflen -= buffer[0];
> buffer += buffer[0];
> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
> index ed2525e7e2a5..727fafb47c1f 100644
> --- a/drivers/media/usb/uvc/uvc_v4l2.c
> +++ b/drivers/media/usb/uvc/uvc_v4l2.c
> @@ -661,8 +661,6 @@ static int uvc_ioctl_enum_fmt(struct uvc_streaming *stream,
> fmt->flags = 0;
> if (format->flags & UVC_FMT_FLAG_COMPRESSED)
> fmt->flags |= V4L2_FMT_FLAG_COMPRESSED;
> - strscpy(fmt->description, format->name, sizeof(fmt->description));
> - fmt->description[sizeof(fmt->description) - 1] = 0;
> fmt->pixelformat = format->fcc;
> return 0;
> }
> diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
> index ae0066eceffd..cb504b9d7ec9 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -262,8 +262,6 @@ struct uvc_format {
> u32 fcc;
> u32 flags;
>
> - char name[32];
> -
> unsigned int nframes;
> struct uvc_frame *frame;
> };
> --
> Regards,
>
> Laurent Pinchart
>
--
Ricardo Ribalda
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] media: uvcvideo: Drop custom format names for DV formats
2023-01-04 11:19 ` [PATCH v2 2/2] media: uvcvideo: Drop custom format names for DV formats Laurent Pinchart
@ 2023-01-04 11:51 ` Ricardo Ribalda
2023-01-04 12:18 ` Laurent Pinchart
0 siblings, 1 reply; 6+ messages in thread
From: Ricardo Ribalda @ 2023-01-04 11:51 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media, Kieran Bingham
Hi Laurent
For what it's worth, I am pro squash :)
On Wed, 4 Jan 2023 at 12:19, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Unlike V4L2, UVC makes a distinction between the SD-DV, SDL-DV and HD-DV
> formats. It also indicates whether the DV format uses 50Hz or 60Hz. This
> information is parsed by the driver to construct a format name string
> that is printed in a debug message, but serves no other purpose as V4L2
> has a single V4L2_PIX_FMT_DV pixel format that covers all those cases.
>
> As the information is available in the UVC descriptors, and thus
> accessible to users with lsusb if they really care, don't log it in a
> debug message and drop the format name string to simplify the code.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
With or without my nits
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> drivers/media/usb/uvc/uvc_driver.c | 18 +++---------------
> 1 file changed, 3 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index 9852d6f63ae8..ba41f13a2491 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -228,7 +228,6 @@ static int uvc_parse_format(struct uvc_device *dev,
> struct uvc_format_desc *fmtdesc;
> struct uvc_frame *frame;
> const unsigned char *start = buffer;
> - char fmtname[12] = { 0, };
> unsigned int width_multiplier = 1;
> unsigned int interval;
> unsigned int i, n;
> @@ -325,14 +324,10 @@ static int uvc_parse_format(struct uvc_device *dev,
>
> switch (buffer[8] & 0x7f) {
> case 0:
> - strscpy(fmtname, "SD-DV", sizeof(fmtname));
> - break;
> case 1:
> - strscpy(fmtname, "SDL-DV", sizeof(fmtname));
> - break;
> case 2:
> - strscpy(fmtname, "HD-DV", sizeof(fmtname));
> break;
> +
> default:
> uvc_dbg(dev, DESCR,
> "device %d videostreaming interface %d: unknown DV format %u\n",
> @@ -341,9 +336,6 @@ static int uvc_parse_format(struct uvc_device *dev,
> return -EINVAL;
> }
>
> - strlcat(fmtname, buffer[8] & (1 << 7) ? " 60Hz" : " 50Hz",
> - sizeof(fmtname));
> -
> format->fcc = V4L2_PIX_FMT_DV;
> format->flags = UVC_FMT_FLAG_COMPRESSED | UVC_FMT_FLAG_STREAM;
> format->bpp = 0;
> @@ -370,12 +362,8 @@ static int uvc_parse_format(struct uvc_device *dev,
> return -EINVAL;
> }
>
> - if (format->fcc) {
> - if (fmtname[0])
> - uvc_dbg(dev, DESCR, "Found format %s\n", fmtname);
> - else
> - uvc_dbg(dev, DESCR, "Found format %p4cc", &format->fcc);
> - }
Maybe it is the way that I debug the issues. I run an OK execution
with a FAIl one and then I compare results. I tend to prefer that the
extra lines are errors and there is no missing lines.... but I if your
prefer it this way, I am ok with it ;)
> + if (format->fcc)
> + uvc_dbg(dev, DESCR, "Found format %p4cc", &format->fcc);
>
> buflen -= buffer[0];
> buffer += buffer[0];
> --
> Regards,
>
> Laurent Pinchart
>
--
Ricardo Ribalda
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] media: uvcvideo: Drop custom format names for DV formats
2023-01-04 11:51 ` Ricardo Ribalda
@ 2023-01-04 12:18 ` Laurent Pinchart
0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2023-01-04 12:18 UTC (permalink / raw)
To: Ricardo Ribalda; +Cc: linux-media, Kieran Bingham
Hi Ricardo,
On Wed, Jan 04, 2023 at 12:51:11PM +0100, Ricardo Ribalda wrote:
> Hi Laurent
>
> For what it's worth, I am pro squash :)
Works for me. I'll give a few more days for people to comment and then
I'll send a squashed v3.
> On Wed, 4 Jan 2023 at 12:19, Laurent Pinchart wrote:
> >
> > Unlike V4L2, UVC makes a distinction between the SD-DV, SDL-DV and HD-DV
> > formats. It also indicates whether the DV format uses 50Hz or 60Hz. This
> > information is parsed by the driver to construct a format name string
> > that is printed in a debug message, but serves no other purpose as V4L2
> > has a single V4L2_PIX_FMT_DV pixel format that covers all those cases.
> >
> > As the information is available in the UVC descriptors, and thus
> > accessible to users with lsusb if they really care, don't log it in a
> > debug message and drop the format name string to simplify the code.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> With or without my nits
>
> Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
>
> > ---
> > drivers/media/usb/uvc/uvc_driver.c | 18 +++---------------
> > 1 file changed, 3 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> > index 9852d6f63ae8..ba41f13a2491 100644
> > --- a/drivers/media/usb/uvc/uvc_driver.c
> > +++ b/drivers/media/usb/uvc/uvc_driver.c
> > @@ -228,7 +228,6 @@ static int uvc_parse_format(struct uvc_device *dev,
> > struct uvc_format_desc *fmtdesc;
> > struct uvc_frame *frame;
> > const unsigned char *start = buffer;
> > - char fmtname[12] = { 0, };
> > unsigned int width_multiplier = 1;
> > unsigned int interval;
> > unsigned int i, n;
> > @@ -325,14 +324,10 @@ static int uvc_parse_format(struct uvc_device *dev,
> >
> > switch (buffer[8] & 0x7f) {
> > case 0:
> > - strscpy(fmtname, "SD-DV", sizeof(fmtname));
> > - break;
> > case 1:
> > - strscpy(fmtname, "SDL-DV", sizeof(fmtname));
> > - break;
> > case 2:
> > - strscpy(fmtname, "HD-DV", sizeof(fmtname));
> > break;
> > +
> > default:
> > uvc_dbg(dev, DESCR,
> > "device %d videostreaming interface %d: unknown DV format %u\n",
> > @@ -341,9 +336,6 @@ static int uvc_parse_format(struct uvc_device *dev,
> > return -EINVAL;
> > }
> >
> > - strlcat(fmtname, buffer[8] & (1 << 7) ? " 60Hz" : " 50Hz",
> > - sizeof(fmtname));
> > -
> > format->fcc = V4L2_PIX_FMT_DV;
> > format->flags = UVC_FMT_FLAG_COMPRESSED | UVC_FMT_FLAG_STREAM;
> > format->bpp = 0;
> > @@ -370,12 +362,8 @@ static int uvc_parse_format(struct uvc_device *dev,
> > return -EINVAL;
> > }
> >
> > - if (format->fcc) {
> > - if (fmtname[0])
> > - uvc_dbg(dev, DESCR, "Found format %s\n", fmtname);
> > - else
> > - uvc_dbg(dev, DESCR, "Found format %p4cc", &format->fcc);
> > - }
>
> Maybe it is the way that I debug the issues. I run an OK execution
> with a FAIl one and then I compare results. I tend to prefer that the
> extra lines are errors and there is no missing lines.... but I if your
> prefer it this way, I am ok with it ;)
Given that formats with a 0 fourcc are useless from a userspace point of
view, I think I'd rather drop them actually. That's a candidate for a
further patch.
> > + if (format->fcc)
> > + uvc_dbg(dev, DESCR, "Found format %p4cc", &format->fcc);
> >
> > buflen -= buffer[0];
> > buffer += buffer[0];
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-01-04 12:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-04 11:19 [PATCH v2 0/2] media: uvcvideo: Drop format descriptions Laurent Pinchart
2023-01-04 11:19 ` [PATCH v2 1/2] media: uvcvideo: Remove " Laurent Pinchart
2023-01-04 11:48 ` Ricardo Ribalda
2023-01-04 11:19 ` [PATCH v2 2/2] media: uvcvideo: Drop custom format names for DV formats Laurent Pinchart
2023-01-04 11:51 ` Ricardo Ribalda
2023-01-04 12:18 ` Laurent Pinchart
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.