From nobody Tue Dec 2 02:20:22 2025 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60E7930C61B for ; Wed, 19 Nov 2025 19:37:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763581039; cv=none; b=UM4NqqXUXhc1fhmy33WHJj0+6hFOGHJ6foHUa/B3hWUtT4GKLex8mHyEOC0WMIjW3QuyAADw5AtwlOeocMHnyPfEp8fYA9APEEq+42qesKNUn6xtTnFMb+z3ptjhwjte8mVWW5aPk4C9MoXnk8h6p4/TODTsKrSSS7rFQUMbz/s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763581039; c=relaxed/simple; bh=n8XOm9luf2fVsxqKyrBWhIZuOOg2rhp+w9xSWOV/plE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oANPbhYwvSwy4vh346vicTeLOesotCw1eMo1Mb6ULxctv6nZBveJ6u/dOszQtzOswkxeNg8vM5TSOihclLIAJmfJJ9RlVBJyCTfDQR6mVlkxlRa7NJmAs0VhnsxEQ+/xw8Da/1k1NcXRVjXwHSxUbfPzJh0vxjY5/bQuRk9ZVSs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=mQgOdslD; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mQgOdslD" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-5945510fd7aso41053e87.0 for ; Wed, 19 Nov 2025 11:37:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1763581033; x=1764185833; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=9t1hhYNW+A5BDerlrM2zvaB6QZgqTCpLkk7E6jVXaDE=; b=mQgOdslD9nPCwG9K3q8zYKNBqSnR9NiIbjnRUyi1hwl/ZqQBNidXW1M+iUuKqIamPV Ctz0G6VHyuPiuqdE7olOliRniJho3p+TfXcvoiVot1nD+TtziHgYFyVvoH3+wKsakH4H 565pHVmC6BlTb+dMLmBTfwqDi8Q2ZwjyI3eHM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763581033; x=1764185833; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=9t1hhYNW+A5BDerlrM2zvaB6QZgqTCpLkk7E6jVXaDE=; b=hjBmEN5/Wtm56hbRjNlYlp9P/KthAQC6oCqVcK0RsKssqUGqnUZP+LHlixC5xN/EgK lOXILxxQF81u0TqkNYhe4VqOwR8ZYEpIQpIgmq5MJOFOn+fr/vrJVfAVtxdOFlF24aoG S5e7A4nHB86gi6xZYjfldBii9hwDTBNIvt3kuaj+aqR+MGbXg9dPK9HkqthBX4MU9O/U 2PJkVeaK+9CcbxxfbbNyKrh4eNzkdYuIMk6rgJGts7nejaeul2JQW6qyG0yFBQ5xtf8B ANX+E3+xJYerZmIo9fF1BW+Ari+9KvX/QwmE2QFVOA0/XPhXtBqoMnjzDtGH3nT16gvW IUhQ== X-Forwarded-Encrypted: i=1; AJvYcCXbIWiYrKyMQkZJYBMNmJlontoK0bOwDVqXk3nSbXmgXxojMRurXzGN1wvGXyy/D/wA9DvNT/CVMvcAmG0=@vger.kernel.org X-Gm-Message-State: AOJu0YzF8WWC1P3jm/rlm2L+kDrAuOvmYuQ0i90Nz/STlQZ4YuyX98OD 5E5uTdj9sT98ypgG7tJ2iXpgYnla2dlcgLahqS23B3d2Dge5oUIpbudd2DTV+eZNLjAH115odSQ n8oUXAA== X-Gm-Gg: ASbGncuXaYjrjL0x9WNkWs+Pc3bOz+jp8ITDaAnCMsuD0p0xc0HaX4QfCGlG7fceUeH 1jkLQ9GIEoihsA4BZVRfeSAnulxIZ6e6k4k3Jkw6i47q2SBvv8MyEluDHTiWYbYoi85trdWVBCL J1GhzExqaVfiTdzvwGYsyTvL7v6eh3kLAMqHwBBCsGmiMH6BGus6ZHVE4WA+GXPc+6xYPtCNgeu LMfVxcQJ3lDk+CflizRXDA81hZCn8Y/gtH9ZvdSsdD2sJRdcdxvA/OaqCA4ooiqhcDAAkUVyDsp 0NPlaaBH5iqnXVarBl2rFwiCdbJ/CyRCzjhXNEWdxXopS9LAFzCPtTwx/x7bkuPlJvbqpGyhvPU Z81p2HFsljsofwq6zTXACgRO46XfNehZhwBJ/3x9Cl9A3ROvPcLhS1Luu73mqmVv21yWtQOMDrE f1uzWXup9NYU7wrCHd1w/N7JaPHIP/eXN7nq0eRdHtzi6PbnhKnki7+SJxbbE8HQ== X-Google-Smtp-Source: AGHT+IEzy07FdaBjKY/dhcgvBozZKv1y77WZHmLiavxxJhCZh+QBPAxjEQ2BThdKmAn1PbL0E6rOzg== X-Received: by 2002:a05:6512:3e15:b0:594:2f46:391c with SMTP id 2adb3069b0e04-5969e30c2ddmr20533e87.44.1763581033193; Wed, 19 Nov 2025 11:37:13 -0800 (PST) Received: from ribalda.c.googlers.com (80.38.88.34.bc.googleusercontent.com. [34.88.38.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5969dbd15a1sm65790e87.98.2025.11.19.11.37.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 11:37:12 -0800 (PST) From: Ricardo Ribalda Date: Wed, 19 Nov 2025 19:37:10 +0000 Subject: [PATCH v2 1/6] media: uvcvideo: Remove nodrop parameter Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251119-uvcdynctrl-v2-1-0359ffb98c9e@chromium.org> References: <20251119-uvcdynctrl-v2-0-0359ffb98c9e@chromium.org> In-Reply-To: <20251119-uvcdynctrl-v2-0-0359ffb98c9e@chromium.org> To: Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab , Greg Kroah-Hartman Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.14.2 We announced the deprecation intentions one year ago in the commit commit 40ed9e9b2808 ("media: uvcvideo: Announce the user our deprecation intentions"). We have not hear any complains, lets remove the nodrop parameter. Reviewed-by: Laurent Pinchart Signed-off-by: Ricardo Ribalda --- drivers/media/usb/uvc/uvc_driver.c | 19 ------------------- drivers/media/usb/uvc/uvc_queue.c | 25 ------------------------- drivers/media/usb/uvc/uvcvideo.h | 1 - 3 files changed, 45 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc= _driver.c index ee4f54d6834962414979a046afc59c5036455124..71563d8f4bcf581694ccd4b665f= f52b629caa0b6 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -32,7 +32,6 @@ =20 unsigned int uvc_clock_param =3D CLOCK_MONOTONIC; unsigned int uvc_hw_timestamps_param; -unsigned int uvc_no_drop_param =3D 1; static unsigned int uvc_quirks_param =3D -1; unsigned int uvc_dbg_param; unsigned int uvc_timeout_param =3D UVC_CTRL_STREAMING_TIMEOUT; @@ -2468,24 +2467,6 @@ MODULE_PARM_DESC(clock, "Video buffers timestamp clo= ck"); module_param_named(hwtimestamps, uvc_hw_timestamps_param, uint, 0644); MODULE_PARM_DESC(hwtimestamps, "Use hardware timestamps"); =20 -static int param_set_nodrop(const char *val, const struct kernel_param *kp) -{ - pr_warn_once("uvcvideo: " - DEPRECATED - "nodrop parameter will be eventually removed.\n"); - return param_set_bool(val, kp); -} - -static const struct kernel_param_ops param_ops_nodrop =3D { - .set =3D param_set_nodrop, - .get =3D param_get_uint, -}; - -param_check_uint(nodrop, &uvc_no_drop_param); -module_param_cb(nodrop, ¶m_ops_nodrop, &uvc_no_drop_param, 0644); -__MODULE_PARM_TYPE(nodrop, "uint"); -MODULE_PARM_DESC(nodrop, "Don't drop incomplete frames"); - module_param_named(quirks, uvc_quirks_param, uint, 0644); MODULE_PARM_DESC(quirks, "Forced device quirks"); module_param_named(trace, uvc_dbg_param, uint, 0644); diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_= queue.c index 790184c9843d211d34fa7d66801631d5a07450bd..3bc54456b4d98ed50b1ea250ce8= 501e67141e1ef 100644 --- a/drivers/media/usb/uvc/uvc_queue.c +++ b/drivers/media/usb/uvc/uvc_queue.c @@ -331,34 +331,9 @@ struct uvc_buffer *uvc_queue_get_current_buffer(struct= uvc_video_queue *queue) return nextbuf; } =20 -/* - * uvc_queue_buffer_requeue: Requeue a buffer on our internal irqqueue - * - * Reuse a buffer through our internal queue without the need to 'prepare'. - * The buffer will be returned to userspace through the uvc_buffer_queue c= all if - * the device has been disconnected. - */ -static void uvc_queue_buffer_requeue(struct uvc_video_queue *queue, - struct uvc_buffer *buf) -{ - buf->error =3D 0; - buf->state =3D UVC_BUF_STATE_QUEUED; - buf->bytesused =3D 0; - vb2_set_plane_payload(&buf->buf.vb2_buf, 0, 0); - - uvc_buffer_queue(&buf->buf.vb2_buf); -} - static void uvc_queue_buffer_complete(struct kref *ref) { struct uvc_buffer *buf =3D container_of(ref, struct uvc_buffer, ref); - struct vb2_buffer *vb =3D &buf->buf.vb2_buf; - struct uvc_video_queue *queue =3D vb2_get_drv_priv(vb->vb2_queue); - - if (buf->error && !uvc_no_drop_param) { - uvc_queue_buffer_requeue(queue, buf); - return; - } =20 buf->state =3D buf->error ? UVC_BUF_STATE_ERROR : UVC_BUF_STATE_DONE; vb2_set_plane_payload(&buf->buf.vb2_buf, 0, buf->bytesused); diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvi= deo.h index ed7bad31f75ca474c1037d666d5310c78dd764df..9a86d7f1f6ea022dace87614030= bf0fde0d260f0 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -659,7 +659,6 @@ static inline struct uvc_fh *to_uvc_fh(struct file *fil= p) #define UVC_WARN_XU_GET_RES 2 =20 extern unsigned int uvc_clock_param; -extern unsigned int uvc_no_drop_param; extern unsigned int uvc_dbg_param; extern unsigned int uvc_timeout_param; extern unsigned int uvc_hw_timestamps_param; --=20 2.52.0.rc1.455.g30608eb744-goog From nobody Tue Dec 2 02:20:22 2025 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 877CE35BDA6 for ; Wed, 19 Nov 2025 19:37:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763581040; cv=none; b=MqOMSP7DcmlF0Ntaiu9dFY+KSy4AWHBFX/1saEjI03UlbFQ0pr7OlhFP7a2jNoseNkA6YUJEM7qrZkyTjMtQY4vuTfxuvXM6mStuFqsz7CTNt7ATkNQAgl3aEVyr0bJyOQHwcXAwkeOjWFWG6CI2B1KUgcc3AuGBjy8a6D1drZs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763581040; c=relaxed/simple; bh=yDVjeEIL8VTe0A73YXx6ikv0Q8i+JImq30aDISEsNeQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iU6kReT+f/hnOIokOFVvMsd+YJnJv3Ifp0nQ2qaq4TQI1Gm9zVTRFM71+CFbOVYF1DsC4XEOmN4+lbeN7E4L5tJynSBQU8YTpVxjTvmreKOZzkEzOAFntgSb147Mp+zcuihJsa7uZGvdi+DmTHthFM9j8gTsd6woQOE1Ms+z6g4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Ps+QQ3wH; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Ps+QQ3wH" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-5958931c9c7so22110e87.2 for ; Wed, 19 Nov 2025 11:37:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1763581034; x=1764185834; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Urb4TUB7FuFPTt5EqRfevkiU7cF4I6ahZ/fgTz9sy5U=; b=Ps+QQ3wHSmUKJFOMgJqG/vvGOz84qJEUHxncR1b4PvFof4cQFAyOzjCjVhlDFf4gw8 PJx5+cTrfVnjdm63aQL/3bMiD9eQDj1C7t1xwO7V/02KYrcIi6lVIS2ii/9BZS34NflD iPfJVxvFwuBGMAqbc9pSdubDje0JS/6Jtuolc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763581034; x=1764185834; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Urb4TUB7FuFPTt5EqRfevkiU7cF4I6ahZ/fgTz9sy5U=; b=mMBL6snOVTsKoCXHqQAGyQ14HH+RTyWHL8q+D8egi/KfVtQ3MoRrV/h+BE/Qqw+OyF 0MRdfdkUUoD+9FXObyMtHHbvNRTF2qGJWW3VAoXy+85GTTWpRTiSxWBT4wSjvyy0nTIJ qS3R+XRc0ec1NL0shHISgSos+GPdeFVF3a0qTtqwZw72AP2qZaI+2t2hrp4DTiMAd6mh nBDbV+gr+pKMk3+s0xlyljHar56ya1Dvh2ziBkcP2QiDGG8+fr8csCt40NuwBn4G+32X XjAgaQgED2Kxg1VLkX6KADKTYD5wcJDVpeTVYq3F/eSeYkksJK3BSxgTt8BoP9Op6mdv tH0g== X-Forwarded-Encrypted: i=1; AJvYcCUy2+Q+XWbGI0JF5lOhXLDz5J0guyvm21G0QGsOiWji9c6E7cQnPTbe22JOUs2+Bzi6I3dsZeAInDXA8MI=@vger.kernel.org X-Gm-Message-State: AOJu0YymvPQ7voNFjEUzwnL54UCClOrDa22YONp/GEuFsotblzMblJ1l upeHEcrsHJeM4hXkKCOW82tfX33kjxOmiDzMVWTztNIewCq3k6awjTZFu7yMU1t+bA== X-Gm-Gg: ASbGncv3stogCGiqc7UaIo001BYe09S65DRNxCA1d+PL0XmaIQWzGNb1IVm5+E1sIWr m/zZgo5v+fpJFWnm4o1vPgyUVTgZqCJJSnty2+1jsuweHR+O3YDyYdzgS8H0unxsXYpm6m7MZAu kw0zPJfcWrUs8Gu2JYILxyxNHaorvQHaRDguna9wDnXOyA/X6kXhKAPtehq2KF8hqO/WLwja1N3 QkGxq44SPm0O4PE0I8QBxd65ambW5nUVKt3ImiwyQtg08uyR1J5qLTNcJKoLk6+DquEPR4ntZ1x qMM1ETz6v71aa74XMXiaUmsn3bx2X6TiAS9IRTZVwUy1KKi+8wbdcgzpOHiHxZkDHs5dC9AkJ2I DsnL3Zsk4z0CM2K2XtwKTTeSwykg+ktgoKpjsrLHxy2x/RcXh+kuAlCGx9GGRrbg2GW1y3/tBiS MGL8jgta6GXFzPCsHW5cBe0E0i06tQ37k0xpfAuRtWT74A9knXKX9Uj2FQ1/Kfa8NPBejT5wrp X-Google-Smtp-Source: AGHT+IEh+tdUOzMD8Okc/mI6rgrMVyMk7m+HLiNzXG3iO0XlxNHcpo70Zd5NDuYMvXvwI/oaVGcPqw== X-Received: by 2002:a05:6512:6d3:b0:595:91dc:72a1 with SMTP id 2adb3069b0e04-5969e2ae995mr43544e87.3.1763581034086; Wed, 19 Nov 2025 11:37:14 -0800 (PST) Received: from ribalda.c.googlers.com (80.38.88.34.bc.googleusercontent.com. [34.88.38.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5969dbd15a1sm65790e87.98.2025.11.19.11.37.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 11:37:13 -0800 (PST) From: Ricardo Ribalda Date: Wed, 19 Nov 2025 19:37:11 +0000 Subject: [PATCH v2 2/6] media: uvcvideo: Import standard controls from uvcdynctrl Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251119-uvcdynctrl-v2-2-0359ffb98c9e@chromium.org> References: <20251119-uvcdynctrl-v2-0-0359ffb98c9e@chromium.org> In-Reply-To: <20251119-uvcdynctrl-v2-0-0359ffb98c9e@chromium.org> To: Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab , Greg Kroah-Hartman Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Ricardo Ribalda , Manav Gautama , Martin Rubli X-Mailer: b4 0.14.2 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. Some background about UVCIOC_CTRL_MAP (thanks Laurent for the context): ``` this was envisioned as the base of a vibrant ecosystem where a large number of vendors would submit XML files that describe their XU control mappings, at a pace faster than could be supported by adding XU mappings to the driver. This vision failed to materialize and the tool has not been updated for 10+ years now. There is no reason to believe the situation will change. ``` During the porting, the following mappings where NOT imported because they were not using standard v4l2 IDs. It is recommended that userspace moves to UVCIOC_CTRL_QUERY for non standard controls. { .id =3D V4L2_CID_FLASH_MODE, .entity =3D UVC_GUID_SIS_LED_HW_CONTROL, .selector =3D 4, .size =3D 4, .offset =3D 0, .v4l2_type =3D V4L2_CTRL_TYPE_MENU, .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, .menu_mask =3D 0x3, .menu_mapping =3D { 0x20, 0x22 }, .menu_names =3D { "Off", "On" }, }, { .id =3D V4L2_CID_FLASH_FREQUENCY, .entity =3D UVC_GUID_SIS_LED_HW_CONTROL, .selector =3D 4, .size =3D 8, .offset =3D 16, .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, }, { .id =3D V4L2_CID_LED1_MODE, .entity =3D UVC_GUID_LOGITECH_USER_HW_CONTROL_V1, .selector =3D 1, .size =3D 8, .offset =3D 0, .v4l2_type =3D V4L2_CTRL_TYPE_MENU, .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, .menu_mask =3D 0xF, .menu_mapping =3D { 0, 1, 2, 3 }, .menu_names =3D { "Off", "On", "Blinking", "Auto" }, }, { .id =3D V4L2_CID_LED1_FREQUENCY, .entity =3D UVC_GUID_LOGITECH_USER_HW_CONTROL_V1, .selector =3D 1, .size =3D 8, .offset =3D 16, .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, }, { .id =3D V4L2_CID_DISABLE_PROCESSING, .entity =3D UVC_GUID_LOGITECH_VIDEO_PIPE_V1, .selector =3D 5, .size =3D 8, .offset =3D 0, .v4l2_type =3D V4L2_CTRL_TYPE_BOOLEAN, .data_type =3D UVC_CTRL_DATA_TYPE_BOOLEAN, }, { .id =3D V4L2_CID_RAW_BITS_PER_PIXEL, .entity =3D UVC_GUID_LOGITECH_VIDEO_PIPE_V1, .selector =3D 8, .size =3D 8, .offset =3D 0, .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, }, { .id =3D V4L2_CID_LED1_MODE, .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, .selector =3D 0x09, .size =3D 2, .offset =3D 8, .v4l2_type =3D V4L2_CTRL_TYPE_MENU, .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, .menu_mask =3D 0xF, .menu_mapping =3D { 0, 1, 2, 3 }, .menu_names =3D { "Off", "On", "Blink", "Auto" }, }, { .id =3D V4L2_CID_LED1_FREQUENCY, .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, .selector =3D 0x09, .size =3D 8, .offset =3D 24, .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, }, This script has been used to generate the mappings. They were then reformatted manually to follow the driver style. import sys import uuid import re import xml.etree.ElementTree as ET def get_namespace(root): return re.match(r"\{.*\}", root.tag).group(0) def get_single_guid(ns, constant): id =3D constant.find(ns + "id").text value =3D constant.find(ns + "value").text return (id, value) def get_constants(ns, root): out =3D dict() for constant in root.iter(ns + "constant"): attr =3D constant.attrib if attr["type"] =3D=3D "integer": id, value =3D get_single_guid(ns, constant) if id in out: print(f"dupe constant {id}") out[id] =3D value return out def get_guids(ns, root): out =3D dict() for constant in root.iter(ns + "constant"): attr =3D constant.attrib if attr["type"] =3D=3D "guid": id, value =3D get_single_guid(ns, constant) if id in out: print(f"dupe guid {id}") out[id] =3D value return out def get_single_control(ns, control): out =3D {} for id in "entity", "selector", "index", "size", "description": v =3D control.find(ns + id) if v is None and id =3D=3D "description": continue out[id] =3D v.text reqs =3D set() for r in control.find(ns + "requests"): reqs.add(r.text) out["requests"] =3D reqs return (control.attrib["id"], out) def get_controls(ns, root): out =3D dict() for control in root.iter(ns + "control"): id, value =3D get_single_control(ns, control) if id in out: print(f"Dupe control id {id}") out[id] =3D value return out def get_single_mapping(ns, mapping): out =3D {} out["name"] =3D mapping.find(ns + "name").text uvc =3D mapping.find(ns + "uvc") for id in "size", "offset", "uvc_type": out[id] =3D uvc.find(ns + id).text out["control_ref"] =3D uvc.find(ns + "control_ref").attrib["idref"] v4l2 =3D mapping.find(ns + "v4l2") for id in "id", "v4l2_type": out[id] =3D v4l2.find(ns + id).text menu =3D {} for entry in v4l2.iter(ns + "menu_entry"): menu[entry.attrib["name"]] =3D entry.attrib["value"] if menu: out["menu"] =3D menu return out def get_mapping(ns, root): out =3D [] for control in root.iter(ns + "mapping"): mapping =3D get_single_mapping(ns, control) out +=3D [mapping] return out def print_guids(guids): for g in guids: print(f"#define {g} \\") u_bytes =3D uuid.UUID(guids[g]).bytes_le u_bytes =3D [f"0x{b:02x}" for b in u_bytes] print("\t{ " + ", ".join(u_bytes) + " }") def print_flags(flags): get_range =3D {"GET_MIN", "GET_DEF", "GET_MAX", "GET_CUR", "GET_RES"} if get_range.issubset(flags): flags -=3D get_range flags.add("GET_RANGE") flags =3D list(flags) flags.sort() out =3D "" for f in flags[:-1]: out +=3D f"UVC_CTRL_FLAG_{f}\n\t\t\t\t| " out +=3D f"UVC_CTRL_FLAG_{flags[-1]}" return out def print_description(desc): print("/*") for line in desc.strip().splitlines(): print(f" * {line.strip()}") print("*/") def print_controls(controls, cons): for id in controls: c =3D controls[id] if "description" in c: print_description(c["description"]) print( f"""\t{{ \t\t.entity\t\t=3D {c["entity"]}, \t\t.selector\t=3D {cons[c["selector"]]}, \t\t.index\t\t=3D {c["index"]}, \t\t.size\t\t=3D {c["size"]}, \t\t.flags\t\t=3D {print_flags(c["requests"])}, \t}},""" ) def menu_mapping_txt(menu): out =3D f"\n\t\t.menu_mask\t=3D 0x{((1< Cc: Martin Rubli Reviewed-by: Laurent Pinchart Signed-off-by: Ricardo Ribalda --- drivers/media/usb/uvc/uvc_ctrl.c | 174 +++++++++++++++++++++++++++++++++++= ++++ include/linux/usb/uvc.h | 6 ++ 2 files changed, 180 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_c= trl.c index 2905505c240c060e5034ea12d33b59d5702f2e1f..57ce486f22bbc404a1f127539eb= 2d12373431631 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -385,6 +385,99 @@ static const struct uvc_control_info uvc_ctrls[] =3D { | UVC_CTRL_FLAG_GET_RANGE | UVC_CTRL_FLAG_RESTORE, }, + /* + * Allows the control of pan/tilt motor movements for camera models + * that support mechanical pan/tilt. + * + * Bits 0 to 15 control pan, bits 16 to 31 control tilt. + * The unit of the pan/tilt values is 1/64th of a degree and the + * resolution is 1 degree. + */ + { + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 1, + .index =3D 0, + .size =3D 4, + .flags =3D UVC_CTRL_FLAG_GET_DEF + | UVC_CTRL_FLAG_GET_MAX + | UVC_CTRL_FLAG_GET_MIN + | UVC_CTRL_FLAG_SET_CUR, + }, + /* + * Reset the pan/tilt motors to their original position for camera + * models that support mechanical pan/tilt. + * + * Setting bit 0 resets the pan position. + * Setting bit 1 resets the tilt position. + * + * Both bits can be set at the same time to reset both, pan and tilt, + * at the same time. + */ + { + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 2, + .index =3D 1, + .size =3D 1, + .flags =3D UVC_CTRL_FLAG_GET_DEF + | UVC_CTRL_FLAG_GET_MAX + | UVC_CTRL_FLAG_GET_MIN + | UVC_CTRL_FLAG_SET_CUR, + }, + /* + * Allows the control of focus motor movements for camera models that + * support mechanical focus. + * + * Bits 0 to 7 allow selection of the desired lens position. + * There are no physical units, instead, the focus range is spread over + * 256 logical units with 0 representing infinity focus and 255 being + * macro focus. + */ + { + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 3, + .index =3D 2, + .size =3D 6, + .flags =3D UVC_CTRL_FLAG_GET_CUR + | UVC_CTRL_FLAG_GET_DEF + | UVC_CTRL_FLAG_GET_MAX + | UVC_CTRL_FLAG_GET_MIN + | UVC_CTRL_FLAG_SET_CUR, + }, + /* + * Allows the control of pan/tilt motor movements for camera models + * that support mechanical pan/tilt. + * + * Bits 0 to 15 control pan, bits 16 to 31 control tilt. + */ + { + .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, + .selector =3D 1, + .index =3D 0, + .size =3D 4, + .flags =3D UVC_CTRL_FLAG_GET_DEF + | UVC_CTRL_FLAG_GET_MAX + | UVC_CTRL_FLAG_GET_MIN + | UVC_CTRL_FLAG_GET_RES + | UVC_CTRL_FLAG_SET_CUR, + }, + /* + * Reset the pan/tilt motors to their original position for camera + * models that support mechanical pan/tilt. + * + * Setting bit 0 resets the pan position. + * Setting bit 1 resets the tilt position. + */ + { + .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, + .selector =3D 2, + .index =3D 1, + .size =3D 1, + .flags =3D UVC_CTRL_FLAG_GET_DEF + | UVC_CTRL_FLAG_GET_MAX + | UVC_CTRL_FLAG_GET_MIN + | UVC_CTRL_FLAG_GET_RES + | UVC_CTRL_FLAG_SET_CUR, + }, }; =20 static const u32 uvc_control_classes[] =3D { @@ -1009,6 +1102,87 @@ static const struct uvc_control_mapping uvc_ctrl_map= pings[] =3D { .menu_mask =3D BIT(V4L2_COLORFX_VIVID) | BIT(V4L2_COLORFX_NONE), }, + { + .id =3D V4L2_CID_PAN_RELATIVE, + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 1, + .size =3D 16, + .offset =3D 0, + .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, + .data_type =3D UVC_CTRL_DATA_TYPE_SIGNED, + }, + { + .id =3D V4L2_CID_TILT_RELATIVE, + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 1, + .size =3D 16, + .offset =3D 16, + .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, + .data_type =3D UVC_CTRL_DATA_TYPE_SIGNED, + }, + { + .id =3D V4L2_CID_PAN_RESET, + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 2, + .size =3D 1, + .offset =3D 0, + .v4l2_type =3D V4L2_CTRL_TYPE_BUTTON, + .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, + }, + { + .id =3D V4L2_CID_TILT_RESET, + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 2, + .size =3D 1, + .offset =3D 1, + .v4l2_type =3D V4L2_CTRL_TYPE_BUTTON, + .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, + }, + { + .id =3D V4L2_CID_PAN_RELATIVE, + .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, + .selector =3D 1, + .size =3D 16, + .offset =3D 0, + .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, + .data_type =3D UVC_CTRL_DATA_TYPE_SIGNED, + }, + { + .id =3D V4L2_CID_TILT_RELATIVE, + .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, + .selector =3D 1, + .size =3D 16, + .offset =3D 16, + .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, + .data_type =3D UVC_CTRL_DATA_TYPE_SIGNED, + }, + { + .id =3D V4L2_CID_PAN_RESET, + .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, + .selector =3D 2, + .size =3D 1, + .offset =3D 0, + .v4l2_type =3D V4L2_CTRL_TYPE_BUTTON, + .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, + }, + { + .id =3D V4L2_CID_TILT_RESET, + .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, + .selector =3D 2, + .size =3D 1, + .offset =3D 1, + .v4l2_type =3D V4L2_CTRL_TYPE_BUTTON, + .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, + }, + { + .id =3D V4L2_CID_FOCUS_ABSOLUTE, + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 3, + .size =3D 8, + .offset =3D 0, + .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, + .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, + }, }; =20 /* ------------------------------------------------------------------------ diff --git a/include/linux/usb/uvc.h b/include/linux/usb/uvc.h index 22e0dab0809e296e089940620ae0e8838e109701..b939a01da11466747249c64c72a= 3ea40cd364a59 100644 --- a/include/linux/usb/uvc.h +++ b/include/linux/usb/uvc.h @@ -35,6 +35,12 @@ #define UVC_GUID_MSXU_1_5 \ {0xdc, 0x95, 0x3f, 0x0f, 0x32, 0x26, 0x4e, 0x4c, \ 0x92, 0xc9, 0xa0, 0x47, 0x82, 0xf4, 0x3b, 0xc8} +#define UVC_GUID_LOGITECH_MOTOR_CONTROL_V1 \ + {0x82, 0x06, 0x61, 0x63, 0x70, 0x50, 0xab, 0x49, \ + 0xb8, 0xcc, 0xb3, 0x85, 0x5e, 0x8d, 0x22, 0x56 } +#define UVC_GUID_LOGITECH_PERIPHERAL \ + {0x21, 0x2d, 0xe5, 0xff, 0x30, 0x80, 0x2c, 0x4e, \ + 0x82, 0xd9, 0xf5, 0x87, 0xd0, 0x05, 0x40, 0xbd } =20 /* https://learn.microsoft.com/en-us/windows-hardware/drivers/stream/uvc-e= xtensions-1-5#222-extension-unit-controls */ #define UVC_MSXU_CONTROL_FOCUS 0x01 --=20 2.52.0.rc1.455.g30608eb744-goog From nobody Tue Dec 2 02:20:22 2025 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1D8F369966 for ; Wed, 19 Nov 2025 19:37:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763581041; cv=none; b=ArrcaRL9MM9eqH4Bc38vLAyLM1/rjMaYaBYMCPY5RIoqt06ZAUJnHYURR4GjPYKzbAs05b2HyRf56fFzCEcGZFDzK+6pu+DOLroSPFG5oES+F9UH5mfD26ygW48HqsbwN9ZDZHXv271r2ibCN3GdpG5A1KlbvQLvhTnQfBsBYi4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763581041; c=relaxed/simple; bh=smsLWyIhFZI4LUQsucb98+3IzvKG+sVE9pphNiqEeWw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=o6y3j7YG9D6UuDDUGLCiOBy6J8AcujstQvvnswp7dkt3t0V3TYPpjMNyhK/oaV2iUtinjVfT29NQNNTWiR/N98fhtfynmHS9Yhpq44QtTHmsBsPq337bbnY5YrhBAMsmOooXZgej9TeYLlqz7nj36pisX/WsLYy4KDYgN4yqUg0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=dU0UKT9e; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="dU0UKT9e" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-59431f57bf6so24924e87.3 for ; Wed, 19 Nov 2025 11:37:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1763581035; x=1764185835; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=mhkxKxNdiC2wNdpzuN+YHorPAGBUt1TQOUtGQjnuPb4=; b=dU0UKT9eoCEZn4t9Z0g/7EWmLK7rsez+HGyJCWm6f67AlxFfQ+NWP+LnCr9ukH/By+ Rc4ApSfTatVytTGAm9d2W3TJhkTaC3CxVZmy8tY8RLy1n9xZYKZrBqnBWzQz0imSo+7U nk/Bqg79/c5jxBCHcvqqZ5uj4tsubSKXfKfvM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763581035; x=1764185835; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=mhkxKxNdiC2wNdpzuN+YHorPAGBUt1TQOUtGQjnuPb4=; b=cRYaMip2YKWoBuBTBv9hqSfSqAEANCBgEjU3u365qm1edXmWhrO/0pHjEuOsFRVyBe zRfRIqs7CstDgQaOvS8O/OCUrAD6k+/tFOfvSE+dKaPtSE8+dIHBG34vZNtnBf60TdLF cgaIT1SO/LSvgcn9wnzVKrg01cMt/MehcwhK8Uj9I6cJMEYdN7ShKo4V6pF8oPYqmjDw Wq4igKf4msEZyv3hrvhEhy1tdx1COuopAiMfD3DFeEGHVGxIOfuSfSyftcXZ28++CDVS TBtbUmiTiFucQT2Njnr6qfXN+c0GXQI450L3COuu0cpI5HpbhfZDdpOZsomEucAK9wTm 8VjQ== X-Forwarded-Encrypted: i=1; AJvYcCWHCM9h+lrZTPz0B1mYxJZJ7HX4ezJymGrHFGuhaeyaeXhER2QvmUQojbOoXUDoZ1Oa4Zr112pNCr/JLko=@vger.kernel.org X-Gm-Message-State: AOJu0YwWUruzn3orkO6sXsvL+633ZHiotoGNJeSwP1F5i1PuIdQjGyFk STrbWf/7HIfNEXC9A4fBGEH/NOvL5cRloXmFMHiTG12JoO7FICVMG893hJHTS/beCQ== X-Gm-Gg: ASbGncskILtrfHoX/+X99jSqLJy1HO6OfOvt3sQVRTcr9//cIzTdVziS6EYM8A3/Hnq UxU7M4fGrwju2bm/z1oAb0diPNPhZ1poQCeNaz8Sx/HdMwcL6ANrC+oAY5jEh3HKaoedD2w9600 zIjmaimKaZRGk0fAVPQKwqsk7+KKmZHTHmsR3rewgZJDR7+sPUSuoFGBf+bteQlaKhWK2O9wpTe wjLAo8ptujFebC/o9H/8VZ8IyMPb5+qXOlWWULHH4vaqcgqZhxhlF4TzR2mOpD7luvOMKUQ8Ff1 wd+C/NwqYdG/+CaaSUnBcahb++2e+N4AuQaMrI7+vjM1qXa++bOBdGmpe4cnooE6Rnj/i1JnONc 1MbWbK6wou8CQy2FrXQ/NkQunUXNLC1ZzEKRhPHZ7acc/TqPLCP9xEyHuhDKw1n0DJc8Sx3ZLqf Re3GgKEjqgwr3E+tNIjnRStk9lFa1h6S68vBDF2O0SKR0bo6KKxc3dSIsCznXI+C13MS5d6aVs X-Google-Smtp-Source: AGHT+IGJe3V2Yc1Ik3PSIeoKVCn2YAJLOADNcKsHyJgQGXCsFRO6F5ZJLhmJqnTvgFCXCK6GL6NZ1g== X-Received: by 2002:a05:6512:23a6:b0:594:2f72:2f7f with SMTP id 2adb3069b0e04-5969e2b505emr37039e87.6.1763581034759; Wed, 19 Nov 2025 11:37:14 -0800 (PST) Received: from ribalda.c.googlers.com (80.38.88.34.bc.googleusercontent.com. [34.88.38.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5969dbd15a1sm65790e87.98.2025.11.19.11.37.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 11:37:14 -0800 (PST) From: Ricardo Ribalda Date: Wed, 19 Nov 2025 19:37:12 +0000 Subject: [PATCH v2 3/6] media: uvcvideo: Announce deprecation intentions for UVCIOC_CTRL_MAP Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251119-uvcdynctrl-v2-3-0359ffb98c9e@chromium.org> References: <20251119-uvcdynctrl-v2-0-0359ffb98c9e@chromium.org> In-Reply-To: <20251119-uvcdynctrl-v2-0-0359ffb98c9e@chromium.org> To: Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab , Greg Kroah-Hartman Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.14.2 The UVCIOC_CTRL_MAP lets userspace create a mapping for a custom control. This mapping is usually created by the uvcdynctrl userspace utility. We would like to get the mappings into the driver instead. Reviewed-by: Laurent Pinchart Signed-off-by: Ricardo Ribalda --- Documentation/userspace-api/media/drivers/uvcvideo.rst | 2 ++ drivers/media/usb/uvc/uvc_v4l2.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/Documentation/userspace-api/media/drivers/uvcvideo.rst b/Docum= entation/userspace-api/media/drivers/uvcvideo.rst index dbb30ad389ae4d53bc734b4269ebea20ecdd7535..b09d2f8ba66ecde67f1e35fd778= 58a505ad44eb1 100644 --- a/Documentation/userspace-api/media/drivers/uvcvideo.rst +++ b/Documentation/userspace-api/media/drivers/uvcvideo.rst @@ -109,6 +109,8 @@ IOCTL reference UVCIOC_CTRL_MAP - Map a UVC control to a V4L2 control ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ =20 +**This IOCTL is deprecated and will be eventually removed** + Argument: struct uvc_xu_control_mapping =20 **Description**: diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v= 4l2.c index 9e4a251eca88085a1b4e0e854370015855be92ee..03c64b5698bf4331fed8437fa6e= 9c726a07450bd 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -1044,6 +1044,8 @@ static long uvc_ioctl_default(struct file *file, void= *priv, bool valid_prio, switch (cmd) { /* Dynamic controls. */ case UVCIOC_CTRL_MAP: + pr_warn_once("uvcvideo: " DEPRECATED + "UVCIOC_CTRL_MAP ioctl will be eventually removed.\n"); return uvc_ioctl_xu_ctrl_map(chain, arg); =20 case UVCIOC_CTRL_QUERY: @@ -1158,6 +1160,8 @@ static long uvc_v4l2_compat_ioctl32(struct file *file, =20 switch (cmd) { case UVCIOC_CTRL_MAP32: + pr_warn_once("uvcvideo: " DEPRECATED + "UVCIOC_CTRL_MAP32 ioctl will be eventually removed.\n"); ret =3D uvc_v4l2_get_xu_mapping(&karg.xmap, up); if (ret) break; --=20 2.52.0.rc1.455.g30608eb744-goog From nobody Tue Dec 2 02:20:22 2025 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B13EE27281D for ; Wed, 19 Nov 2025 19:37:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763581042; cv=none; b=XBa7Yfy5UVcRnXlmHLnxod3AOitypUIBeDGXHVYyP48elU9QJhz1no+YdZY2hxSK+BQzSjjxgs3IjTKRADfzIp52UqCVAFw55geJNsKSUQkO1rbHPuBWvhk4L5jtuPf0g2rWcVx6ubiGVb1HzX5zSUbqEIF6/jaEu+Vg4CkFSwM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763581042; c=relaxed/simple; bh=yTYFXdI2ZyPR+UMxYGq17qZXJ4j99OhzHGQZUgONSkU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k+evh8ra5f15OSSMUKZH4IxBoazV14khC1CAfyIPeHIH1fvyJkfEgFMIFySWtfgETOYe2chVusiyOl0bMbduTzty04I8pMYlz/J2i2F9cSWBYTbmiZ7qzy3OsAaVtDwLq2P5JUmvcpV+VJd8b9LmA+EMcoMy03JjsZWN72UAaZ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=YIiyXZGl; arc=none smtp.client-ip=209.85.208.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="YIiyXZGl" Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-37b96cbd875so358031fa.3 for ; Wed, 19 Nov 2025 11:37:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1763581035; x=1764185835; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ZuZc8jIJ73fliBU4Q8ei1XsWAfFxT58BcOIlqwL+4cM=; b=YIiyXZGlDfSO6Yko+dDvg77jCvf8SsHWYwGOaRfw0ik3CrugAeEJpMoeickmOKDbcp OspWDFd0XkNlGot9+NO4lvW4kocgYlfmkOUbLqxlEjJhKZkQadJY561pJwdZYl/glYfp LiCkKyGCOZ+k9CtP3t+FMvfmBid/W9Uj8FjyM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763581035; x=1764185835; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ZuZc8jIJ73fliBU4Q8ei1XsWAfFxT58BcOIlqwL+4cM=; b=uJvvWiKQWtgpFegw7y30n10ggwT27OTiau63W1xdTYLnZYqPX7jS03BRBB3lj4b23t nphByD0F/2b81BzpnxGTi1G7MPPV+inVLitWmjqOxx1GjtBGc7ZGhG8kquMLXrFhtkL/ vSKuWB8OZiGFQ/S1XNqsKQ+nQhA0X57b/FNI848SI3EqbhwUP3FepdmuRDnLymbgWYmD AWksDUcVAYq4y5EWO/ZGrmfi0OvVLNM++0Gvexj1p0bYsRuJxQaeUCfDNu4f91NCeTLW XeGTK8u50Dpz0IEHU58Ss/eQbxmomfRvfRstvhcg9SEoZXGFnq1AxkuCxk/jK7uruOnP xSRQ== X-Forwarded-Encrypted: i=1; AJvYcCUwt/ZzcCVAOpwIqNHfxI//rT8qwU6ZGjMPfs7CIeEW+bSoVc8coYh3RAD7gTDT0G4i0NmbgA+BmsiSJD4=@vger.kernel.org X-Gm-Message-State: AOJu0YwaFFmHLhD8hrK4pJPZVU6JirfA2mSXoIooW6gdODshiLjN5Hgo /wbnJm3c71Sq1JTKxgRT3e7S097aoc+pe32Ncu2lV+9WbemLfldHBZq1eewgW1kuD0kQ/gSUJmO s1Kd3FQ== X-Gm-Gg: ASbGncsEHRq4pRMHDU29rdAdP7tjk+K6FvLpjC0MMja21j/TaYM/zfVsglRCB1W+IhY SxJKthT3FwjzAmUJdb8GaBTHM6PVpGsSqNhfmhvrMSlqBdZOyt3n+e8jZB1PAn6KfjtAiz8P8YI JZ/DU9N6CSfPcGtbJ0Hkg159hfZIIhXODrs3fdLSxaAdODSh2kkMGFqQtt+RTbAtDlyPhv/VJqj Ft52IVHK6qoER8vfGEoouXl0wQ0BcudW8Zyk8gE6iLgb0g7m6yEcruzTN1VtEKTm/itRtAn/GzW bnUqazshmWAqGHlwYu93N0OWJEFONMJ4IGubpk+4a+kGjmTh1kHk+BKrC2lOGoYJfga5uCSbDp9 hQX/X1EbXcgap2VUVoFd7FtdnwWqLt+8fRHa53e2OBtPMzaqhMbl0PFAWbs2shOCKrwm4+TrZKY Rs7k4Ur9QWGt+53OzHQRU2Nl2YlePp+FdB4jsrpu76ZKkqg0gZJHlDqnRob/NBf9NqKmcfKt6R X-Google-Smtp-Source: AGHT+IFoB7chSLIwfjSFTphqjgmua7Tjt0U+ohKJOcu/D64VE8zTccK69k87nmH3ArQfjCz5alhfSQ== X-Received: by 2002:a05:6512:3b9c:b0:592:f9dd:8f28 with SMTP id 2adb3069b0e04-5969e305a42mr18282e87.35.1763581035322; Wed, 19 Nov 2025 11:37:15 -0800 (PST) Received: from ribalda.c.googlers.com (80.38.88.34.bc.googleusercontent.com. [34.88.38.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5969dbd15a1sm65790e87.98.2025.11.19.11.37.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 11:37:14 -0800 (PST) From: Ricardo Ribalda Date: Wed, 19 Nov 2025 19:37:13 +0000 Subject: [PATCH v2 4/6] media: uvcvideo: Document how to format GUIDs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251119-uvcdynctrl-v2-4-0359ffb98c9e@chromium.org> References: <20251119-uvcdynctrl-v2-0-0359ffb98c9e@chromium.org> In-Reply-To: <20251119-uvcdynctrl-v2-0-0359ffb98c9e@chromium.org> To: Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab , Greg Kroah-Hartman Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.14.2 Manual formatting the GUIDs can lead to errors, document a programmatically way to format the GUIDs from lsusb into something tha the driver can use. Signed-off-by: Ricardo Ribalda --- include/linux/usb/uvc.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/usb/uvc.h b/include/linux/usb/uvc.h index b939a01da11466747249c64c72a3ea40cd364a59..dea23aabbad48270c807463c1a7= e1c0d1b79fc1f 100644 --- a/include/linux/usb/uvc.h +++ b/include/linux/usb/uvc.h @@ -10,6 +10,14 @@ =20 /* ------------------------------------------------------------------------ * GUIDs + * + * The GUID returned by lsusb can be converted to this format with the + * following python snippet: + * + * import uuid + * id =3D "{01234567-89ab-cdef-0123-456789abcdef}" + * le =3D uuid.UUID(id).bytes_le + * print("{" + ", ".join([f"0x{b:02x}" for b in le]) + "}") */ #define UVC_GUID_UVC_CAMERA \ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ --=20 2.52.0.rc1.455.g30608eb744-goog From nobody Tue Dec 2 02:20:22 2025 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63CB22F6918 for ; Wed, 19 Nov 2025 19:37:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763581042; cv=none; b=pbymIzGxs5nXlbpMelNBaThU4nnwZGxJi+FSKRhHbuRFFQ82zT1ArYBqNFSbBFRMbQEWOVZZ7ljWg0SL3av474BcgQ0aN6j4eWdxcHVUu106TrjAOwh4z79J8s2mJXk+YjHHwMpY32gHWNYlUfcVzRRXp+/f/xlgMZaKitlBoAs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763581042; c=relaxed/simple; bh=z3RQnW9TDrjp6E3Mq0bkoasBNVPiwhP/q8Ly9/EmPiQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A5Ka2uQJSHU1ArkmY6K6IbADPxOgzK+SANboiP2YGec2DkiGcDb1+5IQzy5ERl9O3z8NPYIvPWBI7ZmoRDc6y9tm4l+Mws/nJ5LN/ZVsm1vOMe8rPdg7B+DBjzlW5F+qIbx1FllzcKyPh4iih/b3SRFr29qhMToeq63xNwbUD7E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=RKgdZCMn; arc=none smtp.client-ip=209.85.167.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="RKgdZCMn" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-591c98ebe90so38150e87.3 for ; Wed, 19 Nov 2025 11:37:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1763581036; x=1764185836; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=GrRdO95H/URozAYz+64TTt354ty7fajzYMMZmV7FQXc=; b=RKgdZCMnx7ktpch36bi3jE5PERqDUycuqG/B37CeK5OYpVrq/P2i+zFX5GqlN9CUDy yPZcS6Y/RujgnNOyaBTCqcsuheUoiZgHXgZWVkItZC9WCNeZRfmjYA0DItuNu4dJY6fc kO00ZnZel8WbjVnxONdiYAhsD2r9DZcMB+VEA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763581036; x=1764185836; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=GrRdO95H/URozAYz+64TTt354ty7fajzYMMZmV7FQXc=; b=JTcorgpwZ2gS9XVkV3zhKY48eQlN9dLZ5Qfwlqd0lnQjTv/10VIxI32YhCTGVtips5 GP0r8Gr9wh2o3pWpyCod7I5y3S3+cF+mlmDL/mnA0N6j96t7wLkv2whOCBlEwmSNN4Qc 3TznFSXCY93XLWbxVXYaU0DBtk+wogrZpNaC2hKUVE8xLUBC8RSYer25ds7pa4/Lc37T v4E/kf6YsiuR3au+C6CRYe8f63gcTCYWwJTqWMdrRMkaqQ4QkJwDscBQBDVhjVx5SAL8 wrjnIGUz2OXy2H5pR4TehYA1jS3qZZQYqmNS+eTk7xHLq3KNGHHKj+mN16LiGElEAVxs uTMg== X-Forwarded-Encrypted: i=1; AJvYcCWmcqQIIhXq9poY1E7ip7rvVHYd3Zxm1tSKcsF8b06B1iWa9VFT3Z7FImTbm+hHwUvlF24uugZOHWPtvpU=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2AaewJCPUvYJ5R+beck5ambEoxE9YWTdEqkd7CUnQ3UAwvWRo Pc8psgfbYDjwL1tzqlA3p6t84r1zWxTlSU+peORWwjxAnqpMovFckQn7Ml/T7WEfKw== X-Gm-Gg: ASbGncsL8zYnkzc6/JeFEkBxuVeDb/foEqxnKTCRbSvXyaLULMmDu27+VIQD0GB8E+0 imcDZxQvzBjiVKWTW+Jo8X5gWbzdjt5smDjG4i2+6s7ryUqMLaFBkIdiw1idmtHsW4ndTlAERLG SNNyl46tM3829u92NNBdfc5aqclq4pyW0Vw0VlHLWbX0SpZeyoeg9QRSIBBofnNuyfYrk/t7BD2 rAtpOr37iE7WS2Y9jh6p+1/VdmbSuw15VaNVzXle22ANmOJikoONIoaU/dzu9PN3EXypvY5ZW1v 5bj64e4fLXi+WN2Hb1omuVYNTdYpWHkBoiwxNKofPMnkcFDaVytAc8n9CmhNbDnQpklrKUlGAnx tyf4d4zqbalHJZcPgFPTKQ4439gunGEXobPf4kkfF3M+xMHDflkZszlUY/M92mp8QLdVxDka0GM JzlsOnW9eHQacbODioQuG6nhQgDQr3Ln+WQwCdz0lgDSf4sYZumoTdWGJl4pHFEodJoL1yqkPAP mvF2vgcKRU= X-Google-Smtp-Source: AGHT+IE1emsD2Tk2JI/OKbxlYKyMxpFXszRLd28cKQKy+3DQkGLpAlNNQrb7cXY68X+u3Kf/i8fXrQ== X-Received: by 2002:a05:6512:1390:b0:594:33fc:d513 with SMTP id 2adb3069b0e04-5969e2d54e7mr30680e87.19.1763581035995; Wed, 19 Nov 2025 11:37:15 -0800 (PST) Received: from ribalda.c.googlers.com (80.38.88.34.bc.googleusercontent.com. [34.88.38.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5969dbd15a1sm65790e87.98.2025.11.19.11.37.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 11:37:15 -0800 (PST) From: Ricardo Ribalda Date: Wed, 19 Nov 2025 19:37:14 +0000 Subject: [PATCH v2 5/6] media: uvcvideo: Introduce allow_privacy_override param Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251119-uvcdynctrl-v2-5-0359ffb98c9e@chromium.org> References: <20251119-uvcdynctrl-v2-0-0359ffb98c9e@chromium.org> In-Reply-To: <20251119-uvcdynctrl-v2-0-0359ffb98c9e@chromium.org> To: Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab , Greg Kroah-Hartman Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.14.2 Some camera modules have XU controls that can configure the behaviour of the privacy LED. Block mapping of those controls, unless the module is configured with a new parameter: allow_privacy_override. This is just an interim solution. Based on the users feedback, we will either put the privacy controls behind a CONFIG option, or completely block them. Signed-off-by: Ricardo Ribalda --- drivers/media/usb/uvc/uvc_ctrl.c | 38 ++++++++++++++++++++++++++++++++++= ++++ drivers/media/usb/uvc/uvc_driver.c | 20 ++++++++++++++++++++ drivers/media/usb/uvc/uvc_v4l2.c | 7 +++++++ drivers/media/usb/uvc/uvcvideo.h | 2 ++ include/linux/usb/uvc.h | 4 ++++ 5 files changed, 71 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_c= trl.c index 57ce486f22bbc404a1f127539eb2d12373431631..d9cbb942f798dc7138608982a5d= 3e3ef9f8141f6 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -2951,6 +2951,35 @@ static int uvc_ctrl_init_xu_ctrl(struct uvc_device *= dev, return ret; } =20 +bool uvc_ctrl_is_privacy_control(u8 entity[16], u8 selector) +{ + /* + * This list is not exhaustive, it is a best effort to block access to + * non documented controls that can affect user's privacy. + */ + struct privacy_control { + u8 entity[16]; + u8 selector; + } privacy_control[] =3D { + { + .entity =3D UVC_GUID_LOGITECH_USER_HW_CONTROL_V1, + .selector =3D 1, + }, + { + .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, + .selector =3D 9, + }, + }; + int i; + + for (i =3D 0; i < ARRAY_SIZE(privacy_control); i++) + if (!memcmp(entity, privacy_control[i].entity, 16) && + selector =3D=3D privacy_control[i].selector) + return true; + + return false; +} + int uvc_xu_ctrl_query(struct uvc_video_chain *chain, struct uvc_xu_control_query *xqry) { @@ -2995,6 +3024,15 @@ int uvc_xu_ctrl_query(struct uvc_video_chain *chain, return -ENOENT; } =20 + if (uvc_ctrl_is_privacy_control(entity->guid, xqry->selector) && + !uvc_allow_privacy_override_param) { + dev_warn_once(&chain->dev->intf->dev, + "Privacy related controls can only be accessed if param allow_pri= vacy_override is true\n"); + uvc_dbg(chain->dev, CONTROL, "Blocking access to privacy related Control= %pUl/%u\n", + entity->guid, xqry->selector); + return -EACCES; + } + if (mutex_lock_interruptible(&chain->ctrl_mutex)) return -ERESTARTSYS; =20 diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc= _driver.c index 71563d8f4bcf581694ccd4b665ff52b629caa0b6..c292bf8b6f57e9fdacee726285f= 5b46e638fd317 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -35,6 +35,7 @@ unsigned int uvc_hw_timestamps_param; static unsigned int uvc_quirks_param =3D -1; unsigned int uvc_dbg_param; unsigned int uvc_timeout_param =3D UVC_CTRL_STREAMING_TIMEOUT; +bool uvc_allow_privacy_override_param; =20 static struct usb_driver uvc_driver; =20 @@ -2474,6 +2475,25 @@ MODULE_PARM_DESC(trace, "Trace level bitmask"); module_param_named(timeout, uvc_timeout_param, uint, 0644); MODULE_PARM_DESC(timeout, "Streaming control requests timeout"); =20 +static int param_set_privacy(const char *val, const struct kernel_param *k= p) +{ + pr_warn_once("uvcvideo: " DEPRECATED + "allow_privacy_override parameter will be eventually removed.\n"); + return param_set_bool(val, kp); +} + +static const struct kernel_param_ops param_ops_privacy =3D { + .set =3D param_set_privacy, + .get =3D param_get_bool, +}; + +param_check_bool(allow_privacy_override, &uvc_allow_privacy_override_param= ); +module_param_cb(allow_privacy_override, ¶m_ops_privacy, + &uvc_allow_privacy_override_param, 0644); +__MODULE_PARM_TYPE(allow_privacy_override, "bool"); +MODULE_PARM_DESC(allow_privacy_override, + "Allow access to privacy related controls"); + /* ------------------------------------------------------------------------ * Driver initialization and cleanup */ diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v= 4l2.c index 03c64b5698bf4331fed8437fa6e9c726a07450bd..510cf47c86a62ba7fe3c7fa51be= 82c996cf37f9f 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -133,6 +133,13 @@ static int uvc_ioctl_xu_ctrl_map(struct uvc_video_chai= n *chain, return -EINVAL; } =20 + if (uvc_ctrl_is_privacy_control(xmap->entity, xmap->selector) && + !uvc_allow_privacy_override_param) { + dev_warn_once(&chain->dev->intf->dev, + "Privacy related controls can only be mapped if param allow_priva= cy_override is true\n"); + return -EACCES; + } + map =3D kzalloc(sizeof(*map), GFP_KERNEL); if (map =3D=3D NULL) return -ENOMEM; diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvi= deo.h index 9a86d7f1f6ea022dace87614030bf0fde0d260f0..4b1a70e3100bbf2180411a865a8= 9952a81d0f0a4 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -662,6 +662,7 @@ extern unsigned int uvc_clock_param; extern unsigned int uvc_dbg_param; extern unsigned int uvc_timeout_param; extern unsigned int uvc_hw_timestamps_param; +extern bool uvc_allow_privacy_override_param; =20 #define uvc_dbg(_dev, flag, fmt, ...) \ do { \ @@ -792,6 +793,7 @@ int uvc_xu_ctrl_query(struct uvc_video_chain *chain, struct uvc_xu_control_query *xqry); =20 void uvc_ctrl_cleanup_fh(struct uvc_fh *handle); +bool uvc_ctrl_is_privacy_control(u8 entity[16], u8 selector); =20 /* Utility functions */ struct usb_host_endpoint *uvc_find_endpoint(struct usb_host_interface *alt= s, diff --git a/include/linux/usb/uvc.h b/include/linux/usb/uvc.h index dea23aabbad48270c807463c1a7e1c0d1b79fc1f..70c2a7d2523611418aba363328f= 76667d379b571 100644 --- a/include/linux/usb/uvc.h +++ b/include/linux/usb/uvc.h @@ -49,6 +49,10 @@ #define UVC_GUID_LOGITECH_PERIPHERAL \ {0x21, 0x2d, 0xe5, 0xff, 0x30, 0x80, 0x2c, 0x4e, \ 0x82, 0xd9, 0xf5, 0x87, 0xd0, 0x05, 0x40, 0xbd } +#define UVC_GUID_LOGITECH_USER_HW_CONTROL_V1 \ + {0x82, 0x06, 0x61, 0x63, 0x70, 0x50, 0xab, 0x49, \ + 0xb8, 0xcc, 0xb3, 0x85, 0x5e, 0x8d, 0x22, 0x1f } + =20 /* https://learn.microsoft.com/en-us/windows-hardware/drivers/stream/uvc-e= xtensions-1-5#222-extension-unit-controls */ #define UVC_MSXU_CONTROL_FOCUS 0x01 --=20 2.52.0.rc1.455.g30608eb744-goog From nobody Tue Dec 2 02:20:22 2025 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E866327BE4 for ; Wed, 19 Nov 2025 19:37:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763581045; cv=none; b=L5BzR6mcT9fdvk5tDgyLvqvS/XEQr1KOFayPbbYYv2q9cMKBcgQpM/HhZHBvcTT493QHaEohGucZ/y2ln1csH/qoTP42O892Z/1X6SESrzrVRuDjF3rXPuun7fmJ1uATGuxwNwl6Hpj7BZrNTIXN09IilqNzB1J4P1mHqhVzo/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763581045; c=relaxed/simple; bh=XDj9ocTyx9oryYDrbjArgB3LC+yDZJXak7E+MwK0LjY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MSezXhxF1skaiF0OqSr6ilRZEQUkIGT9zZYBQr6e2oJg+rH1SZJTSNqY3nKT/mhY8pmO8ga1czs43cpL87RrF1jEV6fEy8LqmsuRedvhETq9DsGA6mupvAIRgKl0RaHvOLJaUQHy8W7/ZBhJPjVzv657ZyNUo5iO/SbWD2YtR2g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=YJGq39dQ; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="YJGq39dQ" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5957ac0efc2so31006e87.1 for ; Wed, 19 Nov 2025 11:37:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1763581037; x=1764185837; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=i5eTj0Zl9H6KKr2E/V9bLoQx3up36sHhHmEcBFbvIkE=; b=YJGq39dQv06n1uhvZK0GT7nUQuX1cyNATq3oqw436i21CDPryjgXqYcfaOw5GJ6SFO 3KmQw2xPYGFrxajojSEebU64Qwv0OCptr/GKKj+js8UzPA2z5H47zRFYOCzWrEyw4GQ+ 12s/H8z8eaE85+urKEB6c0VDiyPZel2FBIawA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763581037; x=1764185837; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=i5eTj0Zl9H6KKr2E/V9bLoQx3up36sHhHmEcBFbvIkE=; b=S+wYQy7vX2Qj0p+9ylF85khi9TQ//K2ut+kVqrwyU8qEQfqSLGnZ8NU9l6rYVuM7kx 9r5z/x3ppVVSjWxP3xP7pWz+F+PihRPJ1EZ8f8vjYlfhHTsmgpODtbo6o4NQxcFHqLDB TpSvV6Zjba45GJxNcZpaws9UvOt7z3dFtDhi17MIIRnFw6eYRJt1A/aBborZMRpUUpGe qMWTUmi69s1YK3LvBwIYFysQmDcgQ3DbR2D9tUfZ0u11KTOIcS5FffL4mqkCAVmmIHSj b4FtsgBCHwV/qeg3jsNEbKeo2Dt9vZQpRWKO++zNLaoY4ZOzNLemODyLigJWgOJVds10 +pjQ== X-Forwarded-Encrypted: i=1; AJvYcCUz3pG6lrHI/7nAOW1hwfM/AZrdBAFw0kSW8PlPShmoiid225dPG38SZc+SI/A98hbJrUwY3YzzQs98CKo=@vger.kernel.org X-Gm-Message-State: AOJu0YyEjJrwStm2FNwV89i1dat/iRzIRrhzOGkL9qHbo9oYD2F7pIv4 J+PVnSEpGofysZC6b5gVnbZy+SyiezlkIA0An5g4gmvfNDKA0DoVEUht3WMOqIecdQ== X-Gm-Gg: ASbGncsp8szSTaIht7Ppgizivj4chwCXa1ACsvml36oc+lgtkvfsfvGm1x6+c6Aedon bPnSflVmqNHCshqSHxlZsmvdqKyREK7qeSRfOP3c4NweaLOCN3QL40n6FZlM0hmTScnukux8jkO 8RpWtJvlO3flzYZoEZEE7JJPw9i0Hi/5wuw2aaNT4Wgq7hq070u8dHQ4bqrgTPuidlvppXF4799 bkD+yHeBWCbqOeTRCoNTTGn9y4N27Z/7Lon2dhBmHhF42Dvv4aghfna8ZVNg9qcuQ+6kuuWqhT1 ZoRajamNy6I+Z1mJH/y3sRAFGjGdaLh8RaBUSxvXSF5efhhPiG47wAEsxqDg6oPiA6A9O7cx6Ya BEv0SHP/dxXUplNeP+YFMwT4BusOSlgRF81noNayYNUFQqFu922xBOCUFjZ/4ePDD+9Pip9P7O/ ZvGn0BDp79jaadD3cB40N6djJVe4hqes0H6s27vl7cl1dwrb6fTl/pWGvJRnbfTT2dpP37RzFkq zcSU06+iZE= X-Google-Smtp-Source: AGHT+IERHHkbtKXSw+15NY4svW/rWIoMgO85bCSSYZTk1S6xodaPy31Swm4Ot1JpvrPQxRHT3dqImQ== X-Received: by 2002:a05:6512:3d91:b0:594:25c9:2c6e with SMTP id 2adb3069b0e04-5969e2f6338mr25386e87.25.1763581037401; Wed, 19 Nov 2025 11:37:17 -0800 (PST) Received: from ribalda.c.googlers.com (80.38.88.34.bc.googleusercontent.com. [34.88.38.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5969dbd15a1sm65790e87.98.2025.11.19.11.37.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 11:37:16 -0800 (PST) From: Ricardo Ribalda Date: Wed, 19 Nov 2025 19:37:15 +0000 Subject: [PATCH v2 6/6] media: uvcvideo: RFC: Convert allow_privacy_override into Kconfig Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251119-uvcdynctrl-v2-6-0359ffb98c9e@chromium.org> References: <20251119-uvcdynctrl-v2-0-0359ffb98c9e@chromium.org> In-Reply-To: <20251119-uvcdynctrl-v2-0-0359ffb98c9e@chromium.org> To: Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab , Greg Kroah-Hartman Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.14.2 This patch is just shared for discussion purposes! Do not land. In a perfect world, after a deprecation process, we will be able to remove allow_privacy_override and block all privacy related controls. If there is any usecase out in the field that resists, we shall move it into a Kconfig. This patch shows how the transition to Kconfig can look. Signed-off-by: Ricardo Ribalda --- drivers/media/usb/uvc/Kconfig | 11 +++++++++++ drivers/media/usb/uvc/uvc_ctrl.c | 4 ++-- drivers/media/usb/uvc/uvc_driver.c | 20 -------------------- drivers/media/usb/uvc/uvc_v4l2.c | 4 ++-- drivers/media/usb/uvc/uvcvideo.h | 1 - 5 files changed, 15 insertions(+), 25 deletions(-) diff --git a/drivers/media/usb/uvc/Kconfig b/drivers/media/usb/uvc/Kconfig index 579532272fd6d7a8ef65c1a3a892b723f40e584e..7c0f2260d1357cc4f27fa63d90c= 42f61afd92da9 100644 --- a/drivers/media/usb/uvc/Kconfig +++ b/drivers/media/usb/uvc/Kconfig @@ -20,3 +20,14 @@ config USB_VIDEO_CLASS_INPUT_EVDEV to report button events. =20 If you are in doubt, say Y. + +config USB_VIDEO_CLASS_ALLOW_PRIVACY_OVERRIDE + bool "Allow overriding the privacy controls" + default n + depends on USB_VIDEO_CLASS && BROKEN + help + If this option is enabled, the privacy related controls, such as + the ones controlling the privacy LED will be accessible from + userspace. + + If you are in doubt, say N. diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_c= trl.c index d9cbb942f798dc7138608982a5d3e3ef9f8141f6..c41724a342e57f64f3c10af9752= bd45209f80e36 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -3025,9 +3025,9 @@ int uvc_xu_ctrl_query(struct uvc_video_chain *chain, } =20 if (uvc_ctrl_is_privacy_control(entity->guid, xqry->selector) && - !uvc_allow_privacy_override_param) { + !IS_ENABLED(CONFIG_USB_VIDEO_CLASS_ALLOW_PRIVACY_OVERRIDE)) { dev_warn_once(&chain->dev->intf->dev, - "Privacy related controls can only be accessed if param allow_pri= vacy_override is true\n"); + "Privacy related controls can only be accessed if CONFIG_USB_VIDE= O_CLASS_ALLOW_PRIVACY_OVERRIDE is true\n"); uvc_dbg(chain->dev, CONTROL, "Blocking access to privacy related Control= %pUl/%u\n", entity->guid, xqry->selector); return -EACCES; diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc= _driver.c index c292bf8b6f57e9fdacee726285f5b46e638fd317..71563d8f4bcf581694ccd4b665f= f52b629caa0b6 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -35,7 +35,6 @@ unsigned int uvc_hw_timestamps_param; static unsigned int uvc_quirks_param =3D -1; unsigned int uvc_dbg_param; unsigned int uvc_timeout_param =3D UVC_CTRL_STREAMING_TIMEOUT; -bool uvc_allow_privacy_override_param; =20 static struct usb_driver uvc_driver; =20 @@ -2475,25 +2474,6 @@ MODULE_PARM_DESC(trace, "Trace level bitmask"); module_param_named(timeout, uvc_timeout_param, uint, 0644); MODULE_PARM_DESC(timeout, "Streaming control requests timeout"); =20 -static int param_set_privacy(const char *val, const struct kernel_param *k= p) -{ - pr_warn_once("uvcvideo: " DEPRECATED - "allow_privacy_override parameter will be eventually removed.\n"); - return param_set_bool(val, kp); -} - -static const struct kernel_param_ops param_ops_privacy =3D { - .set =3D param_set_privacy, - .get =3D param_get_bool, -}; - -param_check_bool(allow_privacy_override, &uvc_allow_privacy_override_param= ); -module_param_cb(allow_privacy_override, ¶m_ops_privacy, - &uvc_allow_privacy_override_param, 0644); -__MODULE_PARM_TYPE(allow_privacy_override, "bool"); -MODULE_PARM_DESC(allow_privacy_override, - "Allow access to privacy related controls"); - /* ------------------------------------------------------------------------ * Driver initialization and cleanup */ diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v= 4l2.c index 510cf47c86a62ba7fe3c7fa51be82c996cf37f9f..d52497d68b910553f385b1b41ec= 5c4eecb915743 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -134,9 +134,9 @@ static int uvc_ioctl_xu_ctrl_map(struct uvc_video_chain= *chain, } =20 if (uvc_ctrl_is_privacy_control(xmap->entity, xmap->selector) && - !uvc_allow_privacy_override_param) { + !IS_ENABLED(CONFIG_USB_VIDEO_CLASS_ALLOW_PRIVACY_OVERRIDE)) { dev_warn_once(&chain->dev->intf->dev, - "Privacy related controls can only be mapped if param allow_priva= cy_override is true\n"); + "Privacy related controls can only be mapped if CONFIG_USB_VIDEO_= CLASS_ALLOW_PRIVACY_OVERRIDE is true\n"); return -EACCES; } =20 diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvi= deo.h index 4b1a70e3100bbf2180411a865a89952a81d0f0a4..5da219e1c6ac89e89a1658f1126= bfa292876d55f 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -662,7 +662,6 @@ extern unsigned int uvc_clock_param; extern unsigned int uvc_dbg_param; extern unsigned int uvc_timeout_param; extern unsigned int uvc_hw_timestamps_param; -extern bool uvc_allow_privacy_override_param; =20 #define uvc_dbg(_dev, flag, fmt, ...) \ do { \ --=20 2.52.0.rc1.455.g30608eb744-goog