Webcam not working

Dear all,

I want to use the Logitech HD Pro Webcam C920 on FreeBSD 12.0 but it does not seem to work. While searching the net several other people seemed to had success getting the webcam to work (except audio which is not important to my use case).

The webcam is supported in FreeBSD by webcamd according to the compatibility list here:


I followed the usual installation instructions present in the man page of webcamd and also referred the page of the developer:


But webcamd always exits with:

webcamd: Cannot find USB device

Here's what I have done:

Installed webcamd from pkg and then from ports (debugging and all other options enabled). Manually installed cuse4bsd-kmod and v4l stuff (libv4l, v4l-utils, v4l_compat) again and recompiled webcamd.

Code:
kldload cuse

Code:
service devd restart

Code:
usbconfig dump_device_desc dump_curr_config_desc

ugen0.5: <vendor 0x046d HD Pro Webcam C920> at usbus0, cfg=255 md=HOST spd=HIGH (480Mbps) pwr=ON (100mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x00ef  <Miscellaneous device>
  bDeviceSubClass = 0x0002
  bDeviceProtocol = 0x0001
  bMaxPacketSize0 = 0x0040
  idVendor = 0x046d
  idProduct = 0x0892
  bcdDevice = 0x0019
  iManufacturer = 0x0000  <no string>
  iProduct = 0x0002  <HD Pro Webcam C920>
  iSerialNumber = 0x0001  <FEEFA12F>
  bNumConfigurations = 0x0001

I checked that the vendor id 046d and product id 0892 are present in the source code of webcamd.

Code:
kldstat 

Id Refs Address                Size Name
 1   56 0xffffffff80200000  220f340 kernel
 2    1 0xffffffff82410000     6230 ichsmb.ko
 3    3 0xffffffff82417000     2e18 smbus.ko
 4    1 0xffffffff8241b000     2da8 smb.ko
 5    1 0xffffffff8241e000    1cec0 if_rtwn_usb.ko
 6    2 0xffffffff8243b000    24a08 rtwn.ko
 7    1 0xffffffff82460000     8b80 rtwn-rtl8192eufw.ko
 8    1 0xffffffff82469000     c7e0 aesni.ko
 9    1 0xffffffff826ea000     2be8 coretemp.ko
10    1 0xffffffff826ed000    1a1a8 asmc.ko
11    1 0xffffffff82ffa000     81f0 tmpfs.ko
12    1 0xffffffff83003000     1a20 fdescfs.ko
13    1 0xffffffff83005000     1800 uhid.ko
14    1 0xffffffff83007000     23a8 ums.ko
15    1 0xffffffff8300a000     3aa0 ng_ubt.ko
16    5 0xffffffff8300e000     a020 netgraph.ko
17    1 0xffffffff83019000     9608 ng_hci.ko
18    3 0xffffffff83023000      9c0 ng_bluetooth.ko
19    1 0xffffffff83024000     cd40 ng_l2cap.ko
20    1 0xffffffff83031000    1b9c0 ng_btsocket.ko
21    1 0xffffffff8304d000     2190 ng_socket.ko
22    1 0xffffffff83050000      9f0 pflog.ko
23    1 0xffffffff83051000    327e8 pf.ko
24    1 0xffffffff83084000     4c40 cuse4bsd.ko

Above is the output of kldstat, it does not make a difference having the old cuse4bsd kernel module loaded (as above) present in /boot/modules or the official cuse module.

Code:
webcamd -d ugen0.5
virtual DVB server adapter driver, version 1.0-hps, (c) 2011 Hans Petter Selasky
IR NEC protocol handler initialized
IR RC5(x/sz) protocol handler initialized
IR RC6 protocol handler initialized
IR JVC protocol handler initialized
IR Sony protocol handler initialized
IR SANYO protocol handler initialized
IR XMP protocol handler initialized
b2c2-flexcop: B2C2 FlexcopII/II(b)/III digital TV receiver chip loaded successfully
USB Video Class driver (1.1.1)
cpia2: V4L-Driver for Vision CPiA2 based cameras v3.0.1
USBVision USB Video Device Driver for Linux : 0.9.11
webcamd: Cannot find USB device

Everything is run as root. So likely no issues with permissions.

So, what am I doing wrong? Or am I missing something?

I'm really puzzled. Thanks a lot for any help.
 
A total shot in the dark as I know nothing about setting up webcams but is it possible you still need Linux modules loaded for this to work???
 
It's entirely possible that some linux modules are required. However, the man pages to webcamd do not mention that. And I am unsure where to look for these modules. Or is it required to specificly enable some linux support in the kernel? I could not find whether a firmware is required or not. I could try on a linux machine tomorrow, though.

Starting hal and dbus does not help.

service hald onestart
Code:
Starting dbus.
Starting hald.

webcamd -d ugen0.5
Code:
virtual DVB server adapter driver, version 1.0-hps, (c) 2011 Hans Petter Selasky
IR NEC protocol handler initialized
IR RC5(x/sz) protocol handler initialized
IR RC6 protocol handler initialized
IR JVC protocol handler initialized
IR Sony protocol handler initialized
IR SANYO protocol handler initialized
IR XMP protocol handler initialized
b2c2-flexcop: B2C2 FlexcopII/II(b)/III digital TV receiver chip loaded successfully
USB Video Class driver (1.1.1)
cpia2: V4L-Driver for Vision CPiA2 based cameras v3.0.1
USBVision USB Video Device Driver for Linux : 0.9.11
webcamd: Cannot find USB device
 
A total shot in the dark as I know nothing about setting up webcams but is it possible you still need Linux modules loaded for this to work???

It's entirely possible that some linux modules are required. However, the man pages to webcamd do not mention that. And I am unsure where to look for these modules. Or is it required to specificly enable some linux support in the kernel?

No, linux.ko/linux64.ko/linux_common.ko are not required — they implement syscalls for Linux applications, it's downright impossible to call them from the native FreeBSD executable.
 
And? Webcamd is a collection of Linux USB device drivers patched to run as a native FreeBSD userspace program. (They are covered by GPL, so they can't be reused in any other way.)
 
I just plugged in my old Logitech Orbit PTZ webcam. Although it's not HD, it works with VLC as intended, including PTZ

Code:
uname -nr
fbsds-12 12.0-RELEASE-p10

I did the following:

pkg install webcamd
pkg install libv4l
pkg install v4l2_compat

in:
/boot/loader.conf
Code:
cuse_load="YES"
in:
/etc/rc.conf
Code:
webcamd_enable="YES"

Code:
kldstat
4    1 0xffffffff829f4000     bf70 cuse.ko

webcam-shot.png
 
Do you get any messages from the cuse kernel module? All I get is...

Code:
Cuse v0.1.35 @ /dev/cuse

I'm really puzzled why my webcam is not detected. Could it be also the USB bus?

Just in case, here is the output of pciconf -l -v. I am on a Mac mini 2014.

Code:
hostb0@pci0:0:0:0:      class=0x060000 card=0x0141106b chip=0x0a048086 rev=0x09 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Haswell-ULT DRAM Controller'
    class      = bridge
    subclass   = HOST-PCI
vgapci0@pci0:0:2:0:     class=0x030000 card=0x0141106b chip=0x0a2e8086 rev=0x09 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Haswell-ULT Integrated Graphics Controller'
    class      = display
    subclass   = VGA
none0@pci0:0:3:0:       class=0x040300 card=0x0141106b chip=0x0a0c8086 rev=0x09 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Haswell-ULT HD Audio Controller'
    class      = multimedia
    subclass   = HDA
xhci0@pci0:0:20:0:      class=0x0c0330 card=0x72708086 chip=0x9c318086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '8 Series USB xHCI HC'
    class      = serial bus
    subclass   = USB
none1@pci0:0:22:0:      class=0x078000 card=0x72708086 chip=0x9c3a8086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '8 Series HECI'
    class      = simple comms
none2@pci0:0:27:0:      class=0x040300 card=0x72708086 chip=0x9c208086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '8 Series HD Audio Controller'
    class      = multimedia
    subclass   = HDA
pcib1@pci0:0:28:0:      class=0x060400 card=0x72708086 chip=0x9c108086 rev=0xe4 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '8 Series PCI Express Root Port 1'
    class      = bridge
    subclass   = PCI-PCI
pcib2@pci0:0:28:2:      class=0x060400 card=0x72708086 chip=0x9c148086 rev=0xe4 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '8 Series PCI Express Root Port 3'
    class      = bridge
    subclass   = PCI-PCI
pcib3@pci0:0:28:3:      class=0x060400 card=0x72708086 chip=0x9c168086 rev=0xe4 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '8 Series PCI Express Root Port 4'
    class      = bridge
    subclass   = PCI-PCI
pcib4@pci0:0:28:4:      class=0x060400 card=0x72708086 chip=0x9c188086 rev=0xe4 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '8 Series PCI Express Root Port 5'
    class      = bridge
    subclass   = PCI-PCI
pcib13@pci0:0:28:5:     class=0x060400 card=0x72708086 chip=0x9c1a8086 rev=0xe4 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '8 Series PCI Express Root Port 6'
    class      = bridge
    subclass   = PCI-PCI
isab0@pci0:0:31:0:      class=0x060100 card=0x72708086 chip=0x9c438086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '8 Series LPC Controller'
    class      = bridge
    subclass   = PCI-ISA
ahci1@pci0:0:31:2:      class=0x010601 card=0x72708086 chip=0x9c038086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '8 Series SATA Controller 1 [AHCI mode]'
    class      = mass storage
    subclass   = SATA
ichsmb0@pci0:0:31:3:    class=0x0c0500 card=0x72708086 chip=0x9c228086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '8 Series SMBus Controller'
    class      = serial bus
    subclass   = SMBus
none3@pci0:2:0:0:       class=0x028000 card=0x013b106b chip=0x43a014e4 rev=0x03 hdr=0x00
    vendor     = 'Broadcom Inc. and subsidiaries'
    device     = 'BCM4360 802.11ac Wireless Network Adapter'
    class      = network
bge0@pci0:3:0:0:        class=0x020000 card=0x168614e4 chip=0x168614e4 rev=0x01 hdr=0x00
    vendor     = 'Broadcom Inc. and subsidiaries'
    device     = 'NetXtreme BCM57766 Gigabit Ethernet PCIe'
    class      = network
    subclass   = ethernet
sdhci_pci0@pci0:3:0:1:  class=0x080501 card=0x000014e4 chip=0x16bc14e4 rev=0x01 hdr=0x00
    vendor     = 'Broadcom Inc. and subsidiaries'
    device     = 'BCM57765/57785 SDXC/MMC Card Reader'
    class      = base peripheral
    subclass   = SD host controller
pcib5@pci0:5:0:0:       class=0x060400 card=0x00000000 chip=0x156d8086 rev=0x00 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'DSL5520 Thunderbolt 2 Bridge [Falcon Ridge 4C 2013]'
    class      = bridge
    subclass   = PCI-PCI
pcib6@pci0:6:0:0:       class=0x060400 card=0x00000000 chip=0x156d8086 rev=0x00 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'DSL5520 Thunderbolt 2 Bridge [Falcon Ridge 4C 2013]'
    class      = bridge
    subclass   = PCI-PCI
pcib7@pci0:6:3:0:       class=0x060400 card=0x00000000 chip=0x156d8086 rev=0x00 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'DSL5520 Thunderbolt 2 Bridge [Falcon Ridge 4C 2013]'
    class      = bridge
    subclass   = PCI-PCI
pcib10@pci0:6:4:0:      class=0x060400 card=0x00000000 chip=0x156d8086 rev=0x00 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'DSL5520 Thunderbolt 2 Bridge [Falcon Ridge 4C 2013]'
    class      = bridge
    subclass   = PCI-PCI
pcib11@pci0:6:5:0:      class=0x060400 card=0x00000000 chip=0x156d8086 rev=0x00 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'DSL5520 Thunderbolt 2 Bridge [Falcon Ridge 4C 2013]'
    class      = bridge
    subclass   = PCI-PCI
pcib12@pci0:6:6:0:      class=0x060400 card=0x00000000 chip=0x156d8086 rev=0x00 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'DSL5520 Thunderbolt 2 Bridge [Falcon Ridge 4C 2013]'
    class      = bridge
    subclass   = PCI-PCI
none4@pci0:7:0:0:       class=0x088000 card=0x00000000 chip=0x156c8086 rev=0x00 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'DSL5520 Thunderbolt 2 NHI [Falcon Ridge 4C 2013]'
    class      = base peripheral
pcib8@pci0:8:0:0:       class=0x060400 card=0x00000000 chip=0x15498086 rev=0x00 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'DSL2210 Thunderbolt Controller [Port Ridge 1C 2011]'
    class      = bridge
    subclass   = PCI-PCI
pcib9@pci0:9:0:0:       class=0x060400 card=0x00000000 chip=0x15498086 rev=0x00 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'DSL2210 Thunderbolt Controller [Port Ridge 1C 2011]'
    class      = bridge
    subclass   = PCI-PCI
bge1@pci0:10:0:0:       class=0x020000 card=0x00f6106b chip=0x168214e4 rev=0x00 hdr=0x00
    vendor     = 'Broadcom Inc. and subsidiaries'
    device     = 'NetXtreme BCM57762 Gigabit Ethernet PCIe'
    class      = network
    subclass   = ethernet
ahci0@pci0:4:0:0:       class=0x010601 card=0x00000000 chip=0x1600144d rev=0x01 hdr=0x00
    vendor     = 'Samsung Electronics Co Ltd'
    device     = 'Apple PCIe SSD'
    class      = mass storage
    subclass   = SATA
 
Do you get any messages from the cuse kernel module? All I get is...
Nope, nothing special from the "cuse" kernel mod.

But, when I read your:
Installed webcamd from pkg and then from ports (debugging and all other options enabled). Manually installed cuse4bsd-kmod and v4l stuff (libv4l, v4l-utils, v4l_compat) again and recompiled webcamd.

I can see one main issue: "Installed webcamd from pkg and then from ports".
You corrupted your webcamd util.

You can try "make uninstall clean" from /usr/ports/multimedia/webcamd/

then,

pkg delete webcamd
pkg autoremove


reboot and:

pkg install webcamd

I dont' know if all that will work, but ...why did you have to make things from source?

Edit:

Here are my USB devices. As you can see, my USB video device looks very generic, but that's enough for webcamd to deal with it.

webcamd [-d ugen5.2] -N vendor-0x046d-product-0x08b5 -S unknown -M 0
webcamd [-d ugen6.2] -N Logitech-Trackball -S unknown -M 0
webcamd [-d ugen6.3] -N SEM-USB-Keyboard -S unknown -M 0


If you get your webcamd util working then try:

webcamd -s

to see what parameters you can play with to make things work for you.
 
No change.

The reason I installed it from source was that I could enable debugging and potentially see some helpful error messages.

On Linux it should be handled by the gspca v4l-module (although under a different name), which is also present in webcamd under FreeBSD.

Code:
gspca_vc032x | 046d:0892 | Logitech Orbicam
 
I'm really puzzled why my webcam is not detected. Could it be also the USB bus?

I always install application(s) with pkg. Only if something doesn't work, then I'll try to build the application(s) from source, after "deleting" and "removing" the app with pkg util. Some applications require many dependencies, by autoremoving or just removing specific package other things in your system as whole may get corrupted or break. And don't mix installation of an app with pkg and then "make" the same app from the source code, without deleting and removing application made with pkg first.
 
On Linux it should be handled by the gspca v4l-module (although under a different name), which is also present in webcamd under FreeBSD.
It seems to me that you kernel driver and webcamd can recognize you camera, but neither knows which logical device it's attached to :)
And, I have no clue either. I'm just another end-user, sometimes confused, just like you :confused:
 
On Linux it should be handled by the gspca v4l-module (although under a different name), which is also present in webcamd under FreeBSD.

Did you ever try to load linux kernel module to see if it helps?

kldload linux

If it helps, then put that in /boot/loader.conf

linux_load="YES"

Btw, I do have linux module in, I forgot to mention. I experiment with many strange FreeBSD things on this workstation. Although, I don't have many kernel modules, tho everything that I install here seems to work OK.

All my kernel modules at boot: cat /boot/loader.conf

zfs_load="YES"
linux_load="YES"
nvidia_load"YES"
nvidia-modeset_load="YES"
coretemp_load="YES"
cuse_load="YES"
 
Yes, linux and linux_common are loaded as modules.

Here's the end of ktrace output (I used ktrace -f webcamd ...; and the kdump to get text output). The truss output are attached as txt file. It seems that webcamd is sending three requests to the device, but doesn't get an answer back if I understand it correctly.


Code:
 68624 webcamd  CALL  openat(AT_FDCWD,0x7fffffffe5b0,0x2<O_RDWR>)
 68624 webcamd  NAMI  "/dev/ugen0.3"
 68624 webcamd  RET   openat 4
 68624 webcamd  CALL  openat(AT_FDCWD,0x7fffffffe5b0,0x2<O_RDWR>)
 68624 webcamd  NAMI  "/dev/ugen0.3"
 68624 webcamd  RET   openat 5
 68624 webcamd  CALL  ioctl(0x5,USB_GET_PLUGTIME,0x7fffffffe59c)
 68624 webcamd  RET   ioctl 0
 68624 webcamd  CALL  ioctl(0x5,USB_FS_INIT,0x7fffffffe5a0)
 68624 webcamd  RET   ioctl 0
 68624 webcamd  CALL  ioctl(0x4,USB_GET_CONFIG,0x7fffffffe604)
 68624 webcamd  RET   ioctl 0
 68624 webcamd  CALL  ioctl(0x5,USB_FS_UNINIT,0x7fffffffe5d0)
 68624 webcamd  RET   ioctl 0
 68624 webcamd  CALL  close(0x5)
 68624 webcamd  RET   close 0
 68624 webcamd  CALL  close(0x4)
 68624 webcamd  RET   close 0
 68624 webcamd  CALL  write(0x2,0x8299ce,0x20)
 68624 webcamd  GIO   fd 2 wrote 32 bytes
       "webcamd: Cannot find USB device
       "
 68624 webcamd  RET   write 32/0x20
 68624 webcamd  CALL  exit(0x40)
 68624 webcamd  RET   _umtx_op -1 errno 4 Interrupted system call
 68624 webcamd  RET   nanosleep -1 errno 4 Interrupted system call
 68624 webcamd  RET   _umtx_op -1 errno 4 Interrupted system call
 68624 webcamd  RET   _umtx_op -1 errno 4 Interrupted system call
 

Attachments

  • truss.txt
    27.3 KB · Views: 256
There is no change when using -mgspca.debug=7. No change in output of webcamd and and when using truss.

I plugged it into my Macbook and there it appears as (and is working just fine):

Code:
HD Pro Webcam C920:

  Product ID:    0x0892
  Vendor ID:    0x046d  (Logitech Inc.)
  Version:    0.19
  Serial Number:    FEEFA12F
  Speed:    Up to 480Mb/sec
  Location ID:    0x14200000 / 1
  Current Available (mA):    500
  Current Required (mA):    500
  Extra Operating Current (mA):    0

Just plugged it back into the FreeBSD-Mac mini:

Code:
ugen0.3: <vendor 0x046d HD Pro Webcam C920> at usbus0, cfg=255 md=HOST spd=HIGH (480Mbps) pwr=ON (100mA)

There it only has 100mA. At least that's what usbconfig reports.

Maybe it does not get enough juice? I tried other ports without changes.

There are options to usb_quirk and quirks like UQ_POWER_CLAIM. But I'm not sure whether they are useful in my case.

I also noticed some entries like the following in the log (also while plugging it out and in again). Not sure if they are related:

Code:
usb_alloc_device: Failure selecting configuration index 0:USB_ERR_TIMEOUT, port 8, addr 11 (ignored)
[..]
usb_alloc_device: Failure selecting configuration index 0:USB_ERR_TIMEOUT, port 8, addr 12 (ignored)

Edit: I found a guy who had a very very similar problem and Hans Petter Selasky (the developer of cuse and probably some other webcamd-related stuff) supplied a patch that fixed his problem. See here: http://freebsd.1045724.x6.nabble.com/Logitech-C525-webcam-won-t-work-on-Raspberry-PI2-td6026068.html
 
Hi, add your uzer to operator group
Code:
pw groupmod operator -m uzer
And try to:
Code:
cat << EOF >> /etc/devfs.rules
[system=10]
add path 'da*' mode 0660 group operator
add path 'ugen*' mode 0660 group operator
EOF
echo 'vfs.usermount=1' >> /etc/sysctl.conf
sysctl vfs.usermount=1
sysrc devfs_system_ruleset=system
service devfs start

--- SteamBSD © is FREE operating system.
YouTube: https://www.youtube.com/channel/UC8wwRY8yGWiJ-bIQlK0wvUA
Site: https://lpros.blogspot.com
 
Back
Top