Skip to main content

Crate openlogi_camera

Crate openlogi_camera 

Source
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§

AutoState
One auto toggle’s live and default state, read from the device.
Camera
A connected USB Video Class camera.
CameraState
Everything the controls UI needs, read in a single device-open: each supported control’s range and each supported auto toggle’s state.
CameraStream
A running capture stream. Dropping it stops the thread and releases the camera, which is what turns the hardware LED back off.
ControlRange
The device’s reported range and current value for a control.
Frame
One decoded camera frame, tightly-packed BGRA8 (width * height * 4 bytes) — 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§

AutoToggle
An auto-mode toggle paired with a manual control (focus / exposure / white balance).
CameraAuthorization
Tri-state Camera permission, mirroring macOS AVAuthorizationStatus.
CameraControl
One adjustable camera control, mapped to a UVC selector by each backend.
CaptureError
Why a capture attempt failed.
ControlError
Why a UVC control operation failed.

Constants§

LOGITECH_VID
Logitech’s USB vendor id. Reported in decimal (1133) inside an AVCaptureDevice modelID, 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.