← Честа питања

Честа питања су написана на енглеском и холандском; приказана су на енглеском.

Честа питања

Camera and microphone

FAQ › EUZOS Desktop › Camera and microphone · Nederlands

What is it?

EUZOS has its own UVC driver for USB cameras (USB Video Class 1.0–1.5) and offers them to Linux apps (Chromium, for example Teams video calls) as /dev/videoN with a V4L2 subset. The microphone comes from the HD Audio driver (see Sound). A privacy indicator in the taskbar (a red label with a camera and/or microphone icon) is on whenever something uses the camera or the microphone, and is tied to the hardware state, not just to the app. Settings › Camera and microphone shows the devices and the apps with access, and has Test camera and Test microphone.

EUZOS Desktop only; EUZOS Server refuses camera and privacy.

How do I…?

How do I see which cameras EUZOS found?

Type camera in the console: per camera the formats, alternate settings, controls, counters and the stream state (stream: on|off|uncertain, alternate setting N (camera: M)). In the desktop: Settings › Camera and microphone (name, USB port, speed and the largest resolution per format).

How do I test the camera?

Settings › Camera and microphone › Test camera opens a window with the live picture. You can choose the camera, the resolution (up to 1920×1080), the format (MJPEG or YUYV) and 10, 15 or 30 frames per second (default 640×480 MJPEG 30), and set brightness and contrast if the camera has them. Closing the window turns the camera off. The picture stays on this PC and is not saved anywhere.

How do I test the microphone?

Settings › Camera and microphone › Test microphone: a level meter from −60 to 0 dBFS. On the console: sound capture [ms] (see Sound).

How do I see who is using the camera or the microphone?

Click the red label in the taskbar, or type privacy in the console. The console version also shows the process id and for how long, for example Chromium is using the camera (USB HD Webcam) (process 42, 12 s); an entry from the hardware itself is shown as (hardware).

Why does the red label stay on after I closed the app?

The indicator follows the hardware: it only goes off when the camera has confirmed the stop request. If that is not confirmed, the panel says "The camera is still on without an app (…)". Logging out retries the stop (uvc::all_off). Unplugging the camera also ends the stream.

Which apps may use the camera?

Only programs with the permission camera (PERM_CAMERA); without it /dev/videoN does not exist for them (ENOENT). Today that is Chromium (chrome from the package chromium), and test programs started with run +camera <name>. Microphone: permission PERM_MICROPHONE (Chromium, run +mic). A child process never gets more permissions than its parent.

How do I take a single photo from the console?

camera photo [n] [mjpeg|yuyv] [WxH] takes one frame from camera n (default 0, 640×480 MJPEG) after about 1.5 s (the exposure settles), at most 5 s, and prints it as base64 lines between b64-begin and b64-einde. Decode them on another computer (the base64 has no = padding). Keep such frames out of git.

How do I open the test windows remotely?

Only in a test build (not in the production build): camera test opens Test camera on the desktop, camera test microphone opens Test microphone, camera test off closes the test windows and prints how many were closed.

Details

  • Attach (uvc::attach, also on hot-plug): a device with a VideoControl and a VideoStreaming interface; the whole configuration descriptor (up to 16 KiB) is read and parsed (euzos_uvc::desc), then SET_CONFIGURATION. The camera stays off.
  • Switch on (uvc::start): probe and commit (format, frame, interval), the smallest alternate setting that fits the payload, an isochronous (or bulk) endpoint on the xHCI, SET_INTERFACE, and transfer descriptors queued.
  • Frames go straight into the app's buffers (euzos_uvc::payload::Assembler); a frame with an error or lost packet is dropped (the sequence number keeps counting).
  • Switch off (uvc::stop): Stop Endpoint, drop the endpoint, the stop request to the camera (for bulk: CLEAR_FEATURE(ENDPOINT_HALT)), always SET_INTERFACE 0, and only then the DMA memory is returned. This also happens on unplugging, when the program stops and on logout.
  • Controls: brightness, contrast, saturation, hue, white balance (auto and temperature), gamma, gain, power line frequency, sharpness, backlight compensation, auto exposure, exposure time, dynamic framerate — if the camera has them.
  • Limits: at most 2048 descriptors, 4 streaming interfaces, 16 formats, 64 frames per format, 32 intervals, 32 alternate settings, frames up to 24 MiB. Fuzz tested (make camera-test).
  • Test camera runs in a thread cameratest: MJPEG is decoded with euzos_image::jpeg (with the default Huffman tables when the camera leaves them out), YUYV/NV12 is converted with euzos_uvc::preview (BT.601, fixed point). At most 30 frames/s, at most 1920×1080.
  • Test microphone runs in a thread microphonetest using hda::meter_on / meter_take every 50 ms (x86-64 only).
  • Nothing of the picture or the sound is stored or sent.

Reference

Console commands

CommandArgumentsWhat it does
camera—per camera: formats, alternate settings, controls, counters, stream state; plus "Settings › tests: n session(s) active"
camera photo[n] [mjpeg|yuyv] [WxH]one frame as base64 lines (b64-begin <jpg|yuyv> <W>x<H>, b64 …, b64-einde); legacy alias foto
camera test—test build only: open Test camera on the desktop
camera test microphone—test build only: open Test microphone; legacy alias microfoon
camera test off—test build only: close the test windows; legacy alias uit
privacy—who is using the camera or microphone (process, seconds, or (hardware))
run +camera <name> / run +mic <name>[arguments]start a Linux test program with camera or microphone permission (for example camtest)

Functions and modules

Function / moduleRole
kernel::usb::uvc::attachidentify and configure a camera on (hot-)plug
kernel::usb::uvc::start / stop / all_offswitch a stream on and off; all off (logout)
kernel::usb::uvc::eventhandle completed transfers (from usb::poll)
kernel::usb::uvc::listthe cameras (Info) for Settings and camera photo
kernel::usb::uvc::control_get / control_setcamera controls (brightness, contrast, …)
kernel::usb::uvc::status_lines / photothe camera and camera photo commands
kernel::linux::video/dev/videoN (V4L2) for Linux programs
kernel::cameratest (MediaList, Window, status_line)Settings › Camera and microphone, the test windows
kernel::privacy::beginstart a use; returns a Usage handle (dropping it ends the use)
kernel::privacy::hardwarethe UVC driver reports per camera whether the stream is on
kernel::privacy::active / list / lines / version / panel / commandstate for the indicator, the panel and the privacy command
kernel::screen::test_open / test_closeopen/close the test windows (used by camera test)
euzos_uvc (desc, probe, iso, payload, stream, control, v4l2, preview)the pure UVC logic, V4L2 queue and formats, YUV→RGB
euzos_ui::apps::cameratestdrawing the test windows

Protocol messages and formats

V4L2 ioctls supported on /dev/videoN (driver name uvcvideo, bus usb-xhci-<port>):

ioctlWhat
QUERYCAPVIDEO_CAPTURE, STREAMING, EXT_PIX_FORMAT
ENUM_FMT, ENUM_FRAMESIZES, ENUM_FRAMEINTERVALSMJPEG, YUYV, NV12 (what the camera has)
G_FMT, S_FMT, TRY_FMTpixel format and nearest size
G_PARM, S_PARMframe interval
ENUMINPUT, G_INPUT, S_INPUT, G/S_PRIORITYone input "Camera 1"
REQBUFS, QUERYBUF, mmapMMAP only, at most 8 buffers in one memfd
QBUF, DQBUFthe queue; ENODEV when the camera is gone
STREAMON, STREAMOFFcamera on/off; ENOSPC with too little USB bandwidth
QUERYCTRL, QUERYMENU, G_CTRL, S_CTRL, G/S/TRY_EXT_CTRLSthe controls
poll / epollIN when a frame is ready

Not supported: read, USERPTR/DMABUF, /sys/class/video4linux.

Permissions (process permission bits, kernel::proc): PERM_SOUND, PERM_MICROPHONE, PERM_CAMERA (bit 16).

See also

  • docs/CAMERA.md: driver, V4L2, privacy, Settings and test results
  • docs/SOUND.md, "Capture"
  • docs/DESKTOP-DESIGN.md, § 14 (Settings › Camera and microphone)
  • docs/CHROMIUM.md, step C.9
  • Sound, Browser and Chromium