Re: [RFC PATCH 4/4] media: add gv-usb2 audio capture driver
From: Danilo Krummrich
Date: Mon Jul 13 2026 - 10:45:11 EST
On Sun Jul 12, 2026 at 11:08 PM CEST, Colin Braun wrote:
> +/// Write a vendor-specific control register on the GV-USB2 device.
> +///
> +/// Uses a vendor-type control request (`REQ_WRITE_REG`) to write the
> +/// given `value` to the given `reg` address.
> +fn write_reg(intf: &usb::Interface<device::Bound>, reg: u16, value: u8) -> Result {
In addition to raw control messages, this can leverage the generic I/O backend
infrastructure, so you don't have to roll your own write_reg() function and use
the register!() infrastructure instead. See also [1] and [2].
[1] https://lore.kernel.org/driver-core/20260706-io_projection-v6-0-72cd5d055d54@xxxxxxxxxxx/
[2] https://lore.kernel.org/lkml/DJVQ852J7SOH.26YBIJTQ9B66G@xxxxxxxxxx/
> + let req = usb::ch9::CtrlRequest::new(
> + usb::ch9::RequestType::new(
> + usb::ch9::Direction::Out,
> + usb::ch9::Type::Vendor,
> + usb::ch9::Recipient::Device,
> + ),
> + regs::REQ_WRITE_REG,
> + u16::from(value),
> + reg,
> + 0,
> + );
> + let dev: &usb::Device<device::Bound> = intf.as_ref();
> + dev.control_msg(&req, None, Delta::from_millis(1_000))
> + .map(|_| ())
> +}