Linux – How to turn the laptop built-in webcam on/off from shell

linuxshellwebcam

Fn+F6 key combination turns my laptop's integrated web camera on/off. Looking at the dmesg output, it seems that the webcam (USB device) is being more or less virtually connected/disconnected to/from the USB bus:

usb 1-5: new high-speed USB device number 9 using ehci_hcd
usb 1-5: New USB device found, idVendor=5986, idProduct=0203
usb 1-5: New USB device strings: Mfr=3, Product=1, SerialNumber=0
usb 1-5: Product: BisonCam, NB Pro
usb 1-5: Manufacturer: Bison Electronics Inc.
uvcvideo: Found UVC 1.00 device BisonCam, NB Pro (5986:0203)
input: BisonCam, NB Pro as /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/input/input14
usb 1-5: USB disconnect, device number 9

The first seven lines come after "connect" and the last line is after "disconnect" event. dmesg timestamps removed for clarity.

showkey executed from a tty console returned keycode 214, xev from KDE returned keycode 220 and also XF86WebCam. Here's the part of xev output related to pressing the Fn+F6:

KeyPress event, serial 40, synthetic NO, window 0x3600001,
    root 0xac, subw 0x0, time 78270130, (346,354), root:(348,377),
    state 0x0, keycode 220 (keysym 0x1008ff8f, XF86WebCam), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

I've already tried sending the keycode of the Fn+F6 combination (either 214, 220 or XF86WebCam) using the xdotool, xvkbd and xmacro, but with no success.

Probably the right way to do it is not by using the keycodes at all.

Best Answer

You may be able to do this using modprobe interactively on the command line. You may be able to blacklist it and then reboot or resource in /etc/modprobe.d/blacklist.conf

I just found this post on AskUbuntu which may provide some more detail, since I don't have a system up with a webcam in front of me at the moment.

Related Question