Expand description
Generic discovery of Logitech USB Video Class (UVC) webcams.
Mice and keyboards speak Logitech’s proprietary HID++ (over a Bolt/Unifying
receiver or directly) — see the openlogi-hid crate. Webcams don’t: every
Logitech camera (StreamCam, Brio, C920, C922, C270, C930e, …) is a standard
UVC device and enumerates the same way. So detection keys off the USB vendor
id (0x046d) rather than any per-model quirk — plug in any Logitech
camera and it’s recognised, with no model table to maintain.
macOS has the full backend (AVFoundation capture + IOKit UVC controls);
Windows matches it with Media Foundation capture and DirectShow controls;
Linux uses V4L2 for both, through the kernel’s uvcvideo driver. Other
platforms return an empty list.
Structs§
- Auto
State - One auto toggle’s live and default state, read from the device.
- Camera
- A connected USB Video Class camera.
- Camera
State - Everything the controls UI needs, read in a single device-open: each supported control’s range and each supported auto toggle’s state.
- Camera
Stream - A running capture stream. Dropping it stops the thread and releases the camera, which is what turns the hardware LED back off.
- Control
Range - The device’s reported range and current value for a control.
- Frame
- One decoded camera frame, tightly-packed BGRA8 (
width * height * 4bytes) — gpui’s native texture order, so the preview uploads it without a channel swap. The snapshot path swaps to RGBA when it writes the PNG.
Enums§
- Auto
Toggle - An auto-mode toggle paired with a manual control (focus / exposure / white balance).
- Camera
Authorization - Tri-state Camera permission, mirroring macOS
AVAuthorizationStatus. - Camera
Control - One adjustable camera control, mapped to a UVC selector by each backend.
- Capture
Error - Why a capture attempt failed.
- Control
Error - Why a UVC control operation failed.
Constants§
- LOGITECH_
VID - Logitech’s USB vendor id. Reported in decimal (
1133) inside anAVCaptureDevicemodelID, and in hex (046d) most everywhere else.
Functions§
- apply_
settings - Apply auto toggles and control values in one device open.
- camera_
access_ granted - Whether this process can open the camera nodes it can see.
- camera_
authorization - Report camera access by probing a node.
- capture_
frame - Capture a single frame from the camera with
unique_id, at the camera’s native resolution. - capture_
supported - Whether this platform has a live-capture backend (preview + snapshot). Enumeration and UVC controls can be supported without it.
- control_
range - Read one control’s range and current value.
- control_
ranges - Read the range of every control this camera supports, skipping the rest.
- enumerate_
cameras - Enumerate every connected Logitech UVC camera.
- read_
camera_ state - Read every supported control range and auto-toggle state in one device open.
- request_
camera_ access - No-op: Linux has no consent prompt — access is device-node permissions.
- set_
auto - Turn one auto mode on or off.
- set_
control - Write one control value.
- start_
stream - Start a live capture stream on the camera with
unique_id.