From: Chris Bainbridge <chris.bainbridge@canonical.com>
To: linux-media@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, laurent.pinchart@ideasonboard.com,
hansg@kernel.org, mchehab@kernel.org
Subject: [PATCH 0/3] media: uvcvideo: fix control restore on reset_resume
Date: Tue, 24 Nov 2026 10:06:20 +0000 [thread overview]
Message-ID: <20261124100623.2227323-1-chris.bainbridge@canonical.com> (raw)
uvc_ctrl_restore_values() restores each entity's modified controls in
index order via the transactional commit machinery
(uvc_ctrl_commit_entity()). On devices where SET_CUR on a manual control
STALLs while its master auto control is enabled, the commit switches to
rollback on the first failure: the remaining controls of the entity are
skipped, later entities are not restored, and the rollback copies
UVC_CTRL_DATA_BACKUP over UVC_CTRL_DATA_CURRENT for every dirty control
in the entity - but BACKUP is never populated on the restore path, so
the cached values are corrupted with stale data. __uvc_resume() then
returns early and uvc_status_resume() never runs, leaving the status
(interrupt) endpoint dead after resume. Observed on a Logitech C270
(046d:0825, USB_QUIRK_RESET_RESUME): SET_CUR on WHITE_BALANCE_TEMPERATURE
(selector 10 on unit 2) gets UVC error code 7 (Invalid Request) while
auto WB is enabled. The only userspace-visible effect is
"reset_resume error -5"; on such devices, every resume of a camera whose
controls have been written fails the restore. Kernel log:
restoring control 00000000-...-000000000101/6/10
restoring control 00000000-...-000000000101/12/11
Control error 7 (Invalid request) for (SET_CUR) control 10 on unit 2
UVC non compliance: Error -5 restoring control White Balance Temperature
(selector 10 on unit 2)
reset_resume error -5
patch 1/3 reports the failing control (V4L2 name, entity id, selector,
errno) when the restore fails; diagnostics only, and independently
useful.
patch 2/3 restores the auto (master) controls first and skips inactive
manual controls, so SET_CUR is not sent for a slave while its master is
on. Because the restore does not populate the cache, a master whose
state is unknown (not restored in the first pass and not cached) is
queried with GET_CUR rather than assumed; slaves skipped as inactive
have their cached state invalidated.
patch 3/3 stops using the transactional commit machinery for the
restore: each control is restored individually, failures are recorded
and the remaining controls and entities are still restored, the cached
state is not corrupted by rollback, and __uvc_resume() returns the first
restore error while always resuming the status endpoint - a status URB
submission failure takes priority over the already-logged best-effort
restore error.
Verified on the C270: with auto WB on, the WB temperature restore is
skipped as inactive and no error occurs; with manual WB active, WB auto
is restored first and then WB temperature; PLF and gain are restored
correctly. A 120-trial census across repeated
suspend/reset_resume/capture cycles (three control sequences x two
formats x 20 trials, camera autosuspended before every open so every
open runs the full reset_resume restore) completed with 0 wedged images,
0 restore errors and 0 recovery interventions. Returning the error is
safe: the USB core treats a reset_resume error as informational
(usb_resume_interface()).
Unrelated: the same camera also has a firmware-level race around AWB
mode writes near stream start (userspace-visible; in our testing it
fires only when stream start does not follow a reset_resume). May be
addressed by a quirk series later.
Chris
--
2.53.0
next reply other threads:[~2026-11-24 10:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 10:06 Chris Bainbridge [this message]
2026-11-24 10:06 ` [PATCH 1/3] media: uvcvideo: Report the failing control when restoring controls fails Chris Bainbridge
2026-11-24 10:06 ` [PATCH 2/3] media: uvcvideo: Restore auto controls first and skip inactive slaves Chris Bainbridge
2026-11-24 10:06 ` [PATCH 3/3] media: uvcvideo: Do not abort resume when restoring controls fails Chris Bainbridge
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=20261124100623.2227323-1-chris.bainbridge@canonical.com \
--to=chris.bainbridge@canonical.com \
--cc=hansg@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.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®