8000 GitHub - srgclr/uvc-gadget: uvc-gadget with resolution changing and video controls · GitHub
[go: up one dir, main page]

Skip to content

About

uvc-gadget with resolution changing and video controls

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

uvc-gadget

Turns a Raspberry Pi 4 into a USB webcam (UVC gadget) that streams the live view of a camera supported by libgphoto2, such as a Canon DSLR.

Raspberry Pi 4 image (Buildroot)

./build.sh builds an SD-card image (output/images/sdcard.img, also copied to sdcard.img in the repository root) from the external tree in buildroot/.

Serial console

The Linux console and login prompt are on the primary UART (/dev/ttyAMA0), 115200 8N1, 3.3 V, root without password:

Signal GPIO Header pin
TXD0 (Pi to host) GPIO14 8
RXD0 (host to Pi) GPIO15 10
Ground 6

The bootloader prints on the same pins when BOOT_UART=1 is set in its EEPROM configuration (it is off by default), so one adapter shows the whole boot from power-on to login.

USB gadget

S45usbgadget sets up the gadget through configfs: a UVC function with one MJPEG 1056x704 format at 24 fps. There is deliberately no USB serial console: it would give any program on the host a root shell. For the attributes it writes, see the kernel's configfs-usb-gadget-uvc documentation.

How to use

Usage: ./uvc-gadget [options]

Available options are
    -h          Print this help screen and exit
    -n value    Number of Video buffers (b/w 1 and 32)
    -u device   UVC Video Output device
    -x          Show FPS information

The video source is a camera supported by libgphoto2 (live-view preview frames, sent as MJPEG). On the Raspberry Pi 4 image, S99uvc-gadget starts it as uvc-gadget -u /dev/video0 -x and its output goes to /tmp/uvc-gadget.log.

Build

Needs libgphoto2 (e.g. libgphoto2-dev on Debian/Ubuntu).

  • host: make
  • Cross compile: make CROSS_COMPILE=aarch64-linux-gnu-

The Raspberry Pi 4 image builds it as a Buildroot package (buildroot/package/uvc-gadget).

Origin

Licence

GPL version 2 or later; see LICENSE. The copyright and licence notice at the top of uvc-gadget.c must be kept in copies and derived versions.

About

uvc-gadget with resolution changing and video controls

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0