patjak / facetimehd

Reverse engineered Linux driver for the FacetimeHD (Broadcom 1570) PCIe webcam
GNU General Public License v2.0
1.35k stars 160 forks source link

Unloading bdc_pci should not be needed. #40

Open xgnata opened 8 years ago

xgnata commented 8 years ago

On my box, a simple modprobe facetimehd does not work. One has to unload bdc_pci first and then load facetimehd. I know that with behaviour is documented in the Additional Notes of the wiki. However, I think it is a issue which should be on the "FIXME" list (as the driver is now streaming more or less like a charm).

WhyNotHugo commented 8 years ago

What the Arch package does, is blacklists bdc_pci. This is done by including a /etc/modprobe.d/bcwc-pcie.conf file. Its contents of the file are just one line: blacklist bdc_pci.

I'd suggest adding that upstream/here, but currently there's no installation script which would do this (current Makefile merely builds the package, as far as I understand).

Malo87 commented 8 years ago

I just drop two lines in a loadWebcamModule.sh (chmod a+x):

!/bin/sh

sudo modprobe -r bdc_pci sudo modprobe facetimehd

then $> ./loadWebcamModule.sh

wvengen commented 8 years ago

Do we have a pci device id collision here? Looking at the type of chip, it seems to me that the facetimehd device is more abundant, and it may be useful to blacklist bdc_pci by default if this driver gets mainstream.

https://github.com/torvalds/linux/blob/master/drivers/usb/gadget/udc/bdc/Kconfig http://cateee.net/lkddb/web-lkddb/USB_BDC_PCI.html

WhyNotHugo commented 8 years ago

I just drop two lines in a loadWebcamModule.sh (chmod a+x):

There's no such script in the repository. Using modprobe.d sound like the standard approach too.

patjak commented 8 years ago

bdc_pci needs to be more restrictive on grabbing the device so the change should be done there. Not much we can do since broadcom decided to reuse the pci id.

xgnata commented 8 years ago

Any chance to contact Ashwini Pahuja (bdc_pci (maintainer) and ask him to do the change in his driver? Maybe it is to early?

Xavier

bdc_pci needs to be more restrictive on grabbing the device so the change should be done there. Not much we can do since broadcom decided to reuse the pci id.

— Reply to this email directly or view it on GitHub https://github.com/patjak/bcwc_pcie/issues/40#issuecomment-170181966.

wvengen commented 8 years ago

I don't think it's too early - kernel changes may take some time to ripple through. I'd be happy to contact him if needed.

xgnata commented 8 years ago

I did contact him asking if he could use PCI_CLASS to resolve this conflict.

wvengen commented 8 years ago

:+1:

proninyaroslav commented 8 years ago

@hobarrera I can't add it to the blacklist on Ubuntu 15.10 (he still loaded).

wvengen commented 8 years ago

@proninyaroslav I suppose you edited /etc/modprobe.d/blacklist.conf and rebooted? You may need to run update-initramfs in between (depends). http://askubuntu.com/questions/110341/how-to-blacklist-kernel-modules https://help.ubuntu.com/community/Loadable_Modules#Blacklisting_Modules https://wiki.debian.org/KernelModuleBlacklisting https://bugs.launchpad.net/ubuntu/+source/linux/+bug/227158

xgnata commented 8 years ago

Another (better) way of solving the problem is to fix bdc_pci. I have already sent a bug report on the linux-pci list. However, coming with a patch would probably speedup the process quite a bit. Both bdc-pci and facetimehd should not only look at the pci-id to decide to grab the device or not. If facetimehd code is already looking at e.g. the pci-class then it should be easy to copy this part of the code into a patch for bdc-pci (assuming bdc-pci class is documented somewhere...). I'll try to find a bit of time to look at that. Le 18 janv. 2016 2:29 PM, "wvengen" notifications@github.com a écrit :

@proninyaroslav https://github.com/proninyaroslav I suppose you edited /etc/modprobe.d/blacklist.conf and rebooted? You may need to run update-initramfs in between (depends). http://askubuntu.com/questions/110341/how-to-blacklist-kernel-modules https://help.ubuntu.com/community/Loadable_Modules#Blacklisting_Modules https://wiki.debian.org/KernelModuleBlacklisting https://bugs.launchpad.net/ubuntu/+source/linux/+bug/227158

— Reply to this email directly or view it on GitHub https://github.com/patjak/bcwc_pcie/issues/40#issuecomment-172527211.

wvengen commented 8 years ago

that's even better in the long run, great!

proninyaroslav commented 8 years ago

Maybe off topic, but after update-initramfs touchpad stopped working (MacBook Air 2014). Repeated deleting module of blacklist, update-initramfs and reboot didn't help. /var/log/Xorg.0.log http://pastebin.com/61gXjZBa

Bus 001 Device 003: ID 05ac:0291 Apple, Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x05ac Apple, Inc.
  idProduct          0x0291 
  bcdDevice            1.71
  iManufacturer           1 Apple Inc.
  iProduct                2 Apple Internal Keyboard / Trackpad
  iSerial                 3 DQ64125GGGPF94RA3C1
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           84
    bNumInterfaces          3
    bConfigurationValue     1
iConfiguration          4 Keyboard / Trackpad
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              5 Device Management
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
 bDescriptorType        34 Report
          wDescriptorLength      26
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               8
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              6 Keyboard / Boot
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode           13 International (ISO)
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     182
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               8
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      2 Mouse
      iInterface              7 Trackpad / Boot
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     110
         Report Descriptors: 
bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     110
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)
dcunited001 commented 8 years ago

@proninyaroslav for me, after i installed the mtrack touchpad drivers, then facetimehd does not autoload and instead bdc_pci does

xgnata commented 8 years ago

I wrote a patch to fix bdc_pci but so far no feedback from the author or from kernel maintainers. I would help a lot if someone could find a doc proving that this USB controller driven by bdc_pci has a device class ID equal to 0x0c (like any other usb controller). It seems that "nobody" it using bdc_pci for real. Could someone find even only a doc showing what this controller (it is a Broadcom IP block) really is??? It looks like it exist on some ARM plateforms....but it is annoying to have a driver of a device "nobody" seems to care about grabbing incorrectly a pretty widely use webcam. Anyone with better google skills that me??

patjak commented 8 years ago

I'll get in contact with him and if he is unresponsive I'll just send out the patch to fix it. He's working for Broadcom so if they are sloppy with PCI ID assignments it's their fault and they will have to adjust. Thanks for looking at this.