You are not logged in.

#1 2018-02-17 22:28:03

nze
Member
Registered: 2010-10-11
Posts: 18

How does Firefox (Skype / Chrome) pick the default webcam?

I've been having problems getting Firefox (or Skype / Chrome) to use my Logitech HD Pro Webcam C920. It sometimes works, but mostly doesn't. In Firefox, when I start a video call (eg via messenger) the internal webcam of my Thinkpad T440s is selected by default. The Logitech is listed, but switching to it will end the call. In Skype, it does not even appear as available device.

This is all despite the fact that when I point VLC to /dev/video1  (the logitech), the webcam works just fine.

How can I even debug what's going wrong here? How does Linux decide in what order to list the cameras, and how do apps access them? Presumably they don't just look if /dev/videoN exists, so how does it work?

cheers

Offline

#2 2018-02-18 14:37:32

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: How does Firefox (Skype / Chrome) pick the default webcam?

I can't say how programs pick the video devices as I have never looked into it or seen anything about that, but programs should allow selecting the device you want. I guess the catch here is that it might not be common to have more than one webcam so video0 might be hardcoded.

The device ordering is done by the order that you plug the devices or that the devices are detected, so for usb devices that are always plugged in, the ordering might not stay constant. What you could try to do is use an udev rule* to rename the device node of your internal webcam to video1 and the external webcam to video0, that way programs should default to using the external webcam.

*The idea here is to do something similar to what systemd does to network cards to have a stable naming scheme.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#3 2018-03-12 12:49:38

nze
Member
Registered: 2010-10-11
Posts: 18

Re: How does Firefox (Skype / Chrome) pick the default webcam?

Hmm how do I get a udev listing of known video devices?

Offline

#4 2018-03-12 14:56:58

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,425

Re: How does Firefox (Skype / Chrome) pick the default webcam?

Try

udevadm info /sys/class/video4linux/*

Also look at the wiki article, the given rule writing example is literally about what you want to do.

Last edited by V1del (2018-03-12 14:59:25)

Offline

#5 2018-03-13 13:53:55

nze
Member
Registered: 2010-10-11
Posts: 18

Re: How does Firefox (Skype / Chrome) pick the default webcam?

V1del wrote:

Try

udevadm info /sys/class/video4linux/*

Also look at the wiki article, the given rule writing example is literally about what you want to do.

The wiki example does not do what I need. It creates a symlink.

Webrtc is used by Firefox (and Chrome) to handle webcams. The code that searches for available devices simply loops through /dev/video[0-63], so symlinking is useless, and passing a NAME=video4 action in the udev rule instead raises the following error:

NAME="video4" ignored, kernel device nodes cannot be renamed; please fix it in /etc/udev/rules.d/83-webcam.rules:2

Last edited by nze (2018-03-13 14:14:20)

Offline

#6 2018-03-14 10:28:13

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,425

Re: How does Firefox (Skype / Chrome) pick the default webcam?

Wether that's in the Webrtc code or not, you will want to find out if switching the correct card to video0 selects the correct defaults. It's also not certain that webrtc is used in both cases, it might be likely for FF no clue if skype uses that same code. And unless you post the output of the command I mentioned and the way you adjusted the rule file, we won't be able to figure out what's wrong (i.e. you can't rename an existing device node, you can however tell it which device node for which card should be created when the device is plugged in).

Offline

#7 2018-03-19 09:26:35

nze
Member
Registered: 2010-10-11
Posts: 18

Re: How does Firefox (Skype / Chrome) pick the default webcam?

V1del wrote:

Wether that's in the Webrtc code or not, you will want to find out if switching the correct card to video0 selects the correct defaults. It's also not certain that webrtc is used in both cases, it might be likely for FF no clue if skype uses that same code. And unless you post the output of the command I mentioned and the way you adjusted the rule file, we won't be able to figure out what's wrong (i.e. you can't rename an existing device node, you can however tell it which device node for which card should be created when the device is plugged in).

How? This would be very useful indeed!

Here's the output of $ for f in  /sys/class/video4linux/*; do udevadm info $f; done

P: /devices/pci0000:00/0000:00:14.0/usb2/2-8/2-8:1.0/video4linux/video0
N: video0
S: v4l/by-id/usb-J30DAT5XP_Integrated_Camera-video-index0
S: v4l/by-path/pci-0000:00:14.0-usb-0:8:1.0-video-index0
E: COLORD_DEVICE=1
E: COLORD_KIND=camera
E: DEVLINKS=/dev/v4l/by-id/usb-J30DAT5XP_Integrated_Camera-video-index0 /dev/v4l/by-path/pci-0000:00:14.0-usb-0:8:1.0-video-index0
E: DEVNAME=/dev/video0
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb2/2-8/2-8:1.0/video4linux/video0
E: ID_BUS=usb
E: ID_FOR_SEAT=video4linux-pci-0000_00_14_0-usb-0_8_1_0
E: ID_MODEL=Integrated_Camera
E: ID_MODEL_ENC=Integrated\x20Camera
E: ID_MODEL_ID=7035
E: ID_PATH=pci-0000:00:14.0-usb-0:8:1.0
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_8_1_0
E: ID_REVISION=1004
E: ID_SERIAL=J30DAT5XP_Integrated_Camera
E: ID_TYPE=video
E: ID_USB_DRIVER=uvcvideo
E: ID_USB_INTERFACES=:0e0100:0e0200:
E: ID_USB_INTERFACE_NUM=00
E: ID_V4L_CAPABILITIES=:capture:
E: ID_V4L_PRODUCT=Integrated Camera: Integrated C
E: ID_V4L_VERSION=2
E: ID_VENDOR=J30DAT5XP
E: ID_VENDOR_ENC=J30DAT5XP
E: ID_VENDOR_ID=04ca
E: MAJOR=81
E: MINOR=0
E: SUBSYSTEM=video4linux
E: TAGS=:uaccess:seat:
E: USEC_INITIALIZED=55119721

P: /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/video4linux/video1
N: video1
S: v4l/by-id/usb-046d_HD_Pro_Webcam_C920_A07951AF-video-index0
S: v4l/by-path/pci-0000:00:14.0-usb-0:2:1.0-video-index0
E: COLORD_DEVICE=1
E: COLORD_KIND=camera
E: DEVLINKS=/dev/v4l/by-path/pci-0000:00:14.0-usb-0:2:1.0-video-index0 /dev/v4l/by-id/usb-046d_HD_Pro_Webcam_C920_A07951AF-video-index0
E: DEVNAME=/dev/video1
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/video4linux/video1
E: ID_BUS=usb
E: ID_FOR_SEAT=video4linux-pci-0000_00_14_0-usb-0_2_1_0
E: ID_MODEL=HD_Pro_Webcam_C920
E: ID_MODEL_ENC=HD\x20Pro\x20Webcam\x20C920
E: ID_MODEL_ID=082d
E: ID_PATH=pci-0000:00:14.0-usb-0:2:1.0
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_2_1_0
E: ID_REVISION=0011
E: ID_SERIAL=046d_HD_Pro_Webcam_C920_A07951AF
E: ID_SERIAL_SHORT=A07951AF
E: ID_TYPE=video
E: ID_USB_DRIVER=uvcvideo
E: ID_USB_INTERFACES=:0e0100:0e0200:010100:010200:
E: ID_USB_INTERFACE_NUM=00
E: ID_V4L_CAPABILITIES=:capture:
E: ID_V4L_PRODUCT=HD Pro Webcam C920
E: ID_V4L_VERSION=2
E: ID_VENDOR=046d
E: ID_VENDOR_ENC=046d
E: ID_VENDOR_ID=046d
E: MAJOR=81
E: MINOR=1
E: SUBSYSTEM=video4linux
E: TAGS=:uaccess:seat:
E: USEC_INITIALIZED=232809429

This is the output of dmesg when I plugged in the USB webcam:

[  229.864998] usb 2-2: new high-speed USB device number 8 using xhci_hcd
[  232.240553] usb 2-2: New USB device found, idVendor=046d, idProduct=082d
[  232.240556] usb 2-2: New USB device strings: Mfr=0, Product=2, SerialNumber=1
[  232.240558] usb 2-2: Product: HD Pro Webcam C920
[  232.240560] usb 2-2: SerialNumber: A07951AF
[  232.241119] uvcvideo: Found UVC 1.00 device HD Pro Webcam C920 (046d:082d)
[  232.242061] uvcvideo 2-2:1.0: Entity type for entity Processing 3 was not initialized!
[  232.242066] uvcvideo 2-2:1.0: Entity type for entity Extension 6 was not initialized!
[  232.242069] uvcvideo 2-2:1.0: Entity type for entity Extension 12 was not initialized!
[  232.242072] uvcvideo 2-2:1.0: Entity type for entity Camera 1 was not initialized!
[  232.242075] uvcvideo 2-2:1.0: Entity type for entity Extension 8 was not initialized!
[  232.242078] uvcvideo 2-2:1.0: Entity type for entity Extension 9 was not initialized!
[  232.242081] uvcvideo 2-2:1.0: Entity type for entity Extension 10 was not initialized!
[  232.242084] uvcvideo 2-2:1.0: Entity type for entity Extension 11 was not initialized!
[  232.242216] input: HD Pro Webcam C920 as /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/input/input23
[  233.063839] usbcore: registered new interface driver snd-usb-audio

Offline

#8 2018-03-25 16:17:47

nze
Member
Registered: 2010-10-11
Posts: 18

Re: How does Firefox (Skype / Chrome) pick the default webcam?

Any suggestions on how to fix the naming of device nodes? V1del, anyone?

Offline

Board footer

Powered by FluxBB