osresearch / showmewebcam

Raspberry Pi 0 + High Quality Camera = High-quality USB Webcam!
GNU General Public License v3.0
2 stars 0 forks source link

Webcam audio #1

Open osresearch opened 4 years ago

osresearch commented 4 years ago

The Pi4 headphone jack also has composite video, not audio in. Any input would require an i2s board.

osresearch commented 4 years ago

usb audio gadget support can be enabled with


diff --git a/package/piwebcam/multi-gadget.sh b/package/piwebcam/multi-gadget.sh
index 8f28346..0737564 100755
--- a/package/piwebcam/multi-gadget.sh
+++ b/package/piwebcam/multi-gadget.sh
@@ -3,13 +3,14 @@
 SYSDIR="/sys/kernel/config/usb_gadget/pi4"
 SYS_STRINGS="$SYSDIR/strings/0x409"

-CONFIGDIR="$SYSDIR/configs/c.2"
+CONFIGDIR="$SYSDIR/configs/c.3"
 CONFIG_STRINGS="$CONFIGDIR/strings/0x409"

 UVCDIR="$SYSDIR/functions/uvc.usb0"
 UVC_1080P="$UVCDIR/streaming/mjpeg/m/1080p"

 ACMDIR="$SYSDIR/functions/acm.usb0"
+UACDIR="$SYSDIR/functions/uac2.usb0"

 mkdir -p "$SYSDIR"

@@ -50,13 +51,17 @@ ln -s "$UVCDIR/streaming/mjpeg/m" "$UVCDIR/streaming/header/h"
 ln -s "$UVCDIR/streaming/header/h" "$UVCDIR/streaming/class/fs"
 ln -s "$UVCDIR/streaming/header/h" "$UVCDIR/streaming/class/hs"

-# setup the ACM endpoint
+# setup the serial console ACM endpoint
 # (no other configration necessary)
 mkdir "$ACMDIR"

+# setup the audio endpoint
+mkdir "$UACDIR"
+
 # attach the endpoints
 ln -s "$UVCDIR" "$CONFIGDIR/uvc.usb0"
 ln -s "$ACMDIR" "$CONFIGDIR/acm.usb0"
+ln -s "$UACDIR" "$CONFIGDIR/uac2.usb0"

 udevadm settle -t 5 || :
 ls /sys/class/udc > "$SYSDIR/UDC"
``