-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: usb video class (webcam) extension
Add usb video class v4l drivers extension. Signed-off-by: Jacob McSwain <jacob.a.mcswain@gmail.com> Signed-off-by: Noel Georgi <git@frezbo.dev>
- Loading branch information
1 parent
411dbc2
commit 5a97a46
Showing
9 changed files
with
114 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Video4Linux USB Video Class extension | ||
|
||
## Installation | ||
|
||
See [Installing Extensions](https://github.com/siderolabs/extensions#installing-extensions). | ||
|
||
## Usage | ||
|
||
Enable the `uvcvideo` module in Talos machine config to enable `/dev/video` devices from USB devices supporting the USB video device class. | ||
|
||
```yaml | ||
machine: | ||
kernel: | ||
modules: | ||
- name: uvcvideo | ||
``` | ||
## Verifiying | ||
You can verify the modules are enabled by reading the `/proc/modules` where it _should_ show the module is live. | ||
|
||
For example: | ||
|
||
``` | ||
❯ talosctl -n 192.168.42.15 read /proc/modules | ||
uvcvideo 122880 - - Live 0xffffffffc065f000 | ||
videobuf2_vmalloc 16384 - - Live 0xffffffffc063b000 | ||
videobuf2_memops 16384 - - Live 0xffffffffc0588000 | ||
videobuf2_v4l2 28672 - - Live 0xffffffffc05b3000 | ||
videobuf2_common 61440 - - Live 0xffffffffc064f000 | ||
videodev 237568 - - Live 0xffffffffc0600000 | ||
mc 49152 - - Live 0xffffffffc05f3000 | ||
``` | ||
|
||
In addition, you should be able to verify presence of the video device if the USB device is plugged in, checking `/dev` directory. | ||
|
||
For example: | ||
|
||
``` | ||
❯ talosctl -n 192.168.42.15 ls /dev | grep video | ||
192.168.42.15 video0 | ||
192.168.42.15 video1 | ||
``` | ||
|
||
You can also verify everything in dmesg: | ||
|
||
``` | ||
❯ talosctl -n 192.168.42.15 dmesg | ||
# look for lines like these: | ||
kern: info: [2024-01-15T19:37:30.689914441Z]: videodev: Linux video capture interface: v2.00 | ||
kern: info: [2024-01-15T19:37:34.222751441Z]: usbcore: registered new interface driver uvcvideo | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
modules.order | ||
modules.builtin | ||
modules.builtin.modinfo | ||
kernel/drivers/media/common/videobuf2/videobuf2-common.ko | ||
kernel/drivers/media/common/videobuf2/videobuf2-memops.ko | ||
kernel/drivers/media/common/videobuf2/videobuf2-v4l2.ko | ||
kernel/drivers/media/common/videobuf2/videobuf2-vmalloc.ko | ||
kernel/drivers/media/mc/mc.ko | ||
kernel/drivers/media/usb/uvc/uvcvideo.ko | ||
kernel/drivers/media/v4l2-core/v4l2-dv-timings.ko | ||
kernel/drivers/media/v4l2-core/videodev.ko |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: v1alpha1 | ||
metadata: | ||
name: v4l-uvc | ||
version: "$VERSION" | ||
author: Jacob McSwain | ||
description: | | ||
This system extension provides the Video4Linux kernel modules required for USB Video Class devices built against a specific Talos version. | ||
This driver enables Video4Linux devices such as webcams. | ||
compatibility: | ||
talos: | ||
version: ">= v1.5.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: v4l-uvc-drivers | ||
variant: scratch | ||
shell: /toolchain/bin/bash | ||
dependencies: | ||
- stage: base | ||
# The pkgs version for a particular release of Talos as defined in | ||
# https://github.com/siderolabs/talos/blob/<talos version>/pkg/machinery/gendata/data/pkgs | ||
- image: "{{ .PKGS_PREFIX }}/kernel:{{ .BUILD_ARG_PKGS }}" | ||
steps: | ||
- prepare: | ||
- | | ||
sed -i 's#$VERSION#{{ .VERSION }}#' /pkg/manifest.yaml | ||
- install: | ||
- | | ||
export KERNELRELEASE=$(find /lib/modules -type d -name "*-talos" -exec basename {} \+) | ||
mkdir -p /rootfs | ||
xargs -a /pkg/files/modules.txt -I {} install -D /lib/modules/${KERNELRELEASE}/{} /rootfs/lib/modules/${KERNELRELEASE}/{} | ||
depmod -b /rootfs ${KERNELRELEASE} | ||
- test: | ||
- | | ||
# https://www.kernel.org/doc/html/v4.15/admin-guide/module-signing.html#signed-modules-and-stripping | ||
find /rootfs/lib/modules -name '*.ko' -exec grep -FL '~Module signature appended~' {} \+ | ||
finalize: | ||
- from: /rootfs | ||
to: /rootfs | ||
- from: /pkg/manifest.yaml | ||
to: / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VERSION: "{{ .BUILD_ARG_TAG }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters