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
I am now running this automatically on boot, using systemd (@reboot
time setting./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.
You may also like:
- Debian on a £190 Lenovo ThinkPad X1 Yoga Gen 2
- Snikket, a self-contained XMPP distribution
- GSConnect (KDE Connect), WireGuard, and Debian 12 Bookworm
- Unlocking a LUKS-encrypted partition via ssh on Debian 12 Bookworm
- NetworkManager: automatically switch between Ethernet and Wi-Fi
- Fixing sogo's 'incorrect string value' error
- Updating the LUKS key derivation function on Debian
- Backing up to a USB stick automatically via udev
- Fixing espanso incomplete text replacement
- Automating actions in Nautilus (GNOME's file manager) with scripts
- Jabra Evolve2 40 and Debian Linux
- Enabling Webauthn in Firefox via snap
- Decrapifying (mostly) an Amazon Fire 8 HD Kids tablet via Linux
- Microsoft SurfaceBook 2 running Debian Linux working with two 4K screens
- Fixing rkhunter's 'Update failed' error