How do I change the default webcam?
I'm using ubuntu 18.10, and my laptop's (ThinkPad 25) built-in webcam image is distorted and pink. I tried in google hangouts and in cheese, and they both show the same kind of image.
Cheese doesn't show any errors on command line, just says this:
(cheese:5930): Gtk-WARNING **: 09:00:44.808: Theme parsing error: cheese.css:7:35: The style property GtkScrollbar:min-slider-length is deprecated and shouldn't be used anymore. It will be removed in a future version
which I imagine is not relevant(?).
I found this page: https://help.ubuntu.com/community/Webcam/Troubleshooting but it is very old and talks about Skype, and starting Skype with different options, but I can't use Skype, I need Google Hangouts to work.
I believe this may be what my webcam is:
product: Integrated Camera [4F2:B5AB]
vendor: SunplusIT Inc [4F2]
bus info: usb@1:8
version: 0.10
capabilities:
USB 2.0
configuration:
driver: uvcvideo
maxpower: 500mA
speed: 480Mbit/s
Any ideas what to do? Thanks!
Edit. Ok, it appears that my laptop actually has 2 different webcams, and the camera that is showing the bad image is actually named Integrated IR Camera. I found a webpage about it, too: https://blogs.gnome.org/jamesh/2017/10/22/thinkpad-infrared-camera/
I was randomly clicking on buttons in cheese, and there is a button that changes which camera it is using, and the other camera is showing picture just fine. The default camera seems to be the infrared camera -- how do I get rid of it in all programs, since it is not doing anything useful?
Solution 1:
The OPs solution didn't work for me, but has given me a push to the right direction. Indeed, if the IR cam is separate from the main one, it can be detached by removing power from it.
Quick google for "ubuntu disable usb device" has shown this page - https://karlcode.owtelse.com/blog/2017/01/09/disabling-usb-ports-on-linux/
In short - find the USB port to which the camera is connected (1-1.6 in the example below, but it for 1-5 for my laptop):
$ for device in $(ls /sys/bus/usb/devices/*/product); do echo $device;cat $device;done
/sys/bus/usb/devices/1-1.2/product
Dell USB Entry Keyboard
/sys/bus/usb/devices/1-1.6/product
Webcam SC-13HDL11624N
/sys/bus/usb/devices/2-1/product
Amazon Kindle
/sys/bus/usb/devices/2-2/product
USB Receiver
/sys/bus/usb/devices/usb1/product
EHCI Host Controller
/sys/bus/usb/devices/usb2/product
xHCI Host Controller
/sys/bus/usb/devices/usb3/product
xHCI Host Controller
Then power it down:
echo '1-1.6' | sudo tee /sys/bus/usb/drivers/usb/unbind
Or do this on reboot via cron:
sudo crontab -e
and add the following there:
@reboot echo '1-1.6' > /sys/bus/usb/drivers/usb/unbind
(of course, replacing "1-1.6" with "1-5" or whatever port your camera is connected)
Similar question and solution is - Is it possible to turn off a specific USB port so it doesn't accept any device?
Solution 2:
So I'll write this here if anyone else runs into this problem and needs my solution.
I ended up disabling the Integrated IR Camera with usb_modeswitch.
First I checked the vendor and product of the Integrated IR Camera with dmesg:
karl@penguin:~$ dmesg |grep "Integrated IR Camera"
[ 1.341836] usb 1-5: Product: Integrated IR Camera
[ 3.741357] uvcvideo: Found UVC 1.00 device Integrated IR Camera (04f2:b5ac)
[ 3.767724] input: Integrated IR Camera: Integrate as /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0/input/input12
This 04f2:b5ac shows the vendor and product.
So I created a customized config file for this device, that will detach the driver from this usb device (the file name contains the vendor and product ids):
karl@penguin:~$ echo "echo DetachStorageOnly=1 > /etc/usb_modeswitch.d/04f2:b5ac" | sudo bash
And then I added a couple of lines into usb_modeswitch udev rules right before the 'LABEL="modeswitch_rules_end"' at the end of the file, so that the config is applied on startup:
karl@penguin:~$ sudo gedit /lib/udev/rules.d/40-usb_modeswitch.rules
(Note that the vendor id and product id still match the ones from dmesg.)
# TP25 IR Camera
ATTR{idVendor}=="04f2", ATTR{idProduct}=="b5ac", RUN+="usb_modeswitch '/%k'"
Rebooted, and now the default Integrated IR Camera is gone for good.