How to disable integrated webcam and still be able to use an external one

I am looking for a way to disable the webcam that is integrated into my laptop. The webcam is using uvcvideo module but I do not want to blacklist it since it is also being used by an external webcam I have.

Is there any way of disabling the device itself without touching the modules list?

This is how the webcams are listed by lsusb. The first one is an integrated one (It is identified by some apps as BisonCam NB Pro), the second one is the external Logitech C525:

Bus 002 Device 004: ID 5986:0361 Acer, Inc 
Bus 003 Device 002: ID 046d:0826 Logitech, Inc. 

I have already checked BIOS - there is no way of disabling the webcam from there. Besides I would love to learn how to disable the device by ID anyway.

Thanks!


Solution 1:

It's quite simple. The hard work is working out what the path to the USB device is. We need to start by finding which device we want to disable. We can do this with lsusb:

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 0402:5602 ALi Corp. M5602 Video Camera Controller
Bus 001 Device 003: ID 045e:0723 Microsoft Corp. LifeCam VX-7000 (UVC-compliant)

Change 1-6 to your device ports to be disabled. The port often isn't logical (it's physical) but you can get a port mapping with lsusb -t. Once you think you have it, you can test it with:

cat /sys/bus/usb/devices/1-6/id{Vendor,Product} 

This gives me 0402 and 5602, vendor and product IDs for the right device (as listed in lsusb).

Now we've found it, turning it off is simple:

echo "0" > /sys/bus/usb/devices/1-6/bConfigurationValue

After making sure it works as desired, make it load every startup (for example, in /etc/rc.local.)

Solution 2:

@surjack: 1-6 depends on your port mapping. If you type lsusb -t you will get it and then compare it with the output of lsusb. For me i get the following outputs:

lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 5986:0525 Acer, Inc 
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 012: ID 413c:2107 Dell Computer Corp. 

and

lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 1, Class=Video, Driver=uvcvideo, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
    |__ Port 3: Dev 9, If 0, Class=Vendor Specific Class, Driver=hdm_usb, 480M
    |__ Port 4: Dev 10, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 3: Dev 11, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 4: Dev 12, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
        |__ Port 3: Dev 4, If 0, Class=Wireless, Driver=btusb, 12M
        |__ Port 3: Dev 4, If 1, Class=Wireless, Driver=btusb, 12M

Now just find the right Bus which is 04 in my case because the Acer, Inc is the camera. The port mapping shows the camera is located at Bus 04.Port 1. This means instead of using 1-6 I have to use 4-1. I am not a Linux/Ubuntu expert but this gives me the impression that you have to use Bus-Port and simply use the numbers. If you want to be 100% sure use the cat command as described:

cat /sys/bus/usb/devices/<Bus>-<Port>/id{Vendor,Product} 

and compare it with lsusb.

In my case:

cat /sys/bus/usb/devices/4-1/id{Vendor,Product}
5986
0525

which is identically to the lsusb output: 5986:0525.

Now you found your internal webcam.

But unfortunately lysdexia is right and the echo command does not work because Permission denied.

Is there another solution available?