Disabling my ThinkPad's internal camera on boot

Most of the time, I use my ThinkPad connected to a dock, with a couple of monitors, and an external USB webcam. This webcam is better than the internal webcam yet the internal webcam comes up first in some video conferencing menus, forcing me to manually change it.

So I want to disable the ThinkPad’s internal camera by default, but still be able to easily re-enable it when I want (thus ruling out an approach based on the BIOS).

Thanks to all the wonderful people in the fediverse who offered their thoughts.

(If it helps, this is working on Debian 12 with Gnome.)

Two shell scripts

The approach I have working is basic, but functional: two shell scripts. One disables the camera, and one enables the camera.

Disabling the camera

#!/bin/bash

alert() {

sudo -u neil DISPLAY=wayland-0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "$1"  --icon=dialog-information -t 1000

}

echo 0 | sudo tee /sys/bus/usb/devices/1-8/bConfigurationValue

alert "Camera disabled"

This disables the camera and shows a nicely-formatted alert in Gnome. There’s no error checking.

I determined my internal camera’s device using sudo lshw which gave a long output including:

            *-usb:0
                   description: Video
                   product: Integrated Camera
                   vendor: 8SSC20F27034L1GZ7AE03PG
                   physical id: 8
                   bus info: usb@1:8
                   version: 0.16
                   serial: 200901010001
                   capabilities: usb-2.00
                   configuration: driver=uvcvideo maxpower=500mA speed=480Mbit/s

Whether it is always 1:8 / 1-8, I am not sure; it has been after a few reboots, but I should probably extend the script to check.

I run this automatically on reboot, using a cronjob and the @reboot time setting. I am now running this automatically on boot, using systemd (/lib/systemd/system/disable_internal_camera.service):

[Unit]
Description=Disables the internal camera

[Service]
ExecStart=/home/neil/briefcase/Store/tools/camera/camera_off

[Install]
WantedBy=multi-user.target

Enabling the camera

#!/bin/bash

alert() {

sudo -u neil DISPLAY=wayland-0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "$1"  --icon=dialog-information -t 1000

}

echo 1 | sudo tee /sys/bus/usb/devices/1-8/bConfigurationValue

alert "Camera enabled"

These are both saved in a directory in my $PATH, and chmod +x’d, so I can run either by using camera_on or camera_off as needed.