1

I'm using a laptop running Ubuntu 18.04 with one built-in webcam (integral to the monitor), and I'm attaching multiple other webcams.

I'd like to disable the built-in webcam only, and continue to allow for as many other cameras as I choose to connect. Is there an elegant way to do this in Ubuntu 18.04?

All the current info I can find on this topic suggests sudo modprobe -r uvcvideo and sudo modprobe uvcvideo to disable and enable webcams temporarily and editing /etc/modprobe.d/blacklist.conf to disable webcams persistently after a reboot, but both of these methods seem to turn on or off all webcams, not only the built-in webcam or a certain specified webcam.

2

There is indeed a rather elegant solution. Instead of telling the driver to ignore the device, you tell the system to ignore the device.

As internal webcams are normally detected as a USB device, you can add an 'udev rule' that will disable the device at boot.

Example: In my case the internal webcam of my chromebook is listed as following with lsusb:

minimec@ace:~$ lsusb

Bus 002 Device 002: ID 1bcf:2c67 Sunplus Innovation Technology Inc

With this information we can now add an 'udev rule' to /etc/udev/rules.d

sudo nano /etc/udev/rules.d/40-disable-internal-webcam.rules

We add the following line and specify the idVendor and idProduct values using the values we got from the 'lsusb' command. As showed before my values are '1bcf:2c67'

ATTRS{idVendor}=="1bcf", ATTRS{idProduct}=="2c67", RUN="/bin/sh -c 'echo 0 >/sys/\$devpath/authorized'"

Save the the file with 'ctrl+x' 'y'. After a reboot your internal WebCam should be ignored by the system.

2
  • I love you! I love you! Works perfectly. Could you provide a link explaining the 'echo 0 >/sys/\$devpath/authorized' portion of the command ?? – cdahms Nov 11 '19 at 20:08
  • Basically the command means "write '0' in file 'authorized' located at /sys/$devpath". Now '$devpath' is a variable with the actual device path that the system has detected for your internal camera. At boot every hardware component of your computer gets a configuration folder with some configuration files in '/sys/'. For 'USB ports' there is an 'authorized' file with the default content of '1' (enabled). So by overwriting it with '0', we disable the port. 'find /sys/devices -name "authorized" | xargs grep "0"' should give you the actual location of the 'authorized' file we modified. – minimec Nov 12 '19 at 18:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.