From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yx1-f49.google.com (mail-yx1-f49.google.com [74.125.224.49]) (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 625454562AF for ; Fri, 21 Aug 2026 09:03:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787303041; cv=none; b=WuTQ5znYUFD0JH3IcYO49XfcFAdJxn5oxv4Wgxo5sxm2x8xxCiQ8yw+nUbzmSr1mOblEUxhzCec/2Hp5+QxL9wCjBYCLaTP/EHU61nQ3+ffy/Tl53StTm4Nwu/G7EZcE1U2R1mbdMQ6Uuoax7wwZMeo6dj8S+ft24UX+PvuNkDo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787303041; c=relaxed/simple; bh=Ex60VvMvgK2s8s1Mtj/kS8n774mZCs25qvhLD1PRZsM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PN+mgguuvvIVUjVrxuuNQsDvzuTWq92POML9/aDe1+ptUYuJie7+Dg0QlRN4Yb/ANF/+OtxyZCJZo5tm3Fd9J2NyvssijNEE++J+kVjEK91iaI0dqtky46AuJmQFxyxebtk8I7FFwXAuV3Q19pFPp4TxZwcc5xRQW+boOjbze84= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UlfgMn20; arc=none smtp.client-ip=74.125.224.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UlfgMn20" Received: by mail-yx1-f49.google.com with SMTP id 956f58d0204a3-6688acd1a51so1280818d50.3 for ; Fri, 21 Aug 2026 02:03:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787303024; x=1787907824; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=fnEok9W/wIG/DKSYQxikwdzuHayklyaynyE6Tc7UawY=; b=UlfgMn20p1R7+dzCLnF/9wwVRKaHIgOaVtnRzGKoonfzPfanLSOmJ/jlTS3V47n/f3 08K2qW8H9K0mxiH+sFKNTG/rUCk12UxT5KDPZXVm+icbebLw03yU5XBtpVdtii0DJiOM Cgz8euGjE8bXE3IbWof48Zgya01Nzp5hYSnLl6FxY1H6JR6vB/gnfCmpWSpzdDYmAaR7 MZW6CokedxrfpW5hzyOS5IFPCmCX90ZqNpjoQLiLIRhpdQfi1uUfUA3bv5kCOogVPo9S 5kCLnoEi1A5yTQbpkbxKsJlUuPHcqLJjR4n3cjmWMYwut0a0FugbvVcxL3sgYDoDZPYI ZUZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787303024; x=1787907824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=fnEok9W/wIG/DKSYQxikwdzuHayklyaynyE6Tc7UawY=; b=ls5iTvVBTMYDaqfCcVGAHZhLe8l6vEsfzwukS5czoi+1Mm9vjxDvcQ05HQ1W9Dy6BI mv+5HI8Nh3ea8t6xHLygjsO1cy/0CHAZ4A2Qf5si4OTIaVkOkNikx1zz93j4ihKBAM+u Du84aUD4F97hlzxE6ZDTjY+mtN9EvS/loK7xBnoZEvpYV0o2iyMqTdkZQOAohaLH8+m5 ney0RHiwYtL9to3BrvVHGdDlB7Eyh5YSjR6oravIcy3e/hsQxs32lGcWvEHfJo5N4rev +It1ViP+e6SuGwQS4S77Kd8hV6EVqwhyey81qsI1W/a57x75Xsw+EMe54IhwCo9xhDbP 75sQ== X-Forwarded-Encrypted: i=1; AHgh+RqvBU/s2un1mqkPLXtNGzYxoEcSLWMxo/yJrKJs3y1L22T6wWhiFKD/NeLyGI4jsFEeMi+NhSvwNqTNtCw=@vger.kernel.org X-Gm-Message-State: AFuF++ma29L9QPm4Zz+txOXY0HjRCZyn4cbBnjaBHmBYPxSn7Qc0My9T rn48GVbhh+eAZZIBJkPpZCFugL7I3guCLgANRj8Q23cUCgku8lrS/kdS X-Gm-Gg: AR+sD10boPvpIAEqLO7en2zmUD8F5eTmEfAhqieafSImUISSKsmxh3dTCYhquh1b4ED iBFHNdGVh5rqPF5K2wk7Ehm3BVh5iTLzvjKL0b3dq2gMOuWsli469X0UI0ZPal2TO/FzPgpM/PO 7FNh5fJiBDuRLXu1Rys+ua/dOTFCSv1U4jfo+T2dmas5a6k+mH0tXgEIZH556Gnr6dQYXjpuOHG 1Kh1YB1ZMvInwYPWbQ384li8Qo0sWP4UnVbGHguyEc5SNjQYXCg7mdp1qwbQowzGYeXjP7DKoQp sBz7EgRk2bw/PlrC3c8DHofYoEIiBn4s6rw9sbg0wbcy7p3RfJB2fg0wOrrJ4w5OsBWBjD6fV4W kziDhowK7OAaMYqRTSxTFM4t4AXKPszVfXSF4sGmPuk13Bu11Ik0eP0/nbzMdsR3ffGCSXHCGR/ cRaS+3UeU8wCwO0G6ETgDIqKcrst0M5YXxc3B5NqEkDrnebo7JpXFwGHWO3dzI/mVOea/khq0XT YekuxS5EVeOhwpKCpuqZhtTmmGz9rjc2BzEZoZuSNE= X-Received: by 2002:a05:690e:4812:b0:668:9fa5:b9cc with SMTP id 956f58d0204a3-66ce48cc4d3mr1589911d50.0.1787303024421; Fri, 21 Aug 2026 02:03:44 -0700 (PDT) Received: from llmbox.. ([38.81.85.65]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-66ccb172b96sm4000100d50.15.2026.08.21.02.03.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2026 02:03:41 -0700 (PDT) From: Michael Jordan To: linux-media@vger.kernel.org, Ricardo Ribalda Cc: hverkuil+cisco@kernel.org, laurent.pinchart@ideasonboard.com, hansg@kernel.org, mchehab@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] media: uvcvideo: query pan/tilt position from the device on every read Date: Fri, 21 Aug 2026 05:03:40 -0400 Message-ID: <20260821090340.3041867-1-jordan.mymail@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: <20260725212332.64927-1-jordan.mymail@gmail.com> <20260731151509.577383-1-jordan.mymail@gmail.com> <20260801050049.984234-1-jordan.mymail@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Ricardo, On Tue, 18 Aug 2026 13:30:57 +0200, Ricardo Ribalda wrote: > I believe that if AUTO_UPDATE would be properly initialized, then, the > values will always be fresh when you run G_CTRL o G_EXT_CTRLS from > userspace: > > G_EXT_CTRLS > uvc_ioctl_g_ext_ctls() > uvc_ctrl_rollback() > uvc_ctrl_commit() > uvc_ctrl_commit_entity() > ctrl->loaded=0 You are right, and this corrects what I wrote on 14 August. The rollback at the end of every G_EXT_CTRLS runs uvc_ctrl_commit_entity(), which clears ->loaded for an AUTO_UPDATE control at the top of the loop, before the dirty/rollback checks, so the following read re-queries the device. I had only counted the Control Change interrupt and the SET_CUR commit as cache-invalidation points and missed that the read path invalidates its own cache. So on this device, once AUTO_UPDATE is restored, polling G_EXT_CTRLS returns fresh data with no volatile flag involved. My claim that "correcting the firmware would not make the position observable" was wrong. > Until they reply maybe you want to: > - rename uvc_ctrl_fixup_xu_info to uvc_ctrl_fixup_flags > - modify uvc_ctrl_get_flags so it calls uvc_ctrl_fixup_flags > - add your device information to uvc_ctrl_fixup_flags I did this and tested it on the hardware. For the record, the device's GET_INFO for CT_PANTILT_ABSOLUTE (entity 1, selector 0x0d) returns 0x03 -- GET|SET, no AUTOUPDATE bit -- so uvc_ctrl_get_flags() masks off the UVC_CTRL_FLAG_AUTO_UPDATE that the static uvc_ctrls[] entry sets for this control. Calling the fixup from uvc_ctrl_get_flags() unconditionally (so it also runs when GET_INFO succeeds) and adding { USB_DEVICE(0x3564, 0xfef8), 1, UVC_CT_PANTILT_ABSOLUTE_CONTROL, UVC_CTRL_FLAG_SET_CUR | UVC_CTRL_FLAG_GET_RANGE | UVC_CTRL_FLAG_RESTORE | UVC_CTRL_FLAG_AUTO_UPDATE } restores it. One detail worth noting: the existing fixup does info->flags = fixups[i].flags, a full replace rather than a masked OR, so a standard-control entry has to spell out the whole flag set, not just the missing bit. With that in place I verified on an OBSBOT Tiny 2 (3564:fef8) that polling G_EXT_CTRLS tracks a physical slew on both axes, including motion the host never commanded (moving the gimbal by hand), while a stock module returns the stale value indefinitely for the same reads. So your suggestion covers my use case, and I am going to carry the quirk rather than the volatile change. I have also switched my userspace to always send both axes in one S_EXT_CTRLS, as you suggested. Both mappings land in UVC_CTRL_DATA_CURRENT before the single commit, so whatever the read-modify-write loaded is fully overwritten and the merge source stops mattering -- the write side is a non-issue now regardless of the flags. Given the rollback point, the general-case argument for the volatile patch is weaker than I framed it: for the ioctl polling path a device with correct (or fixed-up) flags does not need it. The only things it still does that the quirk does not are to advertise V4L2_CTRL_FLAG_VOLATILE to userspace and to keep the write-side RMW reading from a separate buffer, and with always-send-both-axes I need neither. So I will not push the volatile patch further unless you or Hans think the userspace-visible VOLATILE flag is worth having on its own. If it is useful I am happy to send the fixup as a proper patch with a Suggested-by: you, or to leave it to you if you would rather fold it in. Thanks for the review and the pointer -- both were right. Best regards, Michael Jordan