lördag 3 augusti 2013

How to Disable Your Webcam in Ubuntu?

If you have a web camera on your Laptop that you don’t use at all, then you can disable its driver from loading in Ubuntu as it has two main advantageous. Firstly, you might be able to save some power, and secondly, it should save you a few Megabytes from your RAM, which might help speeding up the booting times as well.

Now, even after disabling it, I did not see any noticeable reduction in power. That is because, most webcams that come with laptops these days are actually connected through a USB port (not visible to the outside), including mine, and Ubuntu puts these non-active USB devices into ‘sleep states’ in order to save power.
So even before I disabled it, it was put into a sleep state thus, I could not see any change in power consumption at all, after disabling it. However, its Kernel module (driver) was about 8.8MB in size, and it is automatically loaded into the RAM, so I decided to disable it to save those Megabytes :) .
If you too want to disable it, then please follow the below procedure.
I’m using Ubuntu 12.04 LTS, but the below method should work in other recent Ubuntu versions. What we are doing is simple. We are going to ‘blacklist’ the webcam driver, so the Kernel would ignore loading it while booting.
__________
Optional: If you wanted to know how much Megabytes your webcam driver consumes, then put the below command in your Terminal window.
lsmod | grep uvcvideo

Then, as shown above, note the numbers next to the ‘uvcvideo’ text line and divide it by 4. Now you should have its size in Megabytes.
__________
Step 1:
Open your Terminal window and enter the below command.
gksudo gedit /etc/modprobe.d/blacklist.conf
Step 2:
This will open up a configuration file. Now go to the end of this file, and simply copy and paste the following code in a new text line.
#Disabling the webcam device.
blacklist uvcvideo

The ‘#Disabling the …’ code is actually optional, but I put it there so you can identify the code afterward.
Once done, save your changes, close the configuration file and reboot your PC to apply the setting. That’s it!.
How to re-enable it later?
Enabling permanently …
Quite simple actually. Open the configuration file again, and remove the added code from it. Save your changes and reboot the computer. That’s it.
Enabling temporarily …
Or, if you only wanted to enable it temporarily, then enter the below command in your Terminal window.
sudo modprobe uvcvideo
And open the program that is trying to access your webcam and now it should be working. But please remember that, the next time you reboot your computer, Ubuntu will automatically disable it.
 
Skicka en kommentar