mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hansg@kernel.org>
To: Ricardo Ribalda <ribalda@chromium.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org,
	Manav Gautama <bandwidthcrunch@gmail.com>,
	Martin Rubli <martin_rubli@logitech.com>
Subject: Re: [PATCH v2 2/6] media: uvcvideo: Import standard controls from uvcdynctrl
Date: Mon, 8 Dec 2025 12:12:39 +0100	[thread overview]
Message-ID: <1ea79ef0-ceba-43b3-9190-7a92c823e3d2@kernel.org> (raw)
In-Reply-To: <779a1a39-64f9-4985-b733-92f8673f3d3e@kernel.org>

Hi,

On 8-Dec-25 12:02 PM, Hans de Goede wrote:
> Hi Ricardo,
> 
> Thank you very much for doing this, this has been on my own TODO list for
> a long time, so it is great to finally see this happen.
> 
> On 19-Nov-25 8:37 PM, Ricardo Ribalda wrote:
>> The uvcdynctrl tool from libwebcam:
>> https://sourceforge.net/projects/libwebcam/
>> maps proprietary controls into v4l2 controls using the UVCIOC_CTRL_MAP
>> ioctl.
>>
>> The tool has not been updated for 10+ years now, and there is no reason
>> for the UVC driver to not do the mapping by itself.
>>
>> This patch adds the mappings from the uvcdynctrl into the driver. Hopefully
>> this effort can help in deprecating the UVCIOC_CTRL_MAP ioctl.
> 
> ...
> 
> Question what happens if uvcdynctrl is run after applying this patch ?

Answering my own question here, we will hit:

drivers/media/usb/uvc/uvc_ctrl.c: 3166:

        list_for_each_entry(map, &ctrl->info.mappings, list) {
                if (mapping->id == map->id) {
                        uvc_dbg(dev, CONTROL,
                                "Can't add mapping '%s', control id 0x%08x already exists\n",
                                uvc_map_get_name(mapping), mapping->id);
                        ret = -EEXIST;
                        goto done;
                }
        }

So uvcdynctrl will see an EEXIST error. I think we need to add an -EEXIST check
to uvc_ctrl_add_mapping() )or uvc_ioctl_xu_ctrl_map() which is the only caller of
uvc_ctrl_add_mapping()) and if -EEXIST is returned do a uvc_warn_once() that duplicate
mappings are being ignored and return 0 instead of -EEXIST to avoid breaking existing
userspace.

Regards,

Hans



  reply	other threads:[~2025-12-08 11:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19 19:37 [PATCH v2 0/6] media: uvcvideo: Map known XU controls Ricardo Ribalda
2025-11-19 19:37 ` [PATCH v2 1/6] media: uvcvideo: Remove nodrop parameter Ricardo Ribalda
2025-12-08 10:54   ` Hans de Goede
2025-11-19 19:37 ` [PATCH v2 2/6] media: uvcvideo: Import standard controls from uvcdynctrl Ricardo Ribalda
2025-12-08 11:02   ` Hans de Goede
2025-12-08 11:12     ` Hans de Goede [this message]
2025-12-09  6:28       ` Ricardo Ribalda
2025-12-09 16:22         ` Hans de Goede
2025-11-19 19:37 ` [PATCH v2 3/6] media: uvcvideo: Announce deprecation intentions for UVCIOC_CTRL_MAP Ricardo Ribalda
2025-12-08 11:17   ` Hans de Goede
2025-12-09  6:41     ` Ricardo Ribalda
2025-12-09 16:27       ` Hans de Goede
2025-11-19 19:37 ` [PATCH v2 4/6] media: uvcvideo: Document how to format GUIDs Ricardo Ribalda
2025-12-08 11:19   ` Hans de Goede
2025-12-22  0:56   ` Laurent Pinchart
2025-11-19 19:37 ` [PATCH v2 5/6] media: uvcvideo: Introduce allow_privacy_override param Ricardo Ribalda
2025-11-19 21:54   ` Gergo Koteles
2025-11-19 22:09     ` Ricardo Ribalda
2025-12-08 11:58   ` Hans de Goede
2025-12-10  6:40     ` Ricardo Ribalda
2025-11-19 19:37 ` [PATCH v2 6/6] media: uvcvideo: RFC: Convert allow_privacy_override into Kconfig Ricardo Ribalda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ea79ef0-ceba-43b3-9190-7a92c823e3d2@kernel.org \
    --to=hansg@kernel.org \
    --cc=bandwidthcrunch@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=martin_rubli@logitech.com \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®