Score:0

Turn off webcam on Ubuntu 20.04

de flag

I posted this question to get cheese working on my pc. The solution I recieved didn't work so I tried installing KDE's camera app, 'Kamoso' and it too showed a long error message.

priyanshu@Inspiron-7501:~$ kamoso 
QGLXContext: Failed to create dummy context
new device "Integrated_Webcam_HD: Integrate" "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0/video4linux/video0" "/dev/video0"
Playing device changed "/dev/video0"
failed to acquire GL context to resolve capabilities, using defaults..
file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/private/globaltoolbar/ToolBarPageHeader.qml:44:9: QML ActionToolBar: Binding loop detected for property "actions"
file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/private/globaltoolbar/ToolBarPageHeader.qml:44:9: QML ActionToolBar: Binding loop detected for property "actions"
file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/private/globaltoolbar/ToolBarPageHeader.qml:44:9: QML ActionToolBar: Binding loop detected for property "actions"
error: no element "bulge"
error: no element "frei0r-filter-cartoon"
error: no element "frei0r-filter-twolay0r"
file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/private/globaltoolbar/PageRowGlobalToolBarUI.qml:113: TypeError: Cannot read property 'globalToolBarStyle' of null
file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/private/globaltoolbar/PageRowGlobalToolBarUI.qml:58:17: Unable to assign [undefined] to QQmlListProperty<QObject>
file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/private/globaltoolbar/PageRowGlobalToolBarUI.qml:49:13: Unable to assign [undefined] to bool
kf5.kdbusaddons: Can not find 'kdeinit5' executable at  "/home/priyanshu/.local/bin:/home/priyanshu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" "/usr/bin, /usr/lib/qt5/bin"
Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile) 
Aborted (core dumped)

But it has also turned my webcam on an I can't get it to turn off. I tried suspending my laptop but that didn't work. Rebooting might resolve the problem but I wanted to get to the root of it so I started looking for some articles online.

I tried '''sudo modprobe -r uvcvideo``` but it didn't wor and I got this:

modprobe: FATAL: Module uvcvideo is in use

Then I listed the processes using this module:

priyanshu@Inspiron-7501:~$ lsmod | grep uvcvideo
uvcvideo               98304  1
videobuf2_vmalloc      20480  1 uvcvideo
videobuf2_v4l2         32768  1 uvcvideo
videobuf2_common       61440  2 videobuf2_v4l2,uvcvideo
videodev              245760  4 videobuf2_v4l2,uvcvideo,videobuf2_common
mc                     57344  4 videodev,videobuf2_v4l2,uvcvideo,videobuf2_common

But it again returned a bunch of modules which I again can't remove as they all are in use. On running lsmod on each of them I just get looping through different modules.

Is there a way to kill all processes using a module automatically? Any help is appreciated.

in flag
"Unplug" the USB connection: `echo "1-5" >/sys/bus/usb/drivers/usb/unbind`. Count to five, then: `echo "1-5" >/sys/bus/usb/drivers/usb/bind`.
FedKad avatar
cn flag
How did you find the "device id" for the `echo` command @matigo ?
Priyanshu Sahani avatar
de flag
There is no external device connected to my laptop. The problem is with the internal webcam. How does unbinding and binding usb help?
in flag
@FedKad it's in the output in the first code block: `... usb1/1-5/1-5:1.0/ ...`
in flag
@PriyanshuSahani your camera shows as being a USB device. USB devices are not all external. Heck, many keyboards, touchpads, nubs, cameras, fingerprint sensors, temperature sensors and all sorts of other things that are built into a notebook are connected over USB. The bus is extensible, cheap, and easily supported. With 3.1 having such a large amount of bandwidth, the "U" in USB actually makes sense now ...
Priyanshu Sahani avatar
de flag
`priyanshu@Inspiron-7501:~$ sudo echo "1-5" >/sys/bus/usb/drivers/usb/unbind bash: /sys/bus/usb/drivers/usb/unbind: Permission denied `
Priyanshu Sahani avatar
de flag
@matigo as you said 'keybords' are built into a pc. So won't my keyboard get disconnected too after running the first command?
in flag
Your keyboard is not using bus `1` port `5`, so would not be disconnected. USB devices can be controlled individually so long as the controller allows it. Yours, it seems, does not want to play nice. Believe it or not, I do try to pay attention to details and ask additional questions before breaking things
Priyanshu Sahani avatar
de flag
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/133475/discussion-between-priyanshu-sahani-and-matigo).
nobody avatar
gh flag
usbreset from usb-utils can be used to reset an usb device.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.