[fixed] Lenovo Thinkpad L450 with Ubuntu 14.04 – Webcam / Camera not working

I just installed Ubuntu 14.04 LTS on my new Lenovo Thinkpad L450. Everything worked fine, except the built-in camera (Webcam) which simply was not recognized. In this article I’ll show how to fix the camera problems on the L450.

The problem

I first discovered the problem when I tested Skype on the new machine. The webcam was not found by any tool… First I thought I accidentally disabled the camera in the UEFI/BIOS settings (When booting, press ENTER followed by F1 to get into the menu. Then navigate to Security -> I/O Port Access and enable the Webcam), which actually was true. But enabling the camera in the BIOS menu did not solve the problem. lsusb did not recognize the camera and Skype told me there is no webcam connected to my Thinkpad. Cheese also told me „No device found“. So I did a little research. First I want to show you what my lsbusb output looks like:


$ lsusb

Bus 003 Device 002: ID 8087:8001 Intel Corp. 
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 17ef:1010 Lenovo 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 5986:055a Acer, Inc 
Bus 001 Device 006: ID 045e:00db Microsoft Corp. Natural Ergonomic Keyboard 4000 V1.0
Bus 001 Device 005: ID 045e:00d1 Microsoft Corp. Optical Mouse with Tilt Wheel
Bus 001 Device 004: ID 17ef:100f Lenovo 
Bus 001 Device 002: ID 17ef:1010 Lenovo 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The camera has the ID 5986:055a. Using this ID, I could find two patches on the internet. Hours of trying and testing later, I finally made the cam work.

Applying the patches

Post #25 in bugs.launchpad.net/ubuntu/+source/linux-lts-utopic/+bug/1433906 contains a file named uvc.patch. The file looks like this:

--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -1841,6 +1841,19 @@ static int uvc_register_chains(struct uvc_device *dev)
 	return 0;
 }
 
+static int uvc_quirk_fix_broken_chain(struct uvc_device *dev)
+{
+	struct uvc_entity *entity;
+	__u8 broken_id = 3;
+
+	entity = uvc_entity_by_id(dev, broken_id);
+	if (entity == NULL)
+		return -EINVAL;
+	*(entity->baSourceID) = 4;
+	return 0;
+}
+
+
 /* ------------------------------------------------------------------------
  * USB probe, disconnect, suspend and resume
  */
@@ -1927,6 +1940,14 @@ static int uvc_probe(struct usb_interface *intf,
 	if (uvc_ctrl_init_device(dev) < 0)
 		goto error;
 
+	if (dev->quirks & UVC_QUIRK_FIX_BROKEN_CHAIN) {
+		if (uvc_quirk_fix_broken_chain(dev) < 0)
+			uvc_trace(UVC_TRACE_PROBE,
+			"Warning: tried to fix a broken uvc chain "
+			"(UVC_QUIRK_FIX_BROKEN_CHAIN), but failed. "
+			"Will continue probing the device, "
+			"but it may fail later.\n");
+	}
 	/* Scan the device for video chains. */
 	if (uvc_scan_device(dev) < 0)
 		goto error;
@@ -2545,6 +2566,15 @@ static struct usb_device_id uvc_ids[] = {
 	  .bInterfaceSubClass	= 1,
 	  .bInterfaceProtocol	= 0,
 	  .driver_info		= UVC_QUIRK_FORCE_Y8 },
+	/* Acer Integrated Camera */
+	{ .match_flags        = USB_DEVICE_ID_MATCH_DEVICE
+				| USB_DEVICE_ID_MATCH_INT_INFO,
+	  .idVendor		= 0x5986,
+	  .idProduct		= 0x055a,
+	  .bInterfaceClass	= USB_CLASS_VIDEO,
+	  .bInterfaceSubClass	= 1,
+	  .bInterfaceProtocol	= 0,
+	  .driver_info		= UVC_QUIRK_FIX_BROKEN_CHAIN },
 	/* Generic USB Video Class */
 	{ USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, 0) },
 	{}
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -152,6 +152,7 @@
 #define UVC_QUIRK_RESTRICT_FRAME_RATE	0x00000200
 #define UVC_QUIRK_RESTORE_CTRLS_ON_INIT	0x00000400
 #define UVC_QUIRK_FORCE_Y8		0x00000800
+#define UVC_QUIRK_FIX_BROKEN_CHAIN	0x00001000
 
 /* Format flags */
 #define UVC_FMT_FLAG_COMPRESSED		0x00000001

This post also explains how to apply the patch to the kernel. But first, have a look at a second patch. I found ignore_chining_errors.patch here. This file contains the following:


--- drivers/media/usb/uvc/uvc_driver.c.orig 2015-06-06 22:48:39.375283516 +0900
+++ drivers/media/usb/uvc/uvc_driver.c 2015-06-06 22:48:08.371766829 +0900
@@ -1496,7 +1496,8 @@
if (entity == NULL) {
uvc_trace(UVC_TRACE_DESCR, "Found reference to "
"unknown entity %d.\n", id);
- return -EINVAL;
+// return -EINVAL;
+return 0;
}

*_entity = entity;
@@ -1518,7 +1519,8 @@
if (entity->chain.next || entity->chain.prev) {
uvc_trace(UVC_TRACE_DESCR, "Found reference to "
"entity %d already in chain.\n", entity->id);
- return -EINVAL;
+// return -EINVAL;
+return 0;
}

/* Process entity */

I needed to change the first two lines to


--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c

in order to use the patch.

For me, no patch worked without the other. I had to apply both to make the camera work. These were my steps:


# Download kernel sources
mkdir ~/debian/src -p
cd ~/debian/src
apt-get source linux-image-$(uname -r)
cd linux-lts-wily-4.2.0

# Copy the patch files here!
# Replace ?????? by real path to downloaded patches (or download directly to the current directory)
cp ??????/*.patch .

# Apply patches
patch -p1 < uvc.patch
patch -p1 < ignore_chining_errors.patch
cd drivers/media/usb/uvc/

# Compile uvcvideo module
make -C /lib/modules/$(uname -r)/build M=$(pwd) modules

# Install new uvcvideo module
# If this step does not work for you, please read further! If it works, maybe you're lucky and the cam also works now. If not, be patient :)
sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) modules_install

# Reload module
sudo rmmod uvcvideo
sudo modprobe uvcvideo

For me, make […] modules_install  did not work due to this error:

make: Entering directory `/usr/src/linux-headers-4.2.0-25-generic‘
INSTALL ~/debian/src/linux-lts-wily-4.2.0/drivers/media/usb/uvc/uvcvideo.ko
Can’t read private key
DEPMOD 4.2.0-25-generic
make: Leaving directory `/usr/src/linux-headers-4.2.0-25-generic‘

I don’t really know how to fix this. Maybe my Ubuntu does not want me to load unsigned kernel modules… Fortunately, you don’t have to install the module. You can just load it without installing it by doing this:

sudo insmod uvcvideo.ko

This worked for me. The cam was now recognized and I could use it in Skype. But the downside of this is that you have to do this again after every reboot. So I tried to just copy uvcvideo.ko to the proper place (I think this is basically what make modules_install does, without checking keys), which worked:


sudo mv/lib/modules/4.2.0-25-generic/kernel/drivers/media/usb/uvc/uvcvideo.ko /lib/modules/4.2.0-25-generic/kernel/drivers/media/usb/uvc/uvcvideo.ko.old #backup
sudo cp uvcvideo.ko /lib/modules/4.2.0-25-generic/kernel/drivers/media/usb/uvc/

When done, reload the module!

sudo rmmod uvcvideo
sudo modprobe uvcvideo

Test if it works

Now you can test the webcam. I used the „cheese“ tool, but you can also test it using skype or any other software that uses the camera.

Please let me know if this helped you!

1 Star2 Stars3 Stars4 Stars5 Stars (4 Stimme, durchschnittlich 4,50 / 5)
Loading...


7 Kommentare zu “[fixed] Lenovo Thinkpad L450 with Ubuntu 14.04 – Webcam / Camera not working”

  1. After „patch -p1 < uvc.patch
    patch -p1 < ignore_chining_errors.patch"

    Im asked for "File to patch:" could you help me with the path?
    Thanks

  2. Did you correct the first lines of the patch? They should be

    – – – a/drivers/media/usb/uvc/uvc_driver.c
    +++ b/drivers/media/usb/uvc/uvc_driver.c

  3. For me it hits with error:
    =========================================================
    snazzy@snazzy-ThinkPad-E450:~/debian/src/linux-lts-wily-4.2.0/drivers/media/usb/uvc$ sudo insmod uvcvideo.ko
    insmod: ERROR: could not insert module uvcvideo.ko: File exists
    ================================================================
    I simply copied the generated file uvcvideo.ko after taking backup and it worked like charm 🙂
    Thanks For sharing this 🙂 🙂

    On Lighter note I am non German and security check for comment is in German so tough for us(non German) 🙁 to pass.

  4. Vielen Dank für den tollen Artikel =)

  5. couldn’t even get close to solving this problem on my system.

    „cd linux-lts-wily-4.2.0“ just got me an error message: „bash: cd: linux-lts-wily-4.2.0: Datei oder Verzeichnis nicht gefunden“

    Then, when using „patch -p1 < uvc.patch", I get:

    "can't find file to patch at input line 3
    Perhaps you used the wrong -p or –strip option?
    The text leading up to this was:
    ————————–
    |— a/drivers/media/usb/uvc/uvc_driver.c
    |+++ b/drivers/media/usb/uvc/uvc_driver.c
    ————————–
    File to patch: "

    I then checked: on my 16.04 system there is no such file, no such directory either…

    Any ideas?

  6. Did you copy all files like I described?

  7. Thanks man, you saved my life. Everything works like a charm.

    I was not able to compile the module into kernel, module_install shows some errors.


    INSTALL /home/abc/debian/src/linux-lts-xenial-4.4.0/drivers/media/usb/uvc/uvcvideo.ko
    At main.c:222:
    – SSL error:02001002:system library:fopen:No such file or directory: bss_file.c:169
    – SSL error:2006D080:BIO routines:BIO_new_file:no such file: bss_file.c:172
    sign-file: certs/signing_key.pem: No such file or directory
    DEPMOD 4.4.0-42-generic
    make: Leaving directory `/usr/src/linux-headers-4.4.0-42-generic‘

    So, I simply copied the uvcvideo.ko to kernel modules and reloaded.


    $ sudo cp uvcvideo.ko /lib/modules/4.4.0-42-generic/kernel/drivers/media/usb/uvc/ -v
    ‘uvcvideo.ko’ -> ‘/lib/modules/4.4.0-42-generic/kernel/drivers/media/usb/uvc/uvcvideo.ko’

    $ sudo rmmod uvcvideo

    $ sudo modprobe uvcvideo

    done

    camera detecting:

    [41740.511685] uvcvideo: module verification failed: signature and/or required key missing – tainting kernel
    [41740.512395] uvcvideo: Found UVC 1.00 device Integrated Camera (5986:055a)
    [41740.515418] usbcore: registered new interface driver uvcvideo

    Thanks,
    Vipin

Hinterlasse einen Kommentar!

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.

»Informationen zum Artikel

Autor: Simon
Datum: 25.01.2016
Zeit: 21:09 Uhr
Kategorien: Computer
Gelesen: 10711x heute: 3x

Kommentare: RSS 2.0.
Diesen Artikel kommentieren oder einen Trackback senden.

»Meta