How to setup the cameras on a Surface Go 3 for video calling (GNU/Linux).
What we are going to do:
We're going to download and compile libcamera, a camera support library for Linux.
Installing dependencies:
Open up your terminal and run the following command:
Select your distribution
Building:
Clone libcamera an cd into it
git clone https://git.libcamera.org/libcamera/libcamera.git
cd libcamera
Build libcamera with only what we need
meson build -Dpipelines=uvcvideo,vimc,ipu3 -Dipas=vimc,ipu3 -Dprefix=/usr -Dgstreamer=enabled ninja -C build sudo ninja -C build install
Testing:
Now you can run sudo qcam
and make sure that both your cameras are working.
Configuring:
We need to give ourselves permission to use the camera without sudo
sudo usermod -aG video $USER && newgrp video
Now we'll create a script that will enable us to use our camera in apps that do not use libcamera whenever we run it.
But first we need to get our cameras name. You can get it running cam --list
it looks something like this \_SB_.PCI0.I2C4.CAMF
Example output of cam --list
:
Available cameras: 1: Internal front camera (\_SB_.PCI0.I2C4.CAMF)
Store that name somewhere, as we'll need it later.
Now, create a file and open it with your favourite text editor. You can call it start_cam
.
Add the following line:
sudo modprobe v4l2loopback video_nr=42 card_label="virtualcam" exclusive_caps=1
Now add this text, but replace CAM_NAME with your camera's name that you got earlier
gst-launch-1.0 libcamerasrc camera-name='\\CAM_NAME' ! \ video/x-raw,width=1280,height=720,framerate=30/1,format=NV12 \ ! videoconvert ! video/x-raw,format=YUY2 ! queue ! \ v4l2sink device=/dev/video42
Now you need to make the file executable and copy it to /usr/bin (replace start_cam with your file's name)
chmod +x start_cam
sudo cp start_cam /usr/bin
That's it! Now, whenever you want to use your camera, just type start_cam
and it will show up!

